diff --git a/.cmake-format b/.cmake-format index 3663ecc..46e0624 100644 --- a/.cmake-format +++ b/.cmake-format @@ -1,77 +1,123 @@ -format: - tab_size: 2 - line_width: 100 - dangle_parens: true - -markup: - enable_markup: false - parse: additional_commands: cpmaddpackage: - pargs: - nargs: '*' - flags: [] - spelling: CPMAddPackage - kwargs: &cpmaddpackagekwargs - NAME: 1 - FORCE: 1 - VERSION: 1 - GIT_TAG: 1 + kwargs: + DOWNLOAD_COMMAND: 1 + DOWNLOAD_NAME: 1 + DOWNLOAD_NO_EXTRACT: 1 DOWNLOAD_ONLY: 1 + FIND_PACKAGE_ARGUMENTS: 1 + FORCE: 1 GITHUB_REPOSITORY: 1 GITLAB_REPOSITORY: 1 GIT_REPOSITORY: 1 + GIT_SHALLOW: 1 + GIT_TAG: 1 + HTTP_PASSWORD: 1 + HTTP_USERNAME: 1 + NAME: 1 + NO_CACHE: 1 + OPTIONS: + + SOURCE_DIR: 1 SVN_REPOSITORY: 1 SVN_REVISION: 1 - SOURCE_DIR: 1 + URL: 1 + URL_HASH: 1 + URL_MD5: 1 + VERSION: 1 + pargs: + flags: [] + nargs: '*' + spelling: CPMAddPackage + cpmdeclarepackage: + kwargs: DOWNLOAD_COMMAND: 1 + DOWNLOAD_NAME: 1 + DOWNLOAD_NO_EXTRACT: 1 + DOWNLOAD_ONLY: 1 FIND_PACKAGE_ARGUMENTS: 1 - NO_CACHE: 1 + FORCE: 1 + GITHUB_REPOSITORY: 1 + GITLAB_REPOSITORY: 1 + GIT_REPOSITORY: 1 GIT_SHALLOW: 1 + GIT_TAG: 1 + HTTP_PASSWORD: 1 + HTTP_USERNAME: 1 + NAME: 1 + NO_CACHE: 1 + OPTIONS: + + SOURCE_DIR: 1 + SVN_REPOSITORY: 1 + SVN_REVISION: 1 URL: 1 URL_HASH: 1 URL_MD5: 1 + VERSION: 1 + pargs: + flags: [] + nargs: '*' + spelling: CPMDeclarePackage + cpmfindpackage: + kwargs: + DOWNLOAD_COMMAND: 1 DOWNLOAD_NAME: 1 DOWNLOAD_NO_EXTRACT: 1 - HTTP_USERNAME: 1 + DOWNLOAD_ONLY: 1 + FIND_PACKAGE_ARGUMENTS: 1 + FORCE: 1 + GITHUB_REPOSITORY: 1 + GITLAB_REPOSITORY: 1 + GIT_REPOSITORY: 1 + GIT_SHALLOW: 1 + GIT_TAG: 1 HTTP_PASSWORD: 1 + HTTP_USERNAME: 1 + NAME: 1 + NO_CACHE: 1 OPTIONS: + - cpmfindpackage: + SOURCE_DIR: 1 + SVN_REPOSITORY: 1 + SVN_REVISION: 1 + URL: 1 + URL_HASH: 1 + URL_MD5: 1 + VERSION: 1 pargs: - nargs: '*' flags: [] - spelling: CPMFindPackage - kwargs: *cpmaddpackagekwargs - cpmdeclarepackage: - pargs: nargs: '*' - flags: [] - spelling: CPMDeclarePackage - kwargs: *cpmaddpackagekwargs + spelling: CPMFindPackage + cpmgetpackageversion: + pargs: 2 + spelling: CPMGetPackageVersion + cpmregisterpackage: + pargs: 1 + spelling: CPMRegisterPackage + cpmusepackagelock: + pargs: 1 + spelling: CPMUsePackageLock packageproject: - pargs: - nargs: '*' - flags: [] - spelling: packageProject kwargs: - NAME: 1 - VERSION: 1 - NAMESPACE: 1 - INCLUDE_DIR: 1 - INCLUDE_DESTINATION: 1 BINARY_DIR: 1 COMPATIBILITY: 1 - VERSION_HEADER: 1 - EXPORT_HEADER: 1 - DISABLE_VERSION_SUFFIX: 1 DEPENDENCIES: + - cpmusepackagelock: - pargs: 1 - spelling: CPMUsePackageLock - cpmregisterpackage: - pargs: 1 - spelling: CPMRegisterPackage - cpmgetpackageversion: - pargs: 2 - spelling: CPMGetPackageVersion + DISABLE_VERSION_SUFFIX: 1 + DISABLE_CHECK_REQUIRED_COMPONENTS: 1 + EXPORT_HEADER: 1 + INCLUDE_DESTINATION: 1 + INCLUDE_DIR: 1 + NAME: 1 + NAMESPACE: 1 + VERSION: 1 + VERSION_HEADER: 1 + pargs: + flags: [] + nargs: '*' + spelling: packageProject +format: + line_width: 100 + tab_size: 2 + dangle_parens: true + +markup: + enable_markup: false diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 8a1b088..d8c9593 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -20,9 +20,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bbe6b24..af0aae3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -20,9 +20,9 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index ca2d2f1..35d12d5 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -17,9 +17,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 7e4b699..904d733 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -19,9 +19,9 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ad04e6a..700375e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,9 +21,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d8d09e3..a20424a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,15 +20,15 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: "**/cpm_modules" key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} - name: configure - run: cmake -S test -B build # XXX -G "Visual Studio 16 2019" -T ClangCL + run: cmake -S test -B build -G "Visual Studio 17 2022" -D BUILD_SHARED_LIBS=NO - name: build run: cmake --build build --config Debug -j4 diff --git a/CMakeLists.txt b/CMakeLists.txt index ee1c8ac..39d9b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,11 @@ -cmake_minimum_required(VERSION 3.14...3.20) +cmake_minimum_required(VERSION 3.21...3.25) # ---- Project ---- # Note: update this to your new project's name and version project( MathFunctions - VERSION 1.0.0 + VERSION 1.0.1 LANGUAGES CXX ) @@ -14,8 +14,7 @@ project( if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) message( FATAL_ERROR - "In-source builds not allowed. Please make a new directory (called a build directory) \ -and run CMake from there." + "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." ) endif() @@ -29,14 +28,9 @@ include(cmake/options.cmake) include(cmake/CPM.cmake) # PackageProject.cmake will be used to make our target installable -CPMAddPackage( - NAME PackageProject.cmake - GITHUB_REPOSITORY ClausKlein/PackageProject.cmake - # VERSION CK1.6.0 - GIT_TAG 4ac95860ba72bb0eb324c4d63e35fb59be3bd50d -) +CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.10.0") -set(COMPONENT_TARGETS_ENABLED NO) # Note: DO not set! CK +# NO! set(COMPONENT_TARGETS_ENABLED NO) # Note: DO not set! CK set(PROJECT_NAMESPACE ${PROJECT_NAME}) set(PROJECT_VERSION_INCLUDE_DIR ${PROJECT_BINARY_DIR}/PackageProjectInclude) include_directories(${PROJECT_VERSION_INCLUDE_DIR}) @@ -44,7 +38,7 @@ include_directories(${PROJECT_VERSION_INCLUDE_DIR}) set(NAMESPACE_HEADER_LOCATION ${CMAKE_CURRENT_LIST_DIR}/include) set(INCLUDE_INSTALL_DIR include/${PROJECT_NAMESPACE}-${PROJECT_VERSION}) # XXX VERSION_SUFFIX string(TOLOWER ${PROJECT_NAMESPACE} PROJECT_HEADER_LOCATION) -# TODO: needed to be lower case? CK +# TODO: why needed to be lower case? CK # ---- Add components libraries here ---- @@ -74,7 +68,7 @@ set_target_properties( # header paths string(TOLOWER ${PROJECT_NAMESPACE}/version.h PROJECT_VERSION_HEADER) string(TOLOWER ${PROJECT_NAMESPACE}/${PROJECT_NAMESPACE}_export.h PROJECT_EXPORT_HEADER) -# TODO: needed to be lower case? CK +# TODO: why needed to be lower case? CK # Note: This needs to be done after all install(TARGETS ...) commands! # generate and install export targets file @@ -95,14 +89,18 @@ packageProject( INCLUDE_DESTINATION ${INCLUDE_INSTALL_DIR} VERSION_HEADER ${PROJECT_VERSION_HEADER} EXPORT_HEADER ${PROJECT_EXPORT_HEADER} - COMPATIBILITY SameMajorVersion # XXX DISABLE_VERSION_SUFFIX NOT YET! CK - DISABLE_CHECK_REQUIRED_COMPONENTS YES + COMPATIBILITY SameMajorVersion + # XXX DISABLE_VERSION_SUFFIX NOT YET! CK + DISABLE_CHECK_REQUIRED_COMPONENTS YES ) -# generate the export targets for the build tree. Note: The file created by this command is specific -# to the build tree and should never be installed! -export( - EXPORT ${PROJECT_NAMESPACE}Targets - FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAMESPACE}Targets.cmake - NAMESPACE ${PROJECT_NAMESPACE}:: -) +# generate the export targets for the build tree. +# if(COMPONENT_TARGETS_ENABLED) +# # Note: The file created by this command is specific to the build tree +# # and and must be created after packageProject()! CK +# export( +# EXPORT ${PROJECT_NAMESPACE}Targets +# FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAMESPACE}Targets.cmake +# NAMESPACE ${PROJECT_NAMESPACE}:: +# ) +# endif() diff --git a/GNUmakefile b/GNUmakefile old mode 100755 new mode 100644 index 230593e..00ac576 --- a/GNUmakefile +++ b/GNUmakefile @@ -45,7 +45,7 @@ install: cmake -S . -B $(BUILD_DIR)/$@ ${CMAKE_PRESET} -DCMAKE_INSTALL_PREFIX=$(STAGE_DIR) cmake --build $(BUILD_DIR)/$@ --target $@ perl -i.bak -p -e 's#-W[-\w]+\b##g;' -e 's#-I($$CPM_SOURCE_CACHE)#-isystem $$1#g;' $(BUILD_DIR)/$@/compile_commands.json - run-clang-tidy.py -p $(BUILD_DIR)/$@ -quiet -header-filter='$(CURDIR)/.*' source # Note: only local sources! CK + run-clang-tidy -p $(BUILD_DIR)/$@ -quiet -header-filter='$(CURDIR)/.*' source # Note: only local sources! CK # test the library test: install @@ -54,7 +54,7 @@ test: install perl -i.bak -p -e 's#-W[-\w]+\b##g;' -e 's#-I($$CPM_SOURCE_CACHE)#-isystem $$1#g;' $(BUILD_DIR)/$@/compile_commands.json cmake --build $(BUILD_DIR)/$@ cmake --build $(BUILD_DIR)/$@ --target $@ - run-clang-tidy.py -p $(BUILD_DIR)/$@ -quiet -header-filter='$(CURDIR)/.*' test/source # Note: only local sources! CK + run-clang-tidy -p $(BUILD_DIR)/$@ -quiet -header-filter='$(CURDIR)/.*' test/source # Note: only local sources! CK # all together all: @@ -65,10 +65,11 @@ all: gcovr --root . #XXX --verbose tidy: all - run-clang-tidy.py -p $(BUILD_DIR)/all -quiet -header-filter='$(CURDIR)/.*' $(CURDIR) # Note: only local sources! CK + run-clang-tidy -p $(BUILD_DIR)/all -quiet -header-filter='$(CURDIR)/.*' $(CURDIR) # Note: only local sources! CK gcov: all - gcovr -r . --html-title $(PROJECT_NAME) --html-detail $(CURDIR)/reports/gcov/index.html + mkdir -p reports + gcovr -r . --html-title $(PROJECT_NAME) --html-details $(CURDIR)/reports/gcov/index.html perl -i.bak -pe 's#class="headerValue">./<#class="headerValue">$(PROJECT_NAME)<#g;' $(CURDIR)/reports/gcov/*.html # GenerateDocs @@ -89,5 +90,5 @@ standalone: # modernize the library sources modernize: standalone - run-clang-tidy.py -p $(BUILD_DIR)/standalone -quiet -header-filter='$(CURDIR)/.*' \ + run-clang-tidy -p $(BUILD_DIR)/standalone -quiet -header-filter='$(CURDIR)/.*' \ -checks='-*,modernize-*' -j1 -fix $(CURDIR) # Note: only local sources! CK diff --git a/all/CMakeLists.txt b/all/CMakeLists.txt index c57b5bf..546c387 100644 --- a/all/CMakeLists.txt +++ b/all/CMakeLists.txt @@ -1,7 +1,7 @@ # this script adds all subprojects to a single build to allow IDEs understand the full project # structure. -cmake_minimum_required(VERSION 3.14...3.20) +cmake_minimum_required(VERSION 3.21...3.25) project(BuildAll LANGUAGES CXX) diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index f777eb0..772103f 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -1,8 +1,6 @@ -set(CPM_DOWNLOAD_VERSION 0.31.1) +set(CPM_DOWNLOAD_VERSION 0.36.0) if(CPM_SOURCE_CACHE) - # Expand relative path. This is important if the provided path contains a tilde (~) - get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") elseif(DEFINED ENV{CPM_SOURCE_CACHE}) set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") @@ -10,6 +8,8 @@ else() set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") endif() +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") file(DOWNLOAD diff --git a/cmake/ProjectWarningsAsErrors.cmake b/cmake/ProjectWarningsAsErrors.cmake new file mode 100644 index 0000000..b23660c --- /dev/null +++ b/cmake/ProjectWarningsAsErrors.cmake @@ -0,0 +1,12 @@ +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wshadow) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 10.0) + target_compile_options(${PROJECT_NAME} PRIVATE -Wdeprecated-copy-dtor -Wnewline-eof) + endif() +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +endif() diff --git a/cmake/options.cmake b/cmake/options.cmake index eb0ea7f..3ce4d54 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -46,6 +46,7 @@ if(NOT MSVC) ) endif() + option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) if(ENABLE_TEST_COVERAGE AND "${CMAKE_BUILD_TYPE}" STREQUAL Debug) add_compile_options(--coverage -O0 -g) add_link_options(--coverage) diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt index 0437d1d..6919cd6 100644 --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14...3.20) +cmake_minimum_required(VERSION 3.21...3.25) project(MathFunctionsDocs) diff --git a/source/Addition/CMakeLists.txt b/source/Addition/CMakeLists.txt index 83908e3..ed1e6a2 100644 --- a/source/Addition/CMakeLists.txt +++ b/source/Addition/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( Addition Addition.cxx ${NAMESPACE_HEADER_LOCATION}/${PROJECT_HEADER_LOCATION}/Addition.h ) -add_library(${PROJECT_NAMESPACE}::Addition ALIAS Addition) +add_library(${PROJECT_NAMESPACE}::Addition ALIAS Addition) # NOTE: needed! CK # Note: for SameMajorVersion upgrade stategie set_target_properties( @@ -24,7 +24,7 @@ target_include_directories( $ ) -# install the target and create export-set +# NOTE: Need to install the target and create export-set manually! CK install( TARGETS Addition EXPORT ${PROJECT_NAMESPACE}Targets @@ -41,12 +41,12 @@ install( # DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAMESPACE} # ) -if(COMPONENT_TARGETS_ENABLED) - # generate and install export file - install( - EXPORT ${PROJECT_NAMESPACE}Targets - FILE ${PROJECT_NAMESPACE}AdditionTargets.cmake - NAMESPACE ${PROJECT_NAMESPACE}:: - DESTINATION lib/cmake/${PROJECT_NAMESPACE} - ) -endif() +# if(COMPONENT_TARGETS_ENABLED) +# # NOTE: generate and install export file for this target! CK +# install( +# EXPORT ${PROJECT_NAMESPACE}Targets +# FILE ${PROJECT_NAMESPACE}AdditionTargets.cmake +# NAMESPACE ${PROJECT_NAMESPACE}:: +# DESTINATION lib/cmake/${PROJECT_NAMESPACE} +# ) +# endif() diff --git a/source/MathFunctions/CMakeLists.txt b/source/MathFunctions/CMakeLists.txt index 56a255a..757fbc0 100644 --- a/source/MathFunctions/CMakeLists.txt +++ b/source/MathFunctions/CMakeLists.txt @@ -6,7 +6,7 @@ add_library( ${NAMESPACE_HEADER_LOCATION}/${PROJECT_HEADER_LOCATION}/MathFunctions.h ) -add_library(MathFunctions::MathFunctions ALIAS MathFunctions) +add_library(${PROJECT_NAMESPACE}::MathFunctions ALIAS MathFunctions) # NOTE: needed! CK # Note: for SameMajorVersion upgrade stategie set_target_properties( @@ -23,7 +23,7 @@ target_include_directories( $ ) -# install the target and create export-set +# NOTE: Need to install the target and create export-set manually! CK install( TARGETS MathFunctions EXPORT MathFunctionsTargets @@ -39,12 +39,12 @@ install( # DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAMESPACE} # ) -if(COMPONENT_TARGETS_ENABLED) - # generate and install export file - install( - EXPORT MathFunctionsTargets - FILE ${PROJECT_NAMESPACE}MathFunctionsTargets.cmake - NAMESPACE MathFunctions:: - DESTINATION lib/cmake/MathFunctions - ) -endif() +# if(COMPONENT_TARGETS_ENABLED) +# # NOTE: generate and install export file for this target! CK +# install( +# EXPORT MathFunctionsTargets +# FILE ${PROJECT_NAMESPACE}MathFunctionsTargets.cmake +# NAMESPACE ${PROJECT_NAMESPACE}:: +# DESTINATION lib/cmake/MathFunctions +# ) +# endif() diff --git a/source/SquareRoot/CMakeLists.txt b/source/SquareRoot/CMakeLists.txt index d469903..67efa5f 100644 --- a/source/SquareRoot/CMakeLists.txt +++ b/source/SquareRoot/CMakeLists.txt @@ -5,7 +5,7 @@ add_library( SquareRoot SquareRoot.cxx ${NAMESPACE_HEADER_LOCATION}/${PROJECT_HEADER_LOCATION}/SquareRoot.h ) -add_library(${PROJECT_NAMESPACE}::SquareRoot ALIAS SquareRoot) +add_library(${PROJECT_NAMESPACE}::SquareRoot ALIAS SquareRoot) # NOTE: needed! CK # Note: for SameMajorVersion upgrade stategie set_target_properties( @@ -24,7 +24,7 @@ target_include_directories( $ ) -# install the target and create export-set +# NOTE: Need to install the target and create export-set manually! CK install( TARGETS SquareRoot EXPORT ${PROJECT_NAMESPACE}Targets @@ -41,12 +41,12 @@ install( # DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAMESPACE} # ) -if(COMPONENT_TARGETS_ENABLED) - # generate and install export file - install( - EXPORT ${PROJECT_NAMESPACE}Targets - FILE ${PROJECT_NAMESPACE}SquareRootTargets.cmake - NAMESPACE ${PROJECT_NAMESPACE}:: - DESTINATION lib/cmake/${PROJECT_NAMESPACE} - ) -endif() +# if(COMPONENT_TARGETS_ENABLED) +# # NOTE: generate and install export file for this target +# install( +# EXPORT ${PROJECT_NAMESPACE}Targets +# FILE ${PROJECT_NAMESPACE}SquareRootTargets.cmake +# NAMESPACE ${PROJECT_NAMESPACE}:: +# DESTINATION lib/cmake/${PROJECT_NAMESPACE} +# ) +# endif() diff --git a/standalone/CMakeLists.txt b/standalone/CMakeLists.txt index df4454e..2af8966 100644 --- a/standalone/CMakeLists.txt +++ b/standalone/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14...3.20) +cmake_minimum_required(VERSION 3.21...3.25) project(MathFunctionsStandalone LANGUAGES CXX) @@ -12,7 +12,7 @@ include(../cmake/CPM.cmake) CPMAddPackage( NAME fmt - GIT_TAG 7.1.3 + GIT_TAG 9.1.0 GITHUB_REPOSITORY fmtlib/fmt # to get an installable target OPTIONS "FMT_INSTALL YES" ) @@ -36,7 +36,6 @@ target_link_libraries( enable_testing() add_test(NAME MathFunctionsCalculator COMMAND MathFunctionsCalculator 2) - add_test(NAME MathFunctionsStandaloneHint COMMAND MathFunctionsStandalone) add_test(NAME MathFunctionsStandaloneOops COMMAND MathFunctionsStandalone Oops ...) add_test(NAME MathFunctionsStandalone COMMAND MathFunctionsStandalone 49.0) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7c57cc2..02e6222 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14...3.20) +cmake_minimum_required(VERSION 3.21...3.25) project( MathFunctionsTests @@ -8,7 +8,6 @@ project( # ---- Options ---- -option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) # --- Import tools ---- @@ -19,10 +18,13 @@ include(../cmake/tools.cmake) include(../cmake/CPM.cmake) +CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.10.0") + CPMAddPackage( NAME ut GITHUB_REPOSITORY boost-ext/ut - GIT_TAG 1cc75c234d4005031cee581102a4a6c8b680df0a + GIT_TAG v1.1.9 + OPTIONS "BOOST_UT_DISABLE_MODULE ON" ) if(TEST_INSTALLED_VERSION) @@ -57,10 +59,3 @@ set_target_properties(MathFunctionsTests PROPERTIES CXX_STANDARD ${CMAKE_CXX_STA enable_testing() add_test(NAME MathFunctionsTests COMMAND MathFunctionsTests 2.0) - -# ---- code coverage ---- - -# if(ENABLE_TEST_COVERAGE AND NOT MathFunctions_FOUND) -# target_compile_options(MathFunctions PUBLIC -O0 -g -fprofile-arcs -ftest-coverage) -# target_link_options(MathFunctions PUBLIC -fprofile-arcs -ftest-coverage) -# endif()