From b03251ce252e41d7447c0a2bbf6438ea9051c098 Mon Sep 17 00:00:00 2001 From: Chris-plusplus <72704303+Chris-plusplus@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:06:37 +0100 Subject: [PATCH] Fixed debug/release includes by including specific conan toolchain --- .gitignore | 1 + CMakeLists.txt | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 6b44afa..11604b1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,5 @@ Testing/ CMakeUserPresets.json compile_commands.json conan_files/ +conan_files_debug/ CMakeSettings.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 5916e93..1977b0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,28 @@ project( ) set(CMAKE_CXX_STANDARD 20) -if (MSVC) - add_compile_options("/Zc:__cplusplus") - include("conan_files/conan_toolchain.cmake") # idk, but works xd - list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR}/conan_files) +if (WIN32) + if (MSVC) + add_compile_options("/Zc:__cplusplus") + endif (MSVC) + + if ( + "${CMAKE_CONFIGURATION_TYPES}" STREQUAL Debug + OR "${CMAKE_BUILD_TYPE}" STREQUAL Debug + OR "${CMAKE_CONFIGURATION_TYPES}" STREQUAL "RelWithDebInfo" + OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" + ) + message(STATUS "Debug Mode") + include("conan_files_debug/conan_toolchain.cmake") # idk, but works xd + list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR}/conan_files_debug) + else () + message(STATUS "Release Mode") + include("conan_files/conan_toolchain.cmake") # idk, but works xd + list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR}/conan_files) + endif () + include_directories(${CMAKE_INCLUDE_PATH}) -endif (MSVC) +endif (WIN32) set(CMAKE_EXPORT_COMPILE_COMMANDS 1) add_library(${PROJECT_NAME}) @@ -26,8 +42,10 @@ find_package(assimp CONFIG REQUIRED) find_package(glm CONFIG REQUIRED) find_package(spdlog CONFIG REQUIRED) find_package(glfw3 3.3 CONFIG REQUIRED) -target_include_directories(${PROJECT_NAME} PUBLIC include ${glad_INCLUDE_DIR} ${assimp_INCLUDE_DIR} - ${GTest_INCLUDE_DIR} ${glm_INCLUDE_DIR} ${glfw3_INCLUDE_DIR} ${spdlog_INCLUDE_DIR}) +target_include_directories(${PROJECT_NAME} PUBLIC include) +if (NOT WIN32) + target_include_directories(${PROJECT_NAME} PUBLIC ${glad_INCLUDE_DIR} ${assimp_INCLUDE_DIR} ${GTest_INCLUDE_DIR} ${glm_INCLUDE_DIR} ${glfw3_INCLUDE_DIR} ${spdlog_INCLUDE_DIR}) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE glfw fmt::fmt glad::glad assimp::assimp spdlog::spdlog stb::stb) enable_testing()