Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)

set(OATPP_MODULES_LOCATION "INSTALLED" CACHE STRING "Location where to find oatpp modules. can be [INSTALLED|EXTERNAL|CUSTOM]")
Expand Down Expand Up @@ -54,8 +55,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
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ jobs:
displayName: 'Build - module'
workingDirectory: build
- script: |
module-tests.exe
oatpp-sqlite-tests.exe
displayName: 'Test'
workingDirectory: build\test\Debug\
14 changes: 12 additions & 2 deletions cmake/module-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ 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()

message("target_link_oatpp(${target}) to found in provided path oatpp lib")
Expand All @@ -17,9 +22,14 @@ 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()

endmacro()
16 changes: 8 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_definitions (
-DTEST_DB_MIGRATION="${CMAKE_CURRENT_SOURCE_DIR}/oatpp-sqlite/migration/"
)

add_executable(module-tests
add_executable(oatpp-sqlite-tests
oatpp-sqlite/ql_template/ParserTest.cpp
oatpp-sqlite/ql_template/ParserTest.hpp
oatpp-sqlite/types/BlobTest.cpp
Expand All @@ -16,28 +16,28 @@ add_executable(module-tests
oatpp-sqlite/types/NumericTest.hpp
oatpp-sqlite/tests.cpp)

set_target_properties(module-tests PROPERTIES
set_target_properties(oatpp-sqlite-tests PROPERTIES
CXX_STANDARD 17
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)

target_include_directories(module-tests
target_include_directories(oatpp-sqlite-tests
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)

if(OATPP_MODULES_LOCATION STREQUAL OATPP_MODULES_LOCATION_EXTERNAL)
add_dependencies(module-tests ${LIB_OATPP_EXTERNAL})
add_dependencies(oatpp-sqlite-tests ${LIB_OATPP_EXTERNAL})
endif()

add_dependencies(module-tests ${OATPP_THIS_MODULE_NAME})
add_dependencies(oatpp-sqlite-tests ${OATPP_THIS_MODULE_NAME})

target_link_oatpp(module-tests)
target_link_oatpp(oatpp-sqlite-tests)

target_link_libraries(module-tests
target_link_libraries(oatpp-sqlite-tests
PRIVATE ${OATPP_THIS_MODULE_NAME}
)

## TODO link dependencies here (if some)

add_test(module-tests module-tests)
add_test(oatpp-sqlite-tests oatpp-sqlite-tests)