Skip to content

Commit b9d9261

Browse files
Introduce OATPP_LINK_TEST_LIBRARY
1 parent e146851 commit b9d9261

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
2121
option(OATPP_DIR_SRC "Path to oatpp module directory (sources)")
2222
option(OATPP_DIR_LIB "Path to directory with liboatpp (directory containing ex: liboatpp.so or liboatpp.dynlib)")
2323
option(OATPP_BUILD_TESTS "Build tests for this module" ON)
24+
option(OATPP_LINK_TEST_LIBRARY "Link oat++ test library" ON)
2425
option(OATPP_INSTALL "Install module binaries" ON)
2526

2627
set(OATPP_MODULES_LOCATION "INSTALLED" CACHE STRING "Location where to find oatpp modules. can be [INSTALLED|EXTERNAL|CUSTOM]")
@@ -42,8 +43,10 @@ if(OATPP_MODULES_LOCATION STREQUAL OATPP_MODULES_LOCATION_INSTALLED)
4243
get_target_property(OATPP_INCLUDE oatpp::oatpp INTERFACE_INCLUDE_DIRECTORIES)
4344
message("OATPP_INCLUDE=${OATPP_INCLUDE}")
4445

46+
if(OATPP_BUILD_TESTS)
4547
get_target_property(OATPP_TEST_INCLUDE oatpp::oatpp-test INTERFACE_INCLUDE_DIRECTORIES)
4648
message("OATPP_TEST_INCLUDE=${OATPP_TEST_INCLUDE}")
49+
endif()
4750

4851
elseif(OATPP_MODULES_LOCATION STREQUAL OATPP_MODULES_LOCATION_EXTERNAL)
4952

cmake/module-utils.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ macro(target_link_oatpp target)
66

77
target_link_libraries(${target}
88
PRIVATE oatpp::oatpp
9-
PRIVATE oatpp::oatpp-test
109
)
11-
10+
if(OATPP_LINK_TEST_LIBRARY)
11+
target_link_libraries(${target}
12+
PRIVATE oatpp::oatpp-test
13+
)
14+
endif()
1215
else()
1316

1417
message("target_link_oatpp(${target}) to found in provided path oatpp lib")
@@ -17,8 +20,12 @@ macro(target_link_oatpp target)
1720
#target_link_directories(${target} PRIVATE ${OATPP_DIR_LIB})
1821
target_link_libraries(${target}
1922
PRIVATE oatpp
20-
PRIVATE oatpp-test
2123
)
24+
if(OATPP_LINK_TEST_LIBRARY)
25+
target_link_libraries(${target}
26+
PRIVATE oatpp-test
27+
)
28+
endif()
2229

2330
endif()
2431

0 commit comments

Comments
 (0)