Failed to generate pnglibconf.tf5 error with SDL_image in WSL - c++

I am trying to build a simple project using SDL and SDL_image. Both are added as submodules.
On Windows it compiles without issues. Under WSL (Ubuntu 20.04) I get this error:
[ 61%] Building C object submodules/SDL/CMakeFiles/SDL2.dir/src/sensor/dummy/SDL_dummysensor.c.o
[ 62%] Linking C shared library ../../lib/libSDL2-2.0.so
[ 62%] Built target SDL2
Scanning dependencies of target SDL2main
[ 63%] Building C object submodules/SDL/CMakeFiles/SDL2main.dir/src/main/dummy/SDL_dummy_main.c.o
[ 63%] Linking C static library ../../lib/libSDL2main.a
[ 63%] Built target SDL2main
Scanning dependencies of target genfiles
[ 63%] Generating pnglibconf.c
options.awk: bad line (10): com
CMake Error at scripts/gensrc.cmake:68 (message):
Failed to generate pnglibconf.tf5
make[2]: *** [submodules/SDL_image/external/libpng-1.6.37/CMakeFiles/genfiles.dir/build.make:85: submodules/SDL_image/external/libpng-1.6.37/pnglibconf.c] Error 1
make[1]: *** [CMakeFiles/Makefile2:835: submodules/SDL_image/external/libpng-1.6.37/CMakeFiles/genfiles.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
My root CMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_NAME SDL_Starter_package)
set(PROJECT_TESTS_NAME SDL_Starter_package_tests)
project(${PROJECT_NAME} VERSION 1.0.0)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(submodules/googletest/googletest/include/gtest)
include_directories(submodules/SDL/include)
include_directories(submodules/SDL_image)
add_subdirectory(submodules/googletest)
add_subdirectory(submodules/SDL)
add_subdirectory(submodules/SDL_image)
include_directories(src)
add_subdirectory(src)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
What am I missing? Is it something because I use WSL?

Related

Duplicate symbol QT5 mac m1

I'm trying to compile QT5 in C++ with Cmake on mac M1,
For now i can try with Fedora and it's working, but not on my mac.
This is my CMake File :
cmake_minimum_required(VERSION 3.0)
project(rtype)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CPACK_OUTPUT_FILE_PREFIX "pack")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin)
add_executable(${PROJECT_NAME} src/ecs/main.cpp)
# Adding QT5 dependencies
find_package(Qt5 COMPONENTS Core Network REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network)
# Adding SFML dependencies
find_package(SFML COMPONENTS system window graphics CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-system sfml-window sfml-graphics)
# Ajouter les includes pour SFML
target_include_directories(${PROJECT_NAME}
PRIVATE
${SFML_INCLUDE_DIRS})
# Setting up the CPack generator
set(CPACK_GENERATOR ZIP) # for macOS and Linux
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
set(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icon.icns)
set(CPACK_GENERATOR NSIS) # for Windows
set(CPACK_PACKAGE_NAME "RType")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
include(CPack)
# Setting up the install targets
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin)
install(FILES README.md
DESTINATION .)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/build.sh
DESTINATION .)
If I transform this :
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Network)
to this :
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core)
or this :
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Network)
It's working perfectly, but with both its make this error :
[ 20%] Automatic MOC for target rtype
[ 20%] Built target rtype_autogen
[ 40%] Linking CXX executable /Users/ilaan/Documents/Epitech/Tek3/R-Type/client/bin/rtype
duplicate symbol 'qt_apple_sharedApplication()' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qcore_mac.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qcore_mac.o)
duplicate symbol 'qt_apple_check_os_version()' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qcore_mac.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qcore_mac.o)
duplicate symbol 'qt_apple_isApplicationExtension()' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qcore_mac.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qcore_mac.o)
[...]
duplicate symbol 'RunLoopDebugger::staticMetaObject' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qeventdispatcher_cf.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qeventdispatcher_cf.o)
duplicate symbol 'QEventDispatcherCoreFoundation::staticMetaObject' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qeventdispatcher_cf.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qeventdispatcher_cf.o)
duplicate symbol 'QEventDispatcherCoreFoundation::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)' in:
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib/libQt5Core.a(qeventdispatcher_cf.o)
/Users/ilaan/Documents/Epitech/Tek3/R-Type/vcpkg/installed/arm64-osx/lib//libQt5Core.a(qeventdispatcher_cf.o)
ld: 94 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/ilaan/Documents/Epitech/Tek3/R-Type/client/bin/rtype] Error 1
make[1]: *** [CMakeFiles/rtype.dir/all] Error 2
make: *** [all] Error 2
I don't understand why, is not compatible with M1 Chipset ?
Thank you,
Ilan

