From e373b62899729a74c900657b0b2ec66ac66b2fd1 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 16 Oct 2023 17:14:05 +0800 Subject: [PATCH] Win:OK! Make Catch2 always static. Remove Cairo test on win. --- CMakeLists.txt | 8 +++++++- demos/Graphics/DrawCircle/CMakeLists.txt | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 086e5048..2ab11e9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,18 +8,24 @@ if (EMSCRIPTEN) set(CRU_DEFAULT_BUILD_SHARED_LIBS OFF) endif() -option(BUILD_SHARED_LIBS "Try to build shared libraries as default" ${CRU_DEFAULT_BUILD_SHARED_LIBS}) +option(CRU_BUILD_SHARED_LIBS "Try to build shared libraries as default" ${CRU_DEFAULT_BUILD_SHARED_LIBS}) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) +set(BUILD_SHARED_LIBS ${CRU_BUILD_SHARED_LIBS}) + project(cru) if (APPLE) include_directories(BEFORE SYSTEM "/usr/local/include") endif() +# Catch2 must be compiled as static library +set(BUILD_SHARED_LIBS OFF) add_subdirectory(lib/Catch2) +set(BUILD_SHARED_LIBS ${CRU_BUILD_SHARED_LIBS}) + add_subdirectory(lib/double-conversion) add_subdirectory(lib/GSL) diff --git a/demos/Graphics/DrawCircle/CMakeLists.txt b/demos/Graphics/DrawCircle/CMakeLists.txt index da6611ef..51531d4c 100644 --- a/demos/Graphics/DrawCircle/CMakeLists.txt +++ b/demos/Graphics/DrawCircle/CMakeLists.txt @@ -1,5 +1,7 @@ add_executable(CruDemoGraphicsDrawCircle DrawCircle.cpp PlatformMain.cpp) -add_executable(CruDemoGraphicsDrawCircleCairo DrawCircle.cpp CairoMain.cpp) - target_link_libraries(CruDemoGraphicsDrawCircle PRIVATE CruDemoBase) -target_link_libraries(CruDemoGraphicsDrawCircleCairo PRIVATE CruDemoBase CruPlatformGraphicsCairo) + +if(TARGET CruPlatformGraphicsCairo) + add_executable(CruDemoGraphicsDrawCircleCairo DrawCircle.cpp CairoMain.cpp) + target_link_libraries(CruDemoGraphicsDrawCircleCairo PRIVATE CruDemoBase CruPlatformGraphicsCairo) +endif()