Skip to content

Commit

Permalink
[INFRA] Make CMake options all capital
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Nov 5, 2024
1 parent 379ddb3 commit 92fcebf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,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
Expand All @@ -62,7 +62,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: Check installed executable
Expand All @@ -80,7 +80,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
test -n $(find . -type f -executable -name "needle") # needle binary should exist
rm bin/needle
Expand Down
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ()
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

0 comments on commit 92fcebf

Please sign in to comment.