From 37d2dee2e9dd680be5fb5e3516d579ba459291f9 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Tue, 5 Nov 2024 13:21:21 +0100 Subject: [PATCH] [INFRA] Make CMake options all capital --- .github/workflows/ci_documentation.yml | 2 -- .github/workflows/ci_install.yml | 8 ++++---- CMakeLists.txt | 12 ++++++------ src/CMakeLists.txt | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci_documentation.yml b/.github/workflows/ci_documentation.yml index 82e5395..6c2be7c 100644 --- a/.github/workflows/ci_documentation.yml +++ b/.github/workflows/ci_documentation.yml @@ -51,8 +51,6 @@ jobs: run: | mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release \ - -Dneedle_TEST=OFF \ - -Dneedle_DOCS=ON \ -DNEEDLE_TEST=OFF \ -DNEEDLE_DOCS=ON diff --git a/.github/workflows/ci_install.yml b/.github/workflows/ci_install.yml index 843bbf1..3a1c296 100644 --- a/.github/workflows/ci_install.yml +++ b/.github/workflows/ci_install.yml @@ -48,8 +48,8 @@ jobs: run: | mkdir create_source_package && cd create_source_package cmake ../needle -DCMAKE_BUILD_TYPE=Release \ - -Dneedle_PACKAGE=ON \ - -Dneedle_TEST=OFF + -DNEEDLE_PACKAGE=ON \ + -DNEEDLE_TEST=OFF make package_source mkdir ../source_package tar xf needle-*.tar.xz -C ../source_package --strip-components=1 @@ -59,7 +59,7 @@ jobs: mkdir build_from_source_package install && cd build_from_source_package unshare -r -n cmake ../source_package -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install \ - -Dneedle_TEST=OFF + -DNEEDLE_TEST=OFF unshare -r -n make install - name: Install GTest @@ -71,7 +71,7 @@ jobs: unshare -r -n cmake ../source_package -DCMAKE_BUILD_TYPE=Release \ -DCPM_USE_LOCAL_PACKAGES=ON \ -DNEEDLE_TEST_BINARY_DIR=${GITHUB_WORKSPACE}/install/bin \ - -Dneedle_TEST=ON + -DNEEDLE_TEST=ON unshare -r -n make -k tests rm bin/needle diff --git a/CMakeLists.txt b/CMakeLists.txt index 025244b..bf48362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,11 +22,11 @@ include (output_directories) # It can be used when calling CMake: `cmake .. -Dapp-template_TEST=OFF`. # It is good practice to allow disabling tests. If another project includes your application, # it might not want to build your tests. -option (${PROJECT_NAME}_TEST "Enable testing for ${PROJECT_NAME}." ON) -option (${PROJECT_NAME}_DOCS "Enable documentation for ${PROJECT_NAME}." OFF) -option (${PROJECT_NAME}_PACKAGE "Enable packaging for ${PROJECT_NAME}." OFF) +option (NEEDLE_TEST "Enable testing for NEEDLE." ON) +option (NEEDLE_DOCS "Enable documentation for NEEDLE." OFF) +option (NEEDLE_PACKAGE "Enable packaging for NEEDLE." OFF) -if (${PROJECT_NAME}_PACKAGE) +if (NEEDLE_PACKAGE) set (CPM_SOURCE_CACHE "${CMAKE_CURRENT_BINARY_DIR}/vendor") set (CPM_USE_LOCAL_PACKAGES OFF) include (package) @@ -48,11 +48,11 @@ CPMGetPackage (robin-hood) # Add the application. This will include `src/CMakeLists.txt`. add_subdirectory (src) -if (${PROJECT_NAME}_TEST) +if (NEEDLE_TEST) # Add the tests. This will include `test/CMakeLists.txt`. add_subdirectory (test EXCLUDE_FROM_ALL) endif () -if (${PROJECT_NAME}_DOCS) +if (NEEDLE_DOCS) add_subdirectory (doc EXCLUDE_FROM_ALL) endif () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c5cbcd4..a9f06d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,8 @@ set_target_properties ("${PROJECT_NAME}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${ include (GNUInstallDirs) install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -option (${PROJECT_NAME}_WITH_WERROR "Report compiler warnings as errors." ON) +option (NEEDLE_WITH_WERROR "Report compiler warnings as errors." ON) -if (${PROJECT_NAME}_WITH_WERROR) +if (NEEDLE_WITH_WERROR) target_compile_options (${PROJECT_NAME}_lib PUBLIC "-Werror") endif ()