Skip to content

Commit

Permalink
Merge pull request #32 from dencrypt-jacob/no_test_lib
Browse files Browse the repository at this point in the history
Introduce OATPP_LINK_TEST_LIBRARY
  • Loading branch information
lganzzzo committed Jan 10, 2022
2 parents 9954e42 + d21f141 commit f49d144
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(OATPP_DIR_SRC "Path to oatpp module directory (sources)")
option(OATPP_DIR_LIB "Path to directory with liboatpp (directory containing ex: liboatpp.so or liboatpp.dynlib)")
option(OATPP_BUILD_TESTS "Build tests for this module" ON)
option(OATPP_LINK_TEST_LIBRARY "Link oat++ test library" ON)
option(OATPP_INSTALL "Install module binaries" ON)
option(OATPP_MSVC_LINK_STATIC_RUNTIME "MSVC: Link with static runtime (/MT and /MTd)." OFF)

Expand All @@ -48,8 +49,10 @@ if(OATPP_MODULES_LOCATION STREQUAL OATPP_MODULES_LOCATION_INSTALLED)
get_target_property(OATPP_INCLUDE oatpp::oatpp INTERFACE_INCLUDE_DIRECTORIES)
message("OATPP_INCLUDE=${OATPP_INCLUDE}")

get_target_property(OATPP_TEST_INCLUDE oatpp::oatpp-test INTERFACE_INCLUDE_DIRECTORIES)
message("OATPP_TEST_INCLUDE=${OATPP_TEST_INCLUDE}")
if(OATPP_BUILD_TESTS)
get_target_property(OATPP_TEST_INCLUDE oatpp::oatpp-test INTERFACE_INCLUDE_DIRECTORIES)
message("OATPP_TEST_INCLUDE=${OATPP_TEST_INCLUDE}")
endif()

elseif(OATPP_MODULES_LOCATION STREQUAL OATPP_MODULES_LOCATION_EXTERNAL)

Expand Down
12 changes: 10 additions & 2 deletions cmake/module-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ macro(target_link_oatpp target)

target_link_libraries(${target}
PRIVATE oatpp::oatpp
PRIVATE oatpp::oatpp-test
)
if(OATPP_LINK_TEST_LIBRARY)
target_link_libraries(${target}
PRIVATE oatpp::oatpp-test
)
endif()

else()

Expand All @@ -17,8 +21,12 @@ macro(target_link_oatpp target)
#target_link_directories(${target} PRIVATE ${OATPP_DIR_LIB})
target_link_libraries(${target}
PRIVATE oatpp
PRIVATE oatpp-test
)
if(OATPP_LINK_TEST_LIBRARY)
target_link_libraries(${target}
PRIVATE oatpp-test
)
endif()

endif()

Expand Down

0 comments on commit f49d144

Please sign in to comment.