diff options
| author | Vollstrecker <werner@vollstreckernet.de> | 2026-01-04 11:37:00 +0100 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2026-01-12 11:10:03 -0800 |
| commit | e62a3ddbe333ec5c65fa048d32abef947d1c74ed (patch) | |
| tree | 1d9e22a0a2f58ae718ac377b2ab50ba4a90ae190 /contrib/iostream3 | |
| parent | 883c24b6a25c3e6eeebf02cc19a3e8537ac5614f (diff) | |
| download | zlib-e62a3ddbe333ec5c65fa048d32abef947d1c74ed.tar.gz zlib-e62a3ddbe333ec5c65fa048d32abef947d1c74ed.tar.bz2 zlib-e62a3ddbe333ec5c65fa048d32abef947d1c74ed.zip | |
CMake: Make final fixes for Windows.
Diffstat (limited to 'contrib/iostream3')
| -rw-r--r-- | contrib/iostream3/CMakeLists.txt | 49 | ||||
| -rw-r--r-- | contrib/iostream3/test/CMakeLists.txt | 8 |
2 files changed, 43 insertions, 14 deletions
diff --git a/contrib/iostream3/CMakeLists.txt b/contrib/iostream3/CMakeLists.txt index 33e5b71b..e2ac480b 100644 --- a/contrib/iostream3/CMakeLists.txt +++ b/contrib/iostream3/CMakeLists.txt | |||
| @@ -32,6 +32,23 @@ if(WIN32 OR CYGWIN) | |||
| 32 | set(CMAKE_DEBUG_POSTFIX "d") | 32 | set(CMAKE_DEBUG_POSTFIX "d") |
| 33 | endif(WIN32 OR CYGWIN) | 33 | endif(WIN32 OR CYGWIN) |
| 34 | 34 | ||
| 35 | |||
| 36 | function(iostreamv3_findTestEnv testName) | ||
| 37 | set(testEnv "PATH=") | ||
| 38 | |||
| 39 | if(MSVC OR MINGW) | ||
| 40 | set(separator "\\\;") | ||
| 41 | else() | ||
| 42 | set(separator ":") | ||
| 43 | endif() | ||
| 44 | |||
| 45 | string(APPEND testEnv "$<TARGET_FILE_DIR:zlib_iostream3_iostreamv3>${separator}") | ||
| 46 | string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}") | ||
| 47 | string(APPEND testEnv "$ENV{PATH}") | ||
| 48 | |||
| 49 | set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}") | ||
| 50 | endfunction(iostreamv3_findTestEnv testName) | ||
| 51 | |||
| 35 | if(ZLIB_IOSTREAM3_BUILD_SHARED) | 52 | if(ZLIB_IOSTREAM3_BUILD_SHARED) |
| 36 | add_library(zlib_iostream3_iostreamv3 SHARED | 53 | add_library(zlib_iostream3_iostreamv3 SHARED |
| 37 | zfstream.cc | 54 | zfstream.cc |
| @@ -46,11 +63,10 @@ if(ZLIB_IOSTREAM3_BUILD_SHARED) | |||
| 46 | VERSION ${iostreamV3_VERSION}) | 63 | VERSION ${iostreamV3_VERSION}) |
| 47 | endif(NOT CYGWIN) | 64 | endif(NOT CYGWIN) |
| 48 | 65 | ||
| 49 | set_target_properties( | 66 | set_target_properties(zlib_iostream3_iostreamv3 |
| 50 | zlib_iostream3_iostreamv3 | 67 | PROPERTIES |
| 51 | PROPERTIES | 68 | EXPORT_NAME IOSTREAMV3 |
| 52 | EXPORT_NAME IOSTREAMV3 | 69 | OUTPUT_NAME iostream3) |
| 53 | OUTPUT_NAME iostream3) | ||
| 54 | 70 | ||
| 55 | target_link_libraries(zlib_iostream3_iostreamv3 | 71 | target_link_libraries(zlib_iostream3_iostreamv3 |
| 56 | PUBLIC ZLIB::ZLIB) | 72 | PUBLIC ZLIB::ZLIB) |
| @@ -61,13 +77,24 @@ if(ZLIB_IOSTREAM3_BUILD_SHARED) | |||
| 61 | add_executable(zlib_iostream3_test test.cc zfstream.h) | 77 | add_executable(zlib_iostream3_test test.cc zfstream.h) |
| 62 | 78 | ||
| 63 | target_link_libraries(zlib_iostream3_test | 79 | target_link_libraries(zlib_iostream3_test |
| 64 | PRIVATE zlib_iostream3_iostream3) | 80 | PRIVATE zlib_iostream3_iostreamv3) |
| 65 | 81 | ||
| 66 | add_test(NAME zlib_iostream3_test COMMAND zlib_iostream3_test) | 82 | add_test(NAME zlib_iostream3_test COMMAND zlib_iostream3_test) |
| 67 | 83 | ||
| 68 | set_tests_properties(zlib_iostream3_test | 84 | set_tests_properties(zlib_iostream3_test |
| 69 | PROPERTIES | 85 | PROPERTIES |
| 70 | FIXTURES_REQUIRED zlib_iostream3_cleanup) | 86 | FIXTURES_REQUIRED zlib_iostream3_cleanup) |
| 87 | |||
| 88 | if(MSVC | ||
| 89 | OR MSYS | ||
| 90 | OR MINGW | ||
| 91 | OR CYGWIN) | ||
| 92 | iostreamv3_findtestenv(zlib_iostream3_test) | ||
| 93 | endif( | ||
| 94 | MSVC | ||
| 95 | OR MSYS | ||
| 96 | OR MINGW | ||
| 97 | OR CYGWIN) | ||
| 71 | endif(ZLIB_IOSTREAM3_BUILD_TESTING) | 98 | endif(ZLIB_IOSTREAM3_BUILD_TESTING) |
| 72 | endif(ZLIB_IOSTREAM3_BUILD_SHARED) | 99 | endif(ZLIB_IOSTREAM3_BUILD_SHARED) |
| 73 | 100 | ||
| @@ -80,7 +107,7 @@ if(ZLIB_IOSTREAM3_BUILD_STATIC) | |||
| 80 | ALIAS zlib_iostream3_iostreamv3Static) | 107 | ALIAS zlib_iostream3_iostreamv3Static) |
| 81 | 108 | ||
| 82 | target_link_libraries(zlib_iostream3_iostreamv3Static | 109 | target_link_libraries(zlib_iostream3_iostreamv3Static |
| 83 | INTERFACE ZLIB::ZLIBSTATIC) | 110 | PUBLIC ZLIB::ZLIBSTATIC) |
| 84 | 111 | ||
| 85 | set_target_properties(zlib_iostream3_iostreamv3Static | 112 | set_target_properties(zlib_iostream3_iostreamv3Static |
| 86 | PROPERTIES | 113 | PROPERTIES |
| @@ -93,7 +120,8 @@ if(ZLIB_IOSTREAM3_BUILD_STATIC) | |||
| 93 | add_executable(zlib_iostream3_testStatic test.cc zfstream.h) | 120 | add_executable(zlib_iostream3_testStatic test.cc zfstream.h) |
| 94 | 121 | ||
| 95 | target_link_libraries(zlib_iostream3_testStatic | 122 | target_link_libraries(zlib_iostream3_testStatic |
| 96 | PRIVATE zlib_iostream3_iostream3Static) | 123 | PRIVATE zlib_iostream3_iostreamv3Static) |
| 124 | |||
| 97 | add_test(NAME zlib_iostream3_testStatic | 125 | add_test(NAME zlib_iostream3_testStatic |
| 98 | COMMAND zlib_iostream3_testStatic) | 126 | COMMAND zlib_iostream3_testStatic) |
| 99 | 127 | ||
| @@ -121,7 +149,8 @@ if(ZLIB_IOSTREAM3_INSTALL) | |||
| 121 | TARGETS zlib_iostream3_iostreamv3 | 149 | TARGETS zlib_iostream3_iostreamv3 |
| 122 | COMPONENT Runtime | 150 | COMPONENT Runtime |
| 123 | EXPORT zlibiostream3SharedExport | 151 | EXPORT zlibiostream3SharedExport |
| 124 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") | 152 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" |
| 153 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
| 125 | install( | 154 | install( |
| 126 | EXPORT zlibiostream3SharedExport | 155 | EXPORT zlibiostream3SharedExport |
| 127 | FILE iostreamv3-shared.cmake | 156 | FILE iostreamv3-shared.cmake |
| @@ -130,7 +159,7 @@ if(ZLIB_IOSTREAM3_INSTALL) | |||
| 130 | 159 | ||
| 131 | if(MSVC) | 160 | if(MSVC) |
| 132 | install( | 161 | install( |
| 133 | FILES $<TARGET_PDB_FILE:zlib_iostream3_iostream3> | 162 | FILES $<TARGET_PDB_FILE:zlib_iostream3_iostreamv3> |
| 134 | COMPONENT Development | 163 | COMPONENT Development |
| 135 | DESTINATION ${CMAKE_INSTALL_BINDIR} | 164 | DESTINATION ${CMAKE_INSTALL_BINDIR} |
| 136 | CONFIGURATIONS Debug OR RelWithDebInfo | 165 | CONFIGURATIONS Debug OR RelWithDebInfo |
diff --git a/contrib/iostream3/test/CMakeLists.txt b/contrib/iostream3/test/CMakeLists.txt index f8b2b515..44e7d601 100644 --- a/contrib/iostream3/test/CMakeLists.txt +++ b/contrib/iostream3/test/CMakeLists.txt | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | # if we are built from with zlib, use this path's) | 1 | # if we are built from with zlib, use this path's) |
| 2 | if(DEFINED ZLIB_BUILD_SHARED) | 2 | if(DEFINED ZLIB_BUILD_IOSTREAM3) |
| 3 | set(WORK_DIR ${zlib_BINARY_DIR}) | 3 | set(WORK_DIR ${zlib_BINARY_DIR}) |
| 4 | set(inst_setup zlib_iostream3_install) | 4 | set(inst_setup zlib_install) |
| 5 | else(DEFINED ZLIB_BUILD_SHARED) | 5 | else(DEFINED ZLIB_BUILD_IOSTREAM3) |
| 6 | set(WORK_DIR ${iostreamV3_BINARY_DIR}) | 6 | set(WORK_DIR ${iostreamV3_BINARY_DIR}) |
| 7 | set(inst_setup zlib_iostream3_install) | 7 | set(inst_setup zlib_iostream3_install) |
| 8 | set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}") | 8 | set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}") |
| @@ -16,7 +16,7 @@ else(DEFINED ZLIB_BUILD_SHARED) | |||
| 16 | set_tests_properties(zlib_iostream3_install | 16 | set_tests_properties(zlib_iostream3_install |
| 17 | PROPERTIES | 17 | PROPERTIES |
| 18 | FIXTURES_SETUP zlib_iostream3_install) | 18 | FIXTURES_SETUP zlib_iostream3_install) |
| 19 | endif(DEFINED ZLIB_BUILD_SHARED) | 19 | endif(DEFINED ZLIB_BUILD_IOSTREAM3) |
| 20 | 20 | ||
| 21 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) | 21 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test) |
| 22 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) | 22 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test) |