CMake find_package cannot find SDL2

Below there is the CMakeLists.txt:
cmake_minimum_required(VERSION 3.20)
project(sdl_test)
set(CMAKE_CXX_STANDARD 20)
list(APPEND CMAKE_PREFIX_PATH "D:/lib/SDL2_mingw")
MESSAGE(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
find_package(sdl2 REQUIRED)
MESSAGE(STATUS "SDL2_INCLUDE_DIRS is ${SDL2_INCLUDE_DIRS}")
MESSAGE(STATUS "SDL2_LIBRARIES is ${SDL2_LIBRARIES}")
include_directories(${SDL2_INCLUDE_DIRS})
include_directories(${SDL2_INCLUDE_DIRS}-config-)
add_executable(sdl_test main.cpp)
target_link_libraries(sdl_test ${SDL2_LIBRARIES})
And the CMake console output is:
-- CMAKE_PREFIX_PATH: D:/lib/SDL2_mingw
-- SDL2_INCLUDE_DIRS is D://include;D://include/SDL2
-- SDL2_LIBRARIES is SDL2::SDL2
-- Configuring done
CMake Error at CMakeLists.txt:15 (add_executable):
Target "sdl_test" links to target "SDL2::SDL2" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.
Not only the ${SDL2_LIBRARIES} (SDL::SDL) cannot be linked, ${SDL2_INCLUDE_DIRS} (D://include;D://include/SDL2) is also wrong. Facutually, it should be D:/lib/SDL2_mingw/include.
My SDL2 lib is under D:/lib/SDL2_mingw. And there does exist a SDL2Config.cmake file. I have write list(APPEND CMAKE_PREFIX_PATH "D:/lib/SDL2_mingw") in the CMakeList.
D:/lib/SDL2_mingw Directory
What's going on here?
Update:
if I enable CMake_GNUtoMS when configure CMake for SDL2, after re-build SDL2 I get both *.a and *.lib files under D:/lib/SDL2_mingw directory.
And then CMake can find the package. However, when compile my project, new error occurs:
mingw32-make.exe[3]: *** No rule to make target 'D:/lib/SDL2_mingw/lib/x64/SDL2.lib', needed by 'sdl_test.exe'. Stop.
mingw32-make.exe[3]: *** Waiting for unfinished jobs....
[ 50%] Building CXX object CMakeFiles/sdl_test.dir/main.cpp.obj
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:82: CMakeFiles/sdl_test.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:89: CMakeFiles/sdl_test.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:123: sdl_test] Error 2

wxWidgets c++ MacOS fails to build because memset_s is undeclared

I'm on macOS 12.4 I have run xcode-select --install to install the build tools. I'm using VSCode and my c++ configurations I've added the mac frameworks as.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks and /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/ The reason I added this second one is it contains a string.h file which contains a declaration for memset_s
The error generated is this:
/Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/Source/wxWidgets_external/src/unix/utilsunx.cpp:229:5: error: use of undeclared identifier 'memset_s'
memset_s(v, n, 0, n);
^
1 error generated.
make[5]: *** [libs/base/CMakeFiles/wxbase.dir/__/__/__/__/src/unix/utilsunx.cpp.o] Error 1
make[4]: *** [libs/base/CMakeFiles/wxbase.dir/all] Error 2
make[3]: *** [all] Error 2
My code is here: https://github.com/Greeley/Culinoire but it's just CMakeLists.txt files right now, and the wxWidgets Hello World as main.cpp also my .vscode directory.
I followed this: this video https://www.youtube.com/watch?v=zdHqoyG73Jk
and this one https://www.youtube.com/watch?v=MfuBS9n5_aY
And then found this on github with the same issue.
https://github.com/wxWidgets/wxWidgets/issues/19334
and put the define at the top of main.cpp and put it in the defines array within c_cpp_properties.json however I still get the same error as above.
I really don't understand what's going wrong. I'd greatly appreciate some help.
there's 4 CMakeLists.txt in the project, these are their contents:
/CMakeLists.txt
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")
project(Culinoire LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ExternalProject base
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subprojects)
set(STAGED_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/stage)
add_subdirectory(external)
include(ExternalProject)
ExternalProject_Add(${PROJECT_NAME}_core
DEPENDS
wxWidgets_external
SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/src
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
-DwxWidgets_ROOT_DIR=${wxWidgets_ROOT_DIR}
-DENV_WX_CONFIG=${ENV_WX_CONFIG}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH}
BUILD_ALWAYS
1
INSTALL_COMMAND
""
)
Edit below: Changed static to 1 and universal to 0
/src/CMakeLists.txt
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")
project(wx_cmake_template_core LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(__STDC_WANT_LIB_EXT1__)
# hack for buggy CMake's FindwxWidgets script
if (DEFINED ENV_WX_CONFIG)
set (ENV{WX_CONFIG} ${ENV_WX_CONFIG})
endif()
set(wxWidgets_USE_DEBUG 1)
set(wxWidgets_USE_UNICODE 1)
set(wxWidgets_USE_UNIVERSAL 0)
set(wxWidgets_USE_STATIC 1)
set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
set(wxWidgets_ROOT_DIR "/Users/Greeley/Library/wxWidgets")
set(wxWidgets_LIBRARIES "/Users/Greeley/Library/wxWidgets/lib")
find_package(wxWidgets COMPONENTS core base REQUIRED HINT ${wxWidgets_ROOT_DIR})
set(SRCS main.cpp)
if (APPLE)
# create bundle on apple compiles
add_executable(main MACOSX_BUNDLE ${SRCS} )
# Set a custom plist file for the app bundle - needed for Mac OS Retina display
set_target_properties(main PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
else()
# the WIN32 is needed for Windows in order for it to look for WinMain
# instead of the main function. This is ignored on other systems,
# so it works on all platforms
add_executable(main WIN32 ${SRCS})
endif()
target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
/external/CMAkeLists.txt
add_subdirectory(wxwidgets)
/external/wxwidgets/CMakeLists.txt
# check if wxWidgets is already installed in the system - using CMake's built in script FindwxWidgets
find_package(wxWidgets QUIET)
if (wxWidgets_FOUND)
message(STATUS "Found preinstalled wxWidgets libraries at ${wxWidgets_LIBRARIES}")
add_library(wxWidgets_external INTERFACE)
else()
message(STATUS "Preinstalled wxWidgets not found.")
message(STATUS "Will download and install wxWidgets in ${STAGED_INSTALL_PREFIX}")
include(ExternalProject)
ExternalProject_Add(wxWidgets_external
GIT_REPOSITORY
https://github.com/wxWidgets/wxWidgets.git
GIT_TAG
3.2
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
-DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
-DwxBUILD_SHARED=OFF
CMAKE_CACHE_ARGS
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
TEST_AFTER_INSTALL
0
DOWNLOAD_NO_PROGRESS
1
LOG_CONFIGURE
1
LOG_BUILD
1
LOG_INSTALL
1
)
set(wxWidgets_ROOT_DIR ${STAGED_INSTALL_PREFIX})
file(TO_NATIVE_PATH "${wxWidgets_ROOT_DIR}" wxWidgets_ROOT_DIR)
set(wxWidgets_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets installation dir")
set (ENV_WX_CONFIG ${STAGED_INSTALL_PREFIX}/bin/wx-config)
file (TO_NATIVE_PATH "${ENV_WX_CONFIG}" ENV_WX_CONFIG)
set(ENV_WX_CONFIG ${ENV_WX_CONFIG} CACHE INTERNAL "wx-config dir")
endif()
EDIT BELOW
I changed the CMakeLists.txt file to
# check if wxWidgets is already installed in the system - using CMake's built in script FindwxWidgets
find_package(wxWidgets QUIET)
if (wxWidgets_FOUND)
message(STATUS "Found preinstalled wxWidgets libraries at ${wxWidgets_LIBRARIES}")
add_library(wxWidgets INTERFACE)
else()
message(STATUS "Preinstalled wxWidgets not found.")
message(STATUS "Will download and install wxWidgets in ${STAGED_INSTALL_PREFIX}")
include(ExternalProject)
ExternalProject_Add(wxWidgets
GIT_REPOSITORY
https://github.com/wxWidgets/wxWidgets.git
GIT_TAG
master
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DwxBUILD_SHARED=OFF
CMAKE_CACHE_ARGS
TEST_AFTER_INSTALL
0
DOWNLOAD_NO_PROGRESS
1
LOG_CONFIGURE
1
LOG_BUILD
1
LOG_INSTALL
1
)
set(wxWidgets_ROOT_DIR ${STAGED_INSTALL_PREFIX})
file(TO_NATIVE_PATH "${wxWidgets_ROOT_DIR}" wxWidgets_ROOT_DIR)
set(wxWidgets_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets installation dir")
set (ENV_WX_CONFIG ${STAGED_INSTALL_PREFIX}/bin/wx-config)
file (TO_NATIVE_PATH "${ENV_WX_CONFIG}" ENV_WX_CONFIG)
set(ENV_WX_CONFIG ${ENV_WX_CONFIG} CACHE INTERNAL "wx-config dir")
endif()
The build now completes and wxWidgets is 'found' but then goes to fail because wx/wx.h isn't found
-- Found wxWidgets: -L/Users/Greeley/Workspace/Cppspace/Culinoire/build/stage/lib;-pthread;/Users/Greeley/Workspace/Cppspace/Culinoire/build/stage/lib/libwx_osx_cocoau_core-3.2.a;/Users/Greeley/Workspace/Cppspace/Culinoire/build/stage/lib/libwx_baseu-3.2.a;-lwx_baseu-3.2;-lwxjpeg-3.2;-lwxpng-3.2;-lwxtiff-3.2;-framework AudioToolbox;-framework WebKit;/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libz.tbd;-lwxregexu-3.2;/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libiconv.tbd;-framework CoreFoundation;-framework Security;-framework Carbon;-framework Cocoa;-framework IOKit;-framework QuartzCore (found version "3.2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/Build/Culinoire_core
[ 87%] Performing build step for 'Culinoire_core'
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
/Users/Greeley/Workspace/Cppspace/Culinoire/src/main.cpp:3:10: fatal error: 'wx/wxprec.h' file not found
#include <wx/wxprec.h>
^~~~~~~~~~~~~
1 error generated.
make[5]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
make[4]: *** [CMakeFiles/main.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [subprojects/Stamp/Culinoire_core/Culinoire_core-build] Error 2
make[1]: *** [CMakeFiles/Culinoire_core.dir/all] Error 2
make: *** [all] Error 2
in /src/CMakeLists.txt I added
include(${wxWidgets_USE_FILE})
and changed the project name to reflect my actual project name.
so the entire file looks like this
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
set(CMAKE_C_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c")
set(CMAKE_CXX_COMPILER "/Library/Developer/CommandLineTools/usr/bin/c++")
project(Culinoire LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(__STDC_WANT_LIB_EXT1__)
# hack for buggy CMake's FindwxWidgets script
if (DEFINED ENV_WX_CONFIG)
set (ENV{WX_CONFIG} ${ENV_WX_CONFIG})
endif()
set(wxWidgets_USE_DEBUG 1)
set(wxWidgets_USE_UNICODE 1)
set(wxWidgets_USE_UNIVERSAL 0)
set(wxWidgets_USE_STATIC 1)
#set(wxWidgets_CONFIG_OPTIONS --toolkit=base --prefix=/usr)
find_package(wxWidgets COMPONENTS core base REQUIRED)
set(SRCS main.cpp)
include(${wxWidgets_USE_FILE})
if (APPLE)
# create bundle on apple compiles
add_executable(main MACOSX_BUNDLE ${SRCS} )
# Set a custom plist file for the app bundle - needed for Mac OS Retina display
set_target_properties(main PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
else()
# the WIN32 is needed for Windows in order for it to look for WinMain
# instead of the main function. This is ignored on other systems,
# so it works on all platforms
add_executable(main WIN32 ${SRCS})
endif()
target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
and my output now is
[main] Building folder: Culinoire
[build] Starting build
[proc] Executing command: /usr/local/bin/cmake --build /Users/Greeley/Workspace/Cppspace/Culinoire/build --config Debug --target all -j 10 --
[build] [ 50%] Built target wxWidgets
[build] [ 56%] Performing build step for 'Culinoire_core'
[main] Changes were detected in CMakeLists.txt but we could not reconfigure the project because another operation is already in progress.
[build] -- Configuring done
[build] -- Generating done
[build] -- Build files have been written to: /Users/Greeley/Workspace/Cppspace/Culinoire/build/subprojects/Build/Culinoire_core
[build] [ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[build] [100%] Linking CXX executable main.app/Contents/MacOS/main
[build] [100%] Built target main
[build] [ 62%] No install step for 'Culinoire_core'
[build] [ 68%] Completed 'Culinoire_core'
[build] [100%] Built target Culinoire_core
[build] Build finished with exit code 0
[cpptools] The build configurations generated do not contain the active build configuration. Using "" for CMAKE_BUILD_TYPE instead of "Debug" to ensure that IntelliSense configurations can be found

No rule to make target src/core/librookery_core.a needed by src/exe/rookery_exe

I am still scraping the rust off of my c++ after many years of not doing this.
Here is my directory structure.
src
src/core
src/exe
This is so my unit tests don't have to fight with another main function which I've defined in src/exe.
Each of these directories has a CMakeLists.txt. (I'm building all of this using CLion.)
This is the one in src
cmake_minimum_required(VERSION 3.19)
project(${PROJECT_NAME}_src)
set(CMAKE_CXX_STANDARD 20)
include_directories(core)
add_subdirectory(core)
add_subdirectory(exe)
The one in src/core
cmake_minimum_required(VERSION 3.19)
project(rookery_core)
file(GLOB_RECURSE SOURCES LIST_DIRECTORIES true *.h *.cpp)
set(SOURCES ${SOURCES})
set(CMAKE_CXX_STANDARD 20)
add_library(${CMAKE_PROJECT_NAME}_core STATIC ${SOURCES})
and then the one in exe
cmake_minimum_required(VERSION 3.19)
project(rookery_exe)
set(CMAKE_CXX_STANDARD 20)
file(GLOB_RECURSE SOURCES LIST_DIRECTORIES true *.h *.cpp)
set(SOURCES ${SOURCES})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${CMAKE_PROJECT_NAME}_exe ${CMAKE_PROJECT_NAME}_core)
and when I run it I get
[ 35%] Building CXX object src/core/CMakeFiles/rookery_core.dir/WorkFile.cpp.o
[ 40%] Linking CXX static library librookery_core.a
[ 40%] Built target rookery_core
[ 45%] Building CXX object src/exe/CMakeFiles/rookery_exe.dir/main.cpp.o
make[2]: *** No rule to make target 'src/core/librookery_core.a', needed by 'src/exe/rookery_exe'. Stop.
make[1]: *** [CMakeFiles/Makefile2:229: src/exe/CMakeFiles/rookery_exe.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
and it just built librookery_core library. Don't know what to do next.
Thanks.
Since asked for, here is the root CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(rookery)
set(CMAKE_CXX_STANDARD 20)
include_directories(src)
add_subdirectory(src)
add_subdirectory(tst)
add_subdirectory(lib/googletest)

CLion cmake glew error?

I ma trying to setup glew for clion but for some reason everything I have tried after researching the subject seems to not work and produce errors. I have downloaded the source files from their main website http://glew.sourceforge.net/ and are located within my clion project under directory Externals. Note: there is for some reason nothing under the lib folder under glew. my assumption build be that cmake builds it then links it which would be fine but I am very new to cmake and have no idea if this is the case.
CMake compile errors
C:\Users\Matt\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\171.4073.41\bin\cmake\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Matt\CLionProjects\SkyGames
-- Could NOT find Vulkan (missing: VULKAN_INCLUDE_DIR)
-- Using Win32 for window creation
-- Could NOT find GLEW (missing: GLEW_INCLUDE_DIR GLEW_LIBRARY)
-- Configuring done
CMake Error:
Error evaluating generator expression:
$<TARGET_PDB_FILE:glew>
TARGET_PDB_FILE is not supported by the target linker.
-- Generating done
-- Build files have been written to: C:/Users/Matt/CLionProjects/SkyGames/cmake-build-debug
CMakeList for project
cmake_minimum_required(VERSION 3.7)
project(SkyGames)
set(CMAKE_CXX_STANDARD 14)
add_executable(SkyGames ${SOURCE_FILES})
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(${PROJECT_SOURCE_DIR}/Externals/GLFW3)
###########################
# GLFW
###########################
target_link_libraries(SkyGames glfw)
include_directories(SkyGames ${GLFW_INCLUDE_DIR})
###########################
# GLEW
###########################
add_subdirectory(${PROJECT_SOURCE_DIR}/Externals/glew2s/build/cmake)
find_package(glew REQUIRED)
if (GLEW_FOUND)
include_directories(SkyGames ${GLEW_INCLUDE_DIR})
endif()
##########################
# OPENGL
##########################
find_package(OpenGL REQUIRED)
target_link_libraries(SkyGames ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
include_directories(SkyGames ${OPENGL_INCLUDE_DIR})
Update:
It appears that the new version of the CMakeLists.txt works fine except when you build the program it errors saying permission denied. it is further highlighted below.
new GLEW portion of CmakeList.txt
###########################
# GLEW
###########################
set(CMAKE_PREFIX_PATH ${PROJECT_SOURCE_DIR}/Externals/glew2s/build/cmake)
set(GLEW_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/Externals/glew2s/include)
set(GLEW_LIBRARY ${PROJECT_SOURCE_DIR}/Externals/glew2s/lib)
find_package(GLEW REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/Externals/glew2s/include)
##########################
# OPENGL
##########################
find_package(OpenGL REQUIRED)
target_link_libraries(SkyGames GLEW::GLEW ${OPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
Build Message
C:\Users\Matt\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\171.4073.41\bin\cmake\bin\cmake.exe --build C:\Users\Matt\CLionProjects\SkyGames\cmake-build-debug --target SkyGames -- -j 8
[ 71%] Built target glfw
[ 76%] Linking CXX executable SkyGames.exe
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find ../Externals/glew2s/lib: Permission denied
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [SkyGames.exe] Error 1
CMakeFiles\SkyGames.dir\build.make:206: recipe for target 'SkyGames.exe' failed
mingw32-make.exe[2]: *** [CMakeFiles/SkyGames.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/SkyGames.dir/rule] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/SkyGames.dir/all' failed
mingw32-make.exe: *** [SkyGames] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/SkyGames.dir/rule' failed
Makefile:161: recipe for target 'SkyGames' failed