diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e19f03..59be03b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.21...3.27) # This template attempts to be "fetch_content"-able # so that it works well with tools like CPM or other diff --git a/CMakePresets.json b/CMakePresets.json index 5871489e..9f16e253 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -50,6 +50,9 @@ "Darwin" ] }, + "cacheVariables": { + "CMAKE_UNITY_BUILD": true + }, "vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" @@ -142,6 +145,8 @@ "description": "Target Unix-like OS with the gcc compiler, debug build type", "inherits": "conf-unixlike-common", "cacheVariables": { + "myproject_ENABLE_COVERAGE": false, + "CMAKE_SKIP_INSTALL_RULES": true, "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", "CMAKE_BUILD_TYPE": "Debug" @@ -164,6 +169,8 @@ "description": "Target Unix-like OS with the clang compiler, debug build type", "inherits": "conf-unixlike-common", "cacheVariables": { + "myproject_ENABLE_COVERAGE": false, + "CMAKE_SKIP_INSTALL_RULES": true, "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", "CMAKE_BUILD_TYPE": "Debug" @@ -251,4 +258,4 @@ "configurePreset": "unixlike-clang-release" } ] -} \ No newline at end of file +} diff --git a/ProjectOptions.cmake b/ProjectOptions.cmake index 2709aa1a..ae3a5453 100644 --- a/ProjectOptions.cmake +++ b/ProjectOptions.cmake @@ -53,9 +53,9 @@ macro(myproject_setup_options) option(myproject_ENABLE_SANITIZER_UNDEFINED "Enable undefined sanitizer" ${SUPPORTS_UBSAN}) option(myproject_ENABLE_SANITIZER_THREAD "Enable thread sanitizer" OFF) option(myproject_ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" OFF) - option(myproject_ENABLE_UNITY_BUILD "Enable unity builds" OFF) - option(myproject_ENABLE_CLANG_TIDY "Enable clang-tidy" ON) - option(myproject_ENABLE_CPPCHECK "Enable cpp-check analysis" ON) + option(myproject_ENABLE_UNITY_BUILD "Enable unity builds" ON) + option(myproject_ENABLE_CLANG_TIDY "Enable clang-tidy" OFF) + option(myproject_ENABLE_CPPCHECK "Enable cpp-check analysis" OFF) option(myproject_ENABLE_PCH "Enable precompiled headers" OFF) option(myproject_ENABLE_CACHE "Enable ccache" ON) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f92a9d6..e35378d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,2 +1,4 @@ add_subdirectory(sample_library) -add_subdirectory(ftxui_sample) +if(NOT CMAKE_UNITY_BUILD) + add_subdirectory(ftxui_sample) +endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0739f424..4ca63e64 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...3.23) +cmake_minimum_required(VERSION 3.21...3.27) project(CmakeConfigPackageTests LANGUAGES CXX) @@ -19,15 +19,17 @@ endif() include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) -# Provide a simple smoke test to make sure that the CLI works and can display a --help message -add_test(NAME cli.has_help COMMAND intro --help) +if(TARGET intro) + # Provide a simple smoke test to make sure that the CLI works and can display a --help message + add_test(NAME cli.has_help COMMAND intro --help) -# Provide a test to verify that the version being reported from the application -# matches the version given to CMake. This will be important once you package -# your program. Real world shows that this is the kind of simple mistake that is easy -# to make, but also easy to test for. -add_test(NAME cli.version_matches COMMAND intro --version) -set_tests_properties(cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION}") + # Provide a test to verify that the version being reported from the application + # matches the version given to CMake. This will be important once you package + # your program. Real world shows that this is the kind of simple mistake that is easy + # to make, but also easy to test for. + add_test(NAME cli.version_matches COMMAND intro --version) + set_tests_properties(cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION}") +endif() add_executable(tests tests.cpp) target_link_libraries(