From 38555e32cb955bad8f23aa7e69be3875c4694a53 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Thu, 17 Mar 2022 22:56:34 +0100 Subject: [PATCH 01/13] include missing GNUInstallDirs add symlink to Index.cmake to enable use with CPM.cmake module too --- test/CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e0342fc1..1581b217 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,6 +11,9 @@ set(CMAKE_CXX_STANDARD 20) # include(${_project_options_SOURCE_DIR}/Index.cmake) include(../src/Index.cmake) +### to get CMAKE_INSTALL_INCLUDEDIR +include(GNUInstallDirs) + run_vcpkg() project( @@ -77,9 +80,9 @@ add_test(NAME main COMMAND main) # Header-only library add_library(lib INTERFACE) -set(lib_INCLUDE_DIR "include") -target_include_directories(lib INTERFACE "$" - "$") # TODO(refactor) +set(INCLUDE_DIR "include") +target_include_directories(lib INTERFACE "$" + "$") # TODO(refactor) target_link_libraries(lib INTERFACE project_options project_warnings) target_link_system_libraries( lib @@ -89,10 +92,10 @@ target_link_system_libraries( # Library add_library(lib2 "./src/mylib2/lib.cpp") -set(lib2_INCLUDE_DIR2 "include") -target_include_directories(lib2 PUBLIC "$" - "$") # TODO(refactor) -target_link_libraries(lib2 PRIVATE project_options project_warnings) +set(INCLUDE_DIR2 "include") +target_include_directories(lib2 INTERFACE "$" + "$") # TODO(refactor) +target_link_libraries(lib2 INTERFACE project_options project_warnings) target_link_system_libraries( lib2 PRIVATE From 766ca046cfdbf602ff41495da263a9adb9b0554e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 20 Mar 2022 15:31:53 +0100 Subject: [PATCH 02/13] only to show the problem! header only libs should not depend on private project_options --- Taskfile.yml | 25 +++++++++++++++---------- test/CMakeLists.txt | 12 ++++++------ test_install/CMakeLists.txt | 10 ++++++---- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 22cc9667..9388f36b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -12,10 +12,15 @@ tasks: - cmake --build ./test/build --config Release - cd ./test/build && ctest -C Release --verbose - test_install: + install_release: cmds: - task: test_release - cmake --install ./test/build --config Release --prefix ./install + - task: clean + + test_install: + cmds: + - task: install_release - cmake ./test_install -B ./test_install/build -DCMAKE_BUILD_TYPE:STRING=Release -G '{{.CMAKE_GENERATOR | default "Ninja Multi-Config"}}' -DCMAKE_PREFIX_PATH:STRING={{.CWD}}/install; - cmake --build ./test_install/build --config Release - cd ./test_install/build && ctest -C Release --verbose @@ -25,13 +30,13 @@ tasks: lint: - | - {{if eq OS "windows"}} - powershell -c '$files=(git ls-files --exclude-standard); foreach ($file in $files) { if ((get-item $file).Extension -in ".cpp", ".hpp", ".c", ".cc", ".cxx", ".hxx", ".ixx") { clang-format -i -style=file $file } }' - {{else}} - git ls-files --exclude-standard | grep -E '\.(cpp|hpp|c|cc|cxx|hxx|ixx)$' | xargs clang-format -i -style=file + {{if eq OS "windows"}} + powershell -c '$files=(git ls-files --exclude-standard); foreach ($file in $files) { if ((get-item $file).Extension -in ".cpp", ".hpp", ".c", ".cc", ".cxx", ".hxx", ".ixx") { clang-format -i -style=file $file } }' + {{else}} + git ls-files --exclude-standard | grep -E '\.(cpp|hpp|c|cc|cxx|hxx|ixx)$' | xargs clang-format -i -style=file {{end}} - | - {{if eq OS "windows"}} + {{if eq OS "windows"}} powershell -c '$files=(git ls-files --exclude-standard); foreach ($file in $files) { $item=(get-item $file); if (($item.Name -eq "CMakeLists.txt") -or ($item.Extension -in ".cmake")) { cmake-format --in-place $file; cmake-lint $file --disabled-codes C0103 C0301 R0912 R0915 R0913 --suppress-decorations } }' {{else}} git ls-files --exclude-standard | grep -E '(CMakeLists\.txt)|(\.(cmake))$' | xargs cmake-format --in-place | xargs cmake-lint --disabled-codes C0103 C0301 R0912 R0915 R0913 --suppress-decorations @@ -41,8 +46,8 @@ tasks: - npx -y cspell lint --no-progress --show-suggestions clean: | - {{if eq OS "windows"}} - powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build/; rmrf ./install' - {{else}} - rm -rf ./test/build ./test_install/build/ ./install + {{if eq OS "windows"}} + powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build/ + {{else}} + rm -rf ./test/build ./test_install/build/ {{end}} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1581b217..5ab45e2f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...3.21) +cmake_minimum_required(VERSION 3.16...3.22) # set a default CXX standard used by the external tools like clang-tidy, cppcheck, etc. # You can later set fine-grained standards for each target using `target_compile_features` @@ -39,7 +39,7 @@ project_options( ENABLE_CLANG_TIDY # ENABLE_INCLUDE_WHAT_YOU_USE ENABLE_COVERAGE - ENABLE_PCH + #XXX ENABLE_PCH PCH_HEADERS ${PCH_HEADERS} ENABLE_DOXYGEN @@ -93,12 +93,12 @@ target_link_system_libraries( # Library add_library(lib2 "./src/mylib2/lib.cpp") set(INCLUDE_DIR2 "include") -target_include_directories(lib2 INTERFACE "$" - "$") # TODO(refactor) -target_link_libraries(lib2 INTERFACE project_options project_warnings) +target_include_directories(lib2 PUBLIC "$" + "$") # TODO(refactor) +target_link_libraries(lib2 PRIVATE project_options project_warnings) target_link_system_libraries( lib2 - PRIVATE + PUBLIC fmt::fmt Eigen3::Eigen) diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index cad2b825..a7577339 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...3.21) +cmake_minimum_required(VERSION 3.16...3.22) ### Add project_options include(../src/Index.cmake) @@ -38,16 +38,18 @@ project_options( # add src, tests, etc here: add_executable(another_main "./src/another_main.cpp") -target_link_libraries(another_main PRIVATE project_options project_warnings) +#XXX target_link_libraries(another_main PRIVATE project_options project_warnings) ## dependencies -set(DEPENDENCIES_CONFIGURED myproj) +#XXX set(DEPENDENCIES_CONFIGURED myproj) +set(DEPENDENCIES_CONFIGURED myproj_header_only_lib) foreach(DEPENDENCY ${DEPENDENCIES_CONFIGURED}) find_package(${DEPENDENCY} CONFIG REQUIRED) endforeach() -target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) +#XXX target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) +target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib) # tests enable_testing() From af6b9d24784fa70e0dfbe61e6661c2ac3a6645c6 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 20 Mar 2022 18:19:11 +0100 Subject: [PATCH 03/13] show how it would work everytime --- test/CMakeLists.txt | 6 +++--- test_install/CMakeLists.txt | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5ab45e2f..357396ad 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,7 +19,7 @@ run_vcpkg() project( myproj VERSION 0.2.0 - LANGUAGES CXX C) + LANGUAGES CXX) set(PCH_HEADERS @@ -39,7 +39,7 @@ project_options( ENABLE_CLANG_TIDY # ENABLE_INCLUDE_WHAT_YOU_USE ENABLE_COVERAGE - #XXX ENABLE_PCH + # TBD: ENABLE_PCH PCH_HEADERS ${PCH_HEADERS} ENABLE_DOXYGEN @@ -83,7 +83,7 @@ add_library(lib INTERFACE) set(INCLUDE_DIR "include") target_include_directories(lib INTERFACE "$" "$") # TODO(refactor) -target_link_libraries(lib INTERFACE project_options project_warnings) +# TODO(CK): NO! target_link_libraries(lib INTERFACE project_options project_warnings) target_link_system_libraries( lib INTERFACE diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index a7577339..83620c2a 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -7,8 +7,8 @@ run_vcpkg() project( anotherproj - VERSION 0.1.0 - LANGUAGES CXX C) + VERSION 0.2.0 + LANGUAGES CXX) # Initialize project_options project_options( @@ -42,14 +42,14 @@ add_executable(another_main "./src/another_main.cpp") ## dependencies #XXX set(DEPENDENCIES_CONFIGURED myproj) -set(DEPENDENCIES_CONFIGURED myproj_header_only_lib) +set(DEPENDENCIES_CONFIGURED myproj_header_only_lib myproj) foreach(DEPENDENCY ${DEPENDENCIES_CONFIGURED}) find_package(${DEPENDENCY} CONFIG REQUIRED) endforeach() #XXX target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) -target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib) +target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib myproj::lib2) # tests enable_testing() From fc89cf65343ef4b9ea0fe0c7d4bc88ca61902c72 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 20 Mar 2022 20:32:09 +0100 Subject: [PATCH 04/13] setup C compiler again no idea why needed? --- Taskfile.yml | 4 ++-- test/CMakeLists.txt | 9 ++++----- test_install/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 9388f36b..ca794014 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -47,7 +47,7 @@ tasks: clean: | {{if eq OS "windows"}} - powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build/ + powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build {{else}} - rm -rf ./test/build ./test_install/build/ + rm -rf ./test/build ./test_install/build {{end}} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 357396ad..9592829b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,7 +19,7 @@ run_vcpkg() project( myproj VERSION 0.2.0 - LANGUAGES CXX) + LANGUAGES CXX C) set(PCH_HEADERS @@ -38,10 +38,9 @@ project_options( ENABLE_CPPCHECK ENABLE_CLANG_TIDY # ENABLE_INCLUDE_WHAT_YOU_USE - ENABLE_COVERAGE + # TODO(CK: should not installed with this option!) ENABLE_COVERAGE # TBD: ENABLE_PCH - PCH_HEADERS - ${PCH_HEADERS} + # TBD: PCH_HEADERS ${PCH_HEADERS} ENABLE_DOXYGEN ENABLE_INTERPROCEDURAL_OPTIMIZATION ENABLE_NATIVE_OPTIMIZATION @@ -83,7 +82,7 @@ add_library(lib INTERFACE) set(INCLUDE_DIR "include") target_include_directories(lib INTERFACE "$" "$") # TODO(refactor) -# TODO(CK): NO! target_link_libraries(lib INTERFACE project_options project_warnings) +# FIXME(CK: Not for INTERFACE libs!) target_link_libraries(lib INTERFACE project_options project_warnings) target_link_system_libraries( lib INTERFACE diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index 83620c2a..e5b9a93e 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.16...3.22) +set(CMAKE_CXX_STANDARD 20) + ### Add project_options include(../src/Index.cmake) @@ -8,7 +10,7 @@ run_vcpkg() project( anotherproj VERSION 0.2.0 - LANGUAGES CXX) + LANGUAGES CXX C) # Initialize project_options project_options( From cb6a36a8d198ffb9d0f75caa227c484aea89ee6f Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 20 Mar 2022 20:50:32 +0100 Subject: [PATCH 05/13] conan is needed to install dependent docopt lib --- test_install/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index e5b9a93e..8d4b4445 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -44,14 +44,14 @@ add_executable(another_main "./src/another_main.cpp") ## dependencies #XXX set(DEPENDENCIES_CONFIGURED myproj) -set(DEPENDENCIES_CONFIGURED myproj_header_only_lib myproj) +set(DEPENDENCIES_CONFIGURED myproj_header_only_lib) foreach(DEPENDENCY ${DEPENDENCIES_CONFIGURED}) find_package(${DEPENDENCY} CONFIG REQUIRED) endforeach() #XXX target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) -target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib myproj::lib2) +target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib) # tests enable_testing() From 5ee1b4bee113703855835bf3dd021ca5b4b6535e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 20 Mar 2022 21:32:27 +0100 Subject: [PATCH 06/13] fix type in powershell script --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index ca794014..5a46e0af 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -47,7 +47,7 @@ tasks: clean: | {{if eq OS "windows"}} - powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build + powershell -c 'function rmrf($path) { if (test-path $path) { rm -r -force $path }}; rmrf ./test/build; rmrf ./test_install/build' {{else}} rm -rf ./test/build ./test_install/build {{end}} From 7a2735a66298e73ab688c59009a376dc09d2b823 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 21 Mar 2022 08:29:30 +0100 Subject: [PATCH 07/13] fix install header files after rebase main --- test/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9592829b..81de24a4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -113,9 +113,9 @@ package_project( INTERFACE_DEPENDENCIES_CONFIGURED ${DEPENDENCIES_CONFIGURED} INTERFACE_INCLUDES - ${lib_INCLUDE_DIR2} + ${INCLUDE_DIR2} PUBLIC_INCLUDES - ${lib2_INCLUDE_DIR2}) + ${INCLUDE_DIR2}) # package separately (for testing) package_project( @@ -128,7 +128,7 @@ package_project( INTERFACE_DEPENDENCIES_CONFIGURED ${DEPENDENCIES_CONFIGURED} INTERFACE_INCLUDES - ${lib_INCLUDE_DIR}) + ${INCLUDE_DIR}) package_project( NAME @@ -138,7 +138,7 @@ package_project( project_options project_warnings PUBLIC_INCLUDES - ${lib2_INCLUDE_DIR22}) + ${INCLUDE_DIR2}) package_project( NAME From e8138db6529307add6a6df27785d6ad40ed98c2e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 21 Mar 2022 09:25:42 +0100 Subject: [PATCH 08/13] use new cmake var name for include dir after merge --- test/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 81de24a4..1a16a768 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -79,8 +79,8 @@ add_test(NAME main COMMAND main) # Header-only library add_library(lib INTERFACE) -set(INCLUDE_DIR "include") -target_include_directories(lib INTERFACE "$" +set(lib_INCLUDE_DIR "include") +target_include_directories(lib INTERFACE "$" "$") # TODO(refactor) # FIXME(CK: Not for INTERFACE libs!) target_link_libraries(lib INTERFACE project_options project_warnings) target_link_system_libraries( @@ -91,8 +91,8 @@ target_link_system_libraries( # Library add_library(lib2 "./src/mylib2/lib.cpp") -set(INCLUDE_DIR2 "include") -target_include_directories(lib2 PUBLIC "$" +set(lib2_INCLUDE_DIR "include") +target_include_directories(lib2 PUBLIC "$" "$") # TODO(refactor) target_link_libraries(lib2 PRIVATE project_options project_warnings) target_link_system_libraries( @@ -113,9 +113,9 @@ package_project( INTERFACE_DEPENDENCIES_CONFIGURED ${DEPENDENCIES_CONFIGURED} INTERFACE_INCLUDES - ${INCLUDE_DIR2} + ${lib2_INCLUDE_DIR} PUBLIC_INCLUDES - ${INCLUDE_DIR2}) + ${lib2_INCLUDE_DIR}) # package separately (for testing) package_project( @@ -128,7 +128,7 @@ package_project( INTERFACE_DEPENDENCIES_CONFIGURED ${DEPENDENCIES_CONFIGURED} INTERFACE_INCLUDES - ${INCLUDE_DIR}) + ${lib_INCLUDE_DIR}) package_project( NAME @@ -138,7 +138,7 @@ package_project( project_options project_warnings PUBLIC_INCLUDES - ${INCLUDE_DIR2}) + ${lib2_INCLUDE_DIR}) package_project( NAME From bd43a45514acdbdbee084d54be71704918886a48 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 21 Mar 2022 20:51:15 +0100 Subject: [PATCH 09/13] last try, export build_options again --- test/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a16a768..0a95aa9b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -82,7 +82,8 @@ add_library(lib INTERFACE) set(lib_INCLUDE_DIR "include") target_include_directories(lib INTERFACE "$" "$") # TODO(refactor) -# FIXME(CK: Not for INTERFACE libs!) target_link_libraries(lib INTERFACE project_options project_warnings) +# FIXME(CK: This should not done for INTERFACE libs!) +target_link_libraries(lib INTERFACE project_options project_warnings) target_link_system_libraries( lib INTERFACE From 8c08e9f52bea7461844a149aa63a526cf77bb16e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 22 Mar 2022 07:18:09 +0100 Subject: [PATCH 10/13] include(GNUInstallDirs) has to be after project() ENABLE_INTERPROCEDURAL_OPTIMIZATION must be set in all compilation untis! --- test/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0a95aa9b..71cfbb08 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,9 +11,6 @@ set(CMAKE_CXX_STANDARD 20) # include(${_project_options_SOURCE_DIR}/Index.cmake) include(../src/Index.cmake) -### to get CMAKE_INSTALL_INCLUDEDIR -include(GNUInstallDirs) - run_vcpkg() project( @@ -77,6 +74,10 @@ target_link_system_libraries( enable_testing() add_test(NAME main COMMAND main) +### to get CMAKE_INSTALL_INCLUDEDIR +# NOTE: enable at least one language before including GNUInstallDirs. +include(GNUInstallDirs) + # Header-only library add_library(lib INTERFACE) set(lib_INCLUDE_DIR "include") From b4b8b44f53b6bb1bb5d708ced0a83104c573582c Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 22 Mar 2022 08:54:18 +0100 Subject: [PATCH 11/13] test_install can not use the header only interface! --- test_install/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index 8d4b4445..0d4220e6 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -43,15 +43,15 @@ add_executable(another_main "./src/another_main.cpp") #XXX target_link_libraries(another_main PRIVATE project_options project_warnings) ## dependencies -#XXX set(DEPENDENCIES_CONFIGURED myproj) -set(DEPENDENCIES_CONFIGURED myproj_header_only_lib) +set(DEPENDENCIES_CONFIGURED myproj) +#TODO(CK) set(DEPENDENCIES_CONFIGURED myproj_header_only_lib myproj) foreach(DEPENDENCY ${DEPENDENCIES_CONFIGURED}) find_package(${DEPENDENCY} CONFIG REQUIRED) endforeach() -#XXX target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) -target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib) +target_link_libraries(another_main PRIVATE myproj::lib myproj::lib2) +#TODO(CK) target_link_libraries(another_main PRIVATE myproj_header_only_lib::lib myproj::lib2) # tests enable_testing() From 95aefb0661602d679a3e83607209e841586eda0a Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 23 Mar 2022 20:09:14 +0100 Subject: [PATCH 12/13] test without OPTIMIZATION options set --- test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 71cfbb08..64676004 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,8 +39,8 @@ project_options( # TBD: ENABLE_PCH # TBD: PCH_HEADERS ${PCH_HEADERS} ENABLE_DOXYGEN - ENABLE_INTERPROCEDURAL_OPTIMIZATION - ENABLE_NATIVE_OPTIMIZATION + # ENABLE_INTERPROCEDURAL_OPTIMIZATION + # ENABLE_NATIVE_OPTIMIZATION # ENABLE_USER_LINKER # ENABLE_BUILD_WITH_TIME_TRACE # ENABLE_UNITY From 9662284d91b4887ed6bdcb31bd0335cec0af9e34 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 7 May 2022 21:40:05 +0200 Subject: [PATCH 13/13] prevent long build time on OSX disable doxygen rebased with master tested with cmake 3.23 on OSX --- test/CMakeLists.txt | 11 ++++++----- test_install/CMakeLists.txt | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 64676004..3aff16f7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...3.22) +cmake_minimum_required(VERSION 3.16...3.23) # set a default CXX standard used by the external tools like clang-tidy, cppcheck, etc. # You can later set fine-grained standards for each target using `target_compile_features` @@ -38,7 +38,7 @@ project_options( # TODO(CK: should not installed with this option!) ENABLE_COVERAGE # TBD: ENABLE_PCH # TBD: PCH_HEADERS ${PCH_HEADERS} - ENABLE_DOXYGEN + # NO(CK)! To slow! ENABLE_DOXYGEN # ENABLE_INTERPROCEDURAL_OPTIMIZATION # ENABLE_NATIVE_OPTIMIZATION # ENABLE_USER_LINKER @@ -74,9 +74,10 @@ target_link_system_libraries( enable_testing() add_test(NAME main COMMAND main) -### to get CMAKE_INSTALL_INCLUDEDIR -# NOTE: enable at least one language before including GNUInstallDirs. -include(GNUInstallDirs) +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + # NOTE: enable at least one language before including GNUInstallDirs. + include(GNUInstallDirs) +endif() # Header-only library add_library(lib INTERFACE) diff --git a/test_install/CMakeLists.txt b/test_install/CMakeLists.txt index 0d4220e6..40bf9ec0 100644 --- a/test_install/CMakeLists.txt +++ b/test_install/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16...3.22) +cmake_minimum_required(VERSION 3.16...3.23) set(CMAKE_CXX_STANDARD 20) @@ -23,11 +23,11 @@ project_options( # ENABLE_COVERAGE # ENABLE_PCH # PCH_HEADERS - ENABLE_DOXYGEN + # XXX ENABLE_DOXYGEN DOXYGEN_THEME "${CMAKE_CURRENT_LIST_DIR}/css/my_custom_theme.css" "${CMAKE_CURRENT_LIST_DIR}/css/my_custom_theme_extra.css" - ENABLE_INTERPROCEDURAL_OPTIMIZATION + # ENABLE_INTERPROCEDURAL_OPTIMIZATION # ENABLE_USER_LINKER # ENABLE_BUILD_WITH_TIME_TRACE # ENABLE_UNITY