CLion or CLion Nova on macOS

157 views
Skip to first unread message

Stefan Csomor

unread,
Nov 18, 2023, 3:17:45 AM11/18/23
to wx-u...@googlegroups.com

Hi

 

I’d like to test some things with Qodana but I get stuck with the CLion IDE when used with wx, does anyone have experience with the current CLion version used with the current wx master.

 

I’d be grateful for any pointers …

 

Thanks,

 

Stefan

Giles Forster

unread,
Nov 19, 2023, 5:01:15 AM11/19/23
to wx-users
This is the best guide and following this worked for me in about 5 minutes:


The two things to note are 

* you need to define CMAKE_PREFIX_PATH 

Then it all works. 

Looks something like: 

cmake_minimum_required(VERSION 3.21)
project(wx_first)

set(CMAKE_CXX_STANDARD 17)

set(wxWidgets_ROOT_DIR /Users/bob/Code/wx/wxWidgets-3.2.2.1)
set(wxWidgets_LIBRARIES /Users/bob/Code/wx/wxWidgets-3.2.2.1/build-release/lib)
set(wxWidgets_INCLUDE_DIRS /Users/bob/Code/wx/wxWidgets-3.2.2.1/include)

#
# Remember to add:
# CMAKE_PREFIX_PATH=/Users/bob/Code/wx/wxWidgets-3.2.2.1/build-release
#
# This is in CLion -> Preferences -> Build, Execution, Deployment -> CMake -> Environment

find_package(wxWidgets REQUIRED)
message(STATUS "wxWidgets library:")

# Include the wxWidgets use file to initialize various settings
include(${wxWidgets_USE_FILE})

include(${wxWidgets_USE_FILE})

if(WIN32)
# Include a RC file for windows
list(APPEND SRC_FILES ../sample.rc)
elseif(APPLE)
# Add an icon for the apple .app file
list(APPEND SRC_FILES ../../src/osx/carbon/wxmac.icns)
endif()

# Define the build target for the executable
#add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SRC_FILES})
# Link required libraries to the executable
#target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})

link_libraries(${wxWidgets_LIBRARIES})
add_executable(wx_mysample main.cpp hello.cpp menu.cpp menu.h record_dialog.cpp thread.cpp thread.h)

if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
RESOURCE "../../src/osx/carbon/wxmac.icns"
MACOSX_BUNDLE_ICON_FILE wxmac.icns
MACOSX_BUNDLE_COPYRIGHT "Copyright wxWidgets"
MACOSX_BUNDLE_GUI_IDENTIFIER "org.wxwidgets.minimal"
)
endif()

And setup Settings->Build, Execution , Deployment, CMake -> Environment with your WX build, for example:

CMAKE_PREFIX_PATH=/Users/bob/Code/wx/wxWidgets-3.2.2.1/build-release

Giles

Stefan Csomor

unread,
Nov 20, 2023, 12:03:36 PM11/20/23
to wx-u...@googlegroups.com

Hi Giles

 

Thank you very much. I’ve followed the guide from that post, made several attempts, but always ended up missing some files.

 

I’ve done a full checkout of master (not using a download zip but I hope this shouldn’t matter. ..), built as indicated in the forum post in a directory beside this

 

(is it correct that I don’t need to indicate anything referring to CMake ?)

 

I’ve set CMAKE_PREFIX_PATH to this build dir, added the few dirs settings from your sample, and still it complains about

 

CMake Error at CMakeLists.txt:40 (find_package):

  Could not find a package configuration file provided by "wxWidgets"

  (requested version 3.3) with any of the following names:

 

    wxWidgetsConfig.cmake

    wxwidgets-config.cmake

 

  Add the installation prefix of "wxWidgets" to CMAKE_PREFIX_PATH or set

  "wxWidgets_DIR" to a directory containing one of the above files.  If

  "wxWidgets" provides a separate development package or SDK, be sure it has

  been installed.

 

And IMHO this error is correct, there is no wxWidgets…...cmake anywhere in sight in my build dir …

 

Thanks for any pointers …

 

Stefan

 

PS: I just did the same with a 3.2.4 download, same problem …

 

 

--
Please read
https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wx-users+u...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/wx-users/0c1681d7-671c-44e6-912f-9a27792d6b9fn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages