Skip to content

Commit

Permalink
add CMake options for variables
Browse files Browse the repository at this point in the history
they are just easier to discover this way (see ccmake and IDE
integrations)
  • Loading branch information
akallabeth committed Nov 7, 2024
1 parent e98d23f commit 952ba2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(SOURCE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(TEST_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")

option(ENABLE_COVERAGE "Enable -ftest-converage" OFF)
# enable coverage if requested
if(ENABLE_COVERAGE)
message("-- Coverage enabled")
Expand Down Expand Up @@ -50,11 +51,13 @@ set_target_properties(cwalk PROPERTIES PUBLIC_HEADER "${INCLUDE_DIRECTORY}/cwalk
set_target_properties(cwalk PROPERTIES DEFINE_SYMBOL CWK_EXPORTS)

# add shared library macro
option(BUILD_SHARED_LIBS "build shared libraries" OFF)
if(BUILD_SHARED_LIBS)
target_compile_definitions(cwalk PUBLIC CWK_SHARED)
endif()

# enable tests
option(ENABLE_TESTS "enable unit tests" OFF)
if(ENABLE_TESTS)
message("-- Tests enabled")
enable_testing()
Expand Down
2 changes: 2 additions & 0 deletions cmake/EnableWarnings.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# enable warnings
option(IGNORE_WARNINGS "Disable -Werror" OFF)

function(enable_warnings target)
if(MSVC)
target_compile_definitions(${target} PRIVATE _CRT_SECURE_NO_WARNINGS)
Expand Down

0 comments on commit 952ba2d

Please sign in to comment.