Re: CLion or CLion Nova on macOS

Giles Forster <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
This is the best guide and following this worked for me in about 5 minutes:

https://forums.wxwidgets.org/viewtopic.php?p=197038#p187276

The two things to note are 

* you need to define *CMAKE_PREFIX_PATH *
* or use the CMake module for WX: 
 https://cmake.org/cmake/help/latest/module/FindwxWidgets.html

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

On Saturday, 18 November 2023 at 08:17:45 UTC Stefan Csomor wrote:

> 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
>

-- 
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/0c1681d7-671c-44e6-912f-9a27792d6b9fn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.