aboutsummaryrefslogtreecommitdiff
path: root/test/add_subdirectory_test.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'test/add_subdirectory_test.cmake.in')
-rw-r--r--test/add_subdirectory_test.cmake.in21
1 files changed, 12 insertions, 9 deletions
diff --git a/test/add_subdirectory_test.cmake.in b/test/add_subdirectory_test.cmake.in
index 72933ba..d5e3a05 100644
--- a/test/add_subdirectory_test.cmake.in
+++ b/test/add_subdirectory_test.cmake.in
@@ -2,24 +2,27 @@ cmake_minimum_required(VERSION 3.10)
2 2
3project(zlib_find_package_test 3project(zlib_find_package_test
4 LANGUAGES C 4 LANGUAGES C
5 VERSION ${zlib_VERSION}) 5 VERSION @zlib_VERSION@)
6 6
7enable_testing() 7enable_testing()
8set(ZLIB_BUILD_TESTING OFF) 8option(ZLIB_BUILD_TESTING "" OFF)
9add_subdirectory(${zlib_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/zlib) 9option(ZLIB_BUILD_SHARED "" @ZLIB_BUILD_SHARED@)
10option(ZLIB_BUILD_STATIC "" @ZLIB_BUILD_STATIC@)
10 11
11if(${ZLIB_BUILD_SHARED}) 12add_subdirectory(@zlib_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/zlib)
12 add_executable(test_example ${zlib_SOURCE_DIR}/test/example.c) 13
14if(ZLIB_BUILD_SHARED)
15 add_executable(test_example @zlib_SOURCE_DIR@/test/example.c)
13 target_link_libraries(test_example ZLIB::ZLIB) 16 target_link_libraries(test_example ZLIB::ZLIB)
14 17
15 if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") 18 if(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
16 add_test(NAME zlib_test_example_shared COMMAND test_example) 19 add_test(NAME zlib_test_example_shared COMMAND test_example)
17 endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll") 20 endif(NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL ".dll")
18endif(${ZLIB_BUILD_SHARED}) 21endif(ZLIB_BUILD_SHARED)
19 22
20if(${ZLIB_BUILD_STATIC}) 23if(ZLIB_BUILD_STATIC)
21 add_executable(test_example_static ${zlib_SOURCE_DIR}/test/example.c) 24 add_executable(test_example_static @zlib_SOURCE_DIR@/test/example.c)
22 target_link_libraries(test_example_static ZLIB::ZLIBSTATIC) 25 target_link_libraries(test_example_static ZLIB::ZLIBSTATIC)
23 add_test(NAME zlib_test_example_static 26 add_test(NAME zlib_test_example_static
24 COMMAND test_example_static) 27 COMMAND test_example_static)
25endif(${ZLIB_BUILD_STATIC}) 28endif(@ZLIB_BUILD_STATIC)