mirror of
https://github.com/madler/zlib.git
synced 2026-01-18 17:11:27 +01:00
CMake: Make final fixes for Windows.
This commit is contained in:
@@ -18,6 +18,7 @@ include(CMakePackageConfigHelpers)
|
||||
if(WIN32 OR CYGWIN)
|
||||
set(zlibblast_static_suffix "s")
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
endif(WIN32 OR CYGWIN)
|
||||
|
||||
function(blast_findTestEnv testName)
|
||||
@@ -29,7 +30,7 @@ function(blast_findTestEnv testName)
|
||||
set(separator ":")
|
||||
endif()
|
||||
|
||||
string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
|
||||
string(APPEND testEnv "$<TARGET_FILE_DIR:BLAST::BLAST>${separator}")
|
||||
string(APPEND testEnv "$ENV{PATH}")
|
||||
|
||||
set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
|
||||
@@ -114,7 +115,8 @@ if(ZLIB_BLAST_INSTALL)
|
||||
TARGETS zlib_blast_blast
|
||||
COMPONENT Runtime
|
||||
EXPORT zlibBlastSharedExport
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
EXPORT zlibBlastSharedExport
|
||||
FILE blast-shared.cmake
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# if we are built from with zlib, use this path's)
|
||||
if(DEFINED ZLIB_BUILD_SHARED)
|
||||
if(DEFINED ZLIB_BUILD_BLAST)
|
||||
set(WORK_DIR ${zlib_BINARY_DIR})
|
||||
set(inst_setup zlib_blast_install)
|
||||
else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set(inst_setup zlib_install)
|
||||
else(DEFINED ZLIB_BUILD_BLAST)
|
||||
set(WORK_DIR ${blast_BINARY_DIR})
|
||||
set(inst_setup zlib_blast_install)
|
||||
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
||||
@@ -16,7 +16,7 @@ else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set_tests_properties(zlib_blast_install
|
||||
PROPERTIES
|
||||
FIXTURES_SETUP zlib_blast_install)
|
||||
endif(DEFINED ZLIB_BUILD_SHARED)
|
||||
endif(DEFINED ZLIB_BUILD_BLAST)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||
|
||||
@@ -5,10 +5,10 @@ enable_language(ASM)
|
||||
|
||||
set(CMAKE_ASM_COMPILE_OBJECT ${CMAKE_ASM_COMPILE_OBJECT} CACHE INTERNAL "" FORCE)
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
#cmake 4.1 doesn't consider cl an asm compiler
|
||||
cmake_policy(SET CMP0194 NEW)
|
||||
endif(WIN32)
|
||||
endif(MSVC)
|
||||
|
||||
if(ZLIB_BUILD_SHARED)
|
||||
target_sources(zlib PRIVATE gvmat64.S)
|
||||
|
||||
@@ -32,6 +32,23 @@ if(WIN32 OR CYGWIN)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
endif(WIN32 OR CYGWIN)
|
||||
|
||||
|
||||
function(iostreamv3_findTestEnv testName)
|
||||
set(testEnv "PATH=")
|
||||
|
||||
if(MSVC OR MINGW)
|
||||
set(separator "\\\;")
|
||||
else()
|
||||
set(separator ":")
|
||||
endif()
|
||||
|
||||
string(APPEND testEnv "$<TARGET_FILE_DIR:zlib_iostream3_iostreamv3>${separator}")
|
||||
string(APPEND testEnv "$<TARGET_FILE_DIR:ZLIB::ZLIB>${separator}")
|
||||
string(APPEND testEnv "$ENV{PATH}")
|
||||
|
||||
set_tests_properties(${testName} PROPERTIES ENVIRONMENT "${testEnv}")
|
||||
endfunction(iostreamv3_findTestEnv testName)
|
||||
|
||||
if(ZLIB_IOSTREAM3_BUILD_SHARED)
|
||||
add_library(zlib_iostream3_iostreamv3 SHARED
|
||||
zfstream.cc
|
||||
@@ -46,11 +63,10 @@ if(ZLIB_IOSTREAM3_BUILD_SHARED)
|
||||
VERSION ${iostreamV3_VERSION})
|
||||
endif(NOT CYGWIN)
|
||||
|
||||
set_target_properties(
|
||||
zlib_iostream3_iostreamv3
|
||||
PROPERTIES
|
||||
EXPORT_NAME IOSTREAMV3
|
||||
OUTPUT_NAME iostream3)
|
||||
set_target_properties(zlib_iostream3_iostreamv3
|
||||
PROPERTIES
|
||||
EXPORT_NAME IOSTREAMV3
|
||||
OUTPUT_NAME iostream3)
|
||||
|
||||
target_link_libraries(zlib_iostream3_iostreamv3
|
||||
PUBLIC ZLIB::ZLIB)
|
||||
@@ -61,13 +77,24 @@ if(ZLIB_IOSTREAM3_BUILD_SHARED)
|
||||
add_executable(zlib_iostream3_test test.cc zfstream.h)
|
||||
|
||||
target_link_libraries(zlib_iostream3_test
|
||||
PRIVATE zlib_iostream3_iostream3)
|
||||
PRIVATE zlib_iostream3_iostreamv3)
|
||||
|
||||
add_test(NAME zlib_iostream3_test COMMAND zlib_iostream3_test)
|
||||
|
||||
set_tests_properties(zlib_iostream3_test
|
||||
PROPERTIES
|
||||
FIXTURES_REQUIRED zlib_iostream3_cleanup)
|
||||
|
||||
if(MSVC
|
||||
OR MSYS
|
||||
OR MINGW
|
||||
OR CYGWIN)
|
||||
iostreamv3_findtestenv(zlib_iostream3_test)
|
||||
endif(
|
||||
MSVC
|
||||
OR MSYS
|
||||
OR MINGW
|
||||
OR CYGWIN)
|
||||
endif(ZLIB_IOSTREAM3_BUILD_TESTING)
|
||||
endif(ZLIB_IOSTREAM3_BUILD_SHARED)
|
||||
|
||||
@@ -80,7 +107,7 @@ if(ZLIB_IOSTREAM3_BUILD_STATIC)
|
||||
ALIAS zlib_iostream3_iostreamv3Static)
|
||||
|
||||
target_link_libraries(zlib_iostream3_iostreamv3Static
|
||||
INTERFACE ZLIB::ZLIBSTATIC)
|
||||
PUBLIC ZLIB::ZLIBSTATIC)
|
||||
|
||||
set_target_properties(zlib_iostream3_iostreamv3Static
|
||||
PROPERTIES
|
||||
@@ -93,7 +120,8 @@ if(ZLIB_IOSTREAM3_BUILD_STATIC)
|
||||
add_executable(zlib_iostream3_testStatic test.cc zfstream.h)
|
||||
|
||||
target_link_libraries(zlib_iostream3_testStatic
|
||||
PRIVATE zlib_iostream3_iostream3Static)
|
||||
PRIVATE zlib_iostream3_iostreamv3Static)
|
||||
|
||||
add_test(NAME zlib_iostream3_testStatic
|
||||
COMMAND zlib_iostream3_testStatic)
|
||||
|
||||
@@ -121,7 +149,8 @@ if(ZLIB_IOSTREAM3_INSTALL)
|
||||
TARGETS zlib_iostream3_iostreamv3
|
||||
COMPONENT Runtime
|
||||
EXPORT zlibiostream3SharedExport
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
EXPORT zlibiostream3SharedExport
|
||||
FILE iostreamv3-shared.cmake
|
||||
@@ -130,7 +159,7 @@ if(ZLIB_IOSTREAM3_INSTALL)
|
||||
|
||||
if(MSVC)
|
||||
install(
|
||||
FILES $<TARGET_PDB_FILE:zlib_iostream3_iostream3>
|
||||
FILES $<TARGET_PDB_FILE:zlib_iostream3_iostreamv3>
|
||||
COMPONENT Development
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
CONFIGURATIONS Debug OR RelWithDebInfo
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# if we are built from with zlib, use this path's)
|
||||
if(DEFINED ZLIB_BUILD_SHARED)
|
||||
if(DEFINED ZLIB_BUILD_IOSTREAM3)
|
||||
set(WORK_DIR ${zlib_BINARY_DIR})
|
||||
set(inst_setup zlib_iostream3_install)
|
||||
else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set(inst_setup zlib_install)
|
||||
else(DEFINED ZLIB_BUILD_IOSTREAM3)
|
||||
set(WORK_DIR ${iostreamV3_BINARY_DIR})
|
||||
set(inst_setup zlib_iostream3_install)
|
||||
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
||||
@@ -16,7 +16,7 @@ else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set_tests_properties(zlib_iostream3_install
|
||||
PROPERTIES
|
||||
FIXTURES_SETUP zlib_iostream3_install)
|
||||
endif(DEFINED ZLIB_BUILD_SHARED)
|
||||
endif(DEFINED ZLIB_BUILD_IOSTREAM3)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# if we are built from with zlib, use this path's)
|
||||
if(DEFINED ZLIB_BUILD_SHARED)
|
||||
if(DEFINED ZLIB_BUILD_MINIZIP)
|
||||
set(WORK_DIR ${zlib_BINARY_DIR})
|
||||
set(inst_setup minizip_minizip_install)
|
||||
else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set(inst_setup zlib_install)
|
||||
else(DEFINED ZLIB_BUILD_MINIZIP)
|
||||
set(WORK_DIR ${minizip_BINARY_DIR})
|
||||
set(inst_setup minizip_minizip_install)
|
||||
set(inst_setup minizip_install)
|
||||
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
||||
|
||||
add_test(
|
||||
@@ -13,9 +13,10 @@ else(DEFINED ZLIB_BUILD_SHARED)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
|
||||
WORKING_DIRECTORY ${minizip_BINARY_DIR})
|
||||
|
||||
set_tests_properties(minizip_install PROPERTIES FIXTURES_SETUP
|
||||
minizip_install)
|
||||
endif(DEFINED ZLIB_BUILD_SHARED)
|
||||
set_tests_properties(minizip_install
|
||||
PROPERTIES
|
||||
FIXTURES_SETUP minizip_install)
|
||||
endif(DEFINED ZLIB_BUILD_MINIZIP)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12...3.31)
|
||||
|
||||
project(
|
||||
puff
|
||||
VERSION 1.0.0
|
||||
VERSION 2.3.0
|
||||
LANGUAGES C
|
||||
DESCRIPTION "A library for decompressing deflate with very little footprint"
|
||||
HOMEPAGE_URL "https://www.zlib.net")
|
||||
@@ -83,7 +83,7 @@ if(ZLIB_PUFF_BUILD_SHARED)
|
||||
EXPORT_NAME PUFF
|
||||
OUTPUT_NAME puff)
|
||||
|
||||
if(ZLIB_PUFF_BUILD_TESTING)
|
||||
if(ZLIB_PUFF_BUILD_TESTING AND NOT WIN32)
|
||||
enable_testing()
|
||||
|
||||
add_executable(zlib_puff_test pufftest.c puff.h)
|
||||
@@ -113,7 +113,7 @@ if(ZLIB_PUFF_BUILD_SHARED)
|
||||
${GCOV_EXECUTABLE}
|
||||
${llvm_option})
|
||||
endif(GCOV_EXECUTABLE)
|
||||
endif(ZLIB_PUFF_BUILD_TESTING)
|
||||
endif(ZLIB_PUFF_BUILD_TESTING AND NOT WIN32)
|
||||
endif(ZLIB_PUFF_BUILD_SHARED)
|
||||
|
||||
if(ZLIB_PUFF_BUILD_STATIC)
|
||||
@@ -128,7 +128,7 @@ if(ZLIB_PUFF_BUILD_STATIC)
|
||||
EXPORT_NAME PUFFSTATIC
|
||||
OUTPUT_NAME puff${zlib_puff_static_suffix})
|
||||
|
||||
if(ZLIB_PUFF_BUILD_TESTING)
|
||||
if(ZLIB_PUFF_BUILD_TESTING AND NOT WIN32)
|
||||
enable_testing()
|
||||
|
||||
add_executable(zlib_puff_testStatic pufftest.c puff.h)
|
||||
@@ -159,7 +159,7 @@ if(ZLIB_PUFF_BUILD_STATIC)
|
||||
${GCOV_EXECUTABLE}
|
||||
${llvm_option})
|
||||
endif(GCOV_EXECUTABLE)
|
||||
endif(ZLIB_PUFF_BUILD_TESTING)
|
||||
endif(ZLIB_PUFF_BUILD_TESTING AND NOT WIN32)
|
||||
endif(ZLIB_PUFF_BUILD_STATIC)
|
||||
|
||||
if(ZLIB_PUFF_INSTALL)
|
||||
@@ -168,7 +168,8 @@ if(ZLIB_PUFF_INSTALL)
|
||||
TARGETS zlib_puff_puff
|
||||
COMPONENT Runtime
|
||||
EXPORT puffSharedExport
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||
install(
|
||||
EXPORT puffSharedExport
|
||||
FILE puff-shared.cmake
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# if we are built from with zlib, use this path's)
|
||||
if(DEFINED ZLIB_BUILD_SHARED)
|
||||
if(DEFINED ZLIB_BUILD_PUFF)
|
||||
set(WORK_DIR ${zlib_BINARY_DIR})
|
||||
set(inst_setup zlib_puff_install)
|
||||
else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set(inst_setup zlib_install)
|
||||
else(DEFINED ZLIB_BUILD_PUFF)
|
||||
set(WORK_DIR ${puff_BINARY_DIR})
|
||||
set(inst_setup zlib_puff_install)
|
||||
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
|
||||
@@ -16,7 +16,7 @@ else(DEFINED ZLIB_BUILD_SHARED)
|
||||
set_tests_properties(zlib_puff_install
|
||||
PROPERTIES
|
||||
FIXTURES_SETUP zlib_puff_install)
|
||||
endif(DEFINED ZLIB_BUILD_SHARED)
|
||||
endif(DEFINED ZLIB_BUILD_PUFF)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
|
||||
|
||||
@@ -8,7 +8,8 @@ cmake_minimum_required(VERSION 3.12...3.31)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_ARGV3}
|
||||
INPUT_FILE "${CMAKE_ARGV4}/zeros.raw"
|
||||
RESULT_VARIABLE RESULT)
|
||||
RESULT_VARIABLE RESULT
|
||||
COMMAND_ECHO STDERR)
|
||||
|
||||
if(RESULT)
|
||||
message(FATAL_ERROR "Command exitited with: ${RESULT}")
|
||||
|
||||
Reference in New Issue
Block a user