Skip to content

Commit 0e1847f

Browse files
authored
cleaner CMake file: add options (#946)
1 parent 010f7c4 commit 0e1847f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ include(cmake/ada-flags.cmake)
1616
add_subdirectory(src)
1717

1818
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake)
19-
19+
option(ADA_TESTING "Whether to build tests." OFF)
20+
option(ADA_BENCHMARKS "Whether to build benchmarks." OFF)
21+
option(ADA_TOOLS "Whether to build tools." OFF)
22+
option(ADA_BUILD_SINGLE_HEADER_LIB "Whether to build the lib from the single-header files" OFF)
2023
# There are cases where when embedding ada as a dependency for other CMake
2124
# projects as submodules or subdirectories (via FetchContent) can lead to
2225
# errors due to CPM, so this is here to support disabling all the testing

singleheader/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ if (Python3_Interpreter_FOUND)
4949
add_library(ada-singleheader-source INTERFACE)
5050
target_sources(ada-singleheader-source INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/ada.cpp>)
5151
target_link_libraries(ada-singleheader-source INTERFACE ada-singleheader-include-source)
52-
add_library(ada-singleheader-lib STATIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/ada.cpp>)
52+
if (ADA_TESTING OR ADA_BUILD_SINGLE_HEADER_LIB)
53+
add_library(ada-singleheader-lib STATIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/ada.cpp>)
54+
endif(ADA_TESTING OR ADA_BUILD_SINGLE_HEADER_LIB)
5355

5456
if (ADA_TESTING)
5557
add_executable(demo $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/demo.cpp>)

0 commit comments

Comments
 (0)