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