Fix cmakeBuild.cmd --static to use zlibstatic.lib
This commit is contained in:
parent
e063a8eea2
commit
22aaff8682
@ -249,9 +249,8 @@ if defined _TEST_ if NOT EXIST "%_BASH_%" (
|
||||
|
||||
if NOT DEFINED _GENERATOR_ set "_GENERATOR_=%VS_CMAKE%"
|
||||
if /I "%_GENERATOR_%" == "NMake" set "_GENERATOR_=NMake Makefiles"
|
||||
if /I "%_SHARED_%" == "0" set _LINK_="-DCMAKE_LINK=static"
|
||||
|
||||
rem Fix up for openssl/vs 2017
|
||||
rem Fixup for openssl/vs 2017
|
||||
if /I "%_OPENSSL_%" == "openssl-1.0.1p" if /I "%_VS_%" == 2017 set _OPENSSL_ = openssl-1.1.0f
|
||||
|
||||
call:cltest
|
||||
@ -263,6 +262,12 @@ IF DEFINED _PAUSE_ pause
|
||||
echo ---------- ZLIB building with cmake ------------------
|
||||
call:buildLib %_ZLIB_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_%
|
||||
|
||||
rem Fixup ZLIB. This should be possible inside CMake
|
||||
if /I "%_MODE_%" == "static" (
|
||||
if EXIST "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstaticd.lib" copy/y "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstaticd.lib" "%_LIBPATH_%\zlibd.lib"
|
||||
if EXIST "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstatic.lib" copy/y "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstatic.lib" "%_LIBPATH_%\zlib.lib"
|
||||
)
|
||||
|
||||
echo ---------- EXPAT building with cmake -----------------
|
||||
set "_TARGET_=--target expat"
|
||||
if /I "%_SHARED_%" == "0" (
|
||||
@ -341,7 +346,7 @@ pushd "%EXIV_B%"
|
||||
set BUILD_SAMPLES=OFF
|
||||
if DEFINED _SAMPLES_ set BUILD_SAMPLES=ON
|
||||
|
||||
call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %_LINK_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% ^
|
||||
call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% ^
|
||||
-DEXIV2_ENABLE_NLS=%_NLS_% -DEXIV2_BUILD_SAMPLES=%BUILD_SAMPLES% ^
|
||||
-DEXIV2_ENABLE_WIN_UNICODE=%_UNICODE_% -DBUILD_SHARED_LIBS=%ENABLE_SHARED% ^
|
||||
-DEXIV2_ENABLE_DYNAMIC_RUNTIME=%ENABLE_DYNAMIC% ^
|
||||
@ -429,7 +434,7 @@ IF NOT EXIST "%LOB%" 7z x "%LOB_TAR%"
|
||||
if NOT EXIST "%LOB_B%" mkdir "%LOB_B%"
|
||||
|
||||
pushd "%LOB_B%"
|
||||
call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %_LINK_% %* ..\..\%LOB%
|
||||
call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %* ..\..\%LOB%
|
||||
IF errorlevel 1 (
|
||||
echo "*** cmake errors in %LOB% ***"
|
||||
popd
|
||||
|
||||
@ -43,6 +43,10 @@ endforeach()
|
||||
|
||||
###################################
|
||||
|
||||
if (MSVC)
|
||||
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
|
||||
add_executable( metacopy metacopy.cpp ../src/utils.cpp)
|
||||
list(APPEND APPLICATIONS metacopy)
|
||||
target_link_libraries( metacopy PRIVATE exiv2lib)
|
||||
@ -85,18 +89,21 @@ list(APPEND APPLICATIONS conntest)
|
||||
# ******************************************************************************
|
||||
# remotetest application
|
||||
add_executable(remotetest remotetest.cpp)
|
||||
target_link_libraries(remotetest exiv2lib)
|
||||
target_link_libraries(remotetest PRIVATE exiv2lib)
|
||||
list(APPEND APPLICATIONS remotetest)
|
||||
|
||||
# ******************************************************************************
|
||||
# set compiler -DEXV_HAVE_DLL when linking exiv2 dll
|
||||
foreach(application ${APPLICATIONS})
|
||||
message(STATUS "sample: ${application}")
|
||||
if ( BUILD_SHARED_LIBS )
|
||||
target_compile_definitions(${application} PRIVATE EXV_HAVE_DLL )
|
||||
endif()
|
||||
if( EXIV2_ENABLE_PNG )
|
||||
target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} )
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
# ******************************************************************************
|
||||
# Man page
|
||||
install( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
|
||||
|
||||
@ -83,18 +83,14 @@ endif()
|
||||
if ( MSVC )
|
||||
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)
|
||||
|
||||
if( EXIV2_ENABLE_PNG )
|
||||
target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} )
|
||||
endif()
|
||||
|
||||
source_group("Header Files" FILES ${LIBEXIV2_HDR} )
|
||||
source_group("Header Files" FILES ${LIBCURL_HDR} )
|
||||
source_group("Header Files" FILES ${SSH_HDR} )
|
||||
target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${SSH_LIBRARIES})
|
||||
target_link_libraries( exiv2lib PRIVATE ${CURL_LIBRARIES} ${SSH_LIBRARIES})
|
||||
else()
|
||||
# TODO: Check if this is really needed.
|
||||
if ( UNIX AND NOT FREEBSD )
|
||||
target_link_libraries( exiv2lib PRIVATE dl) # -ldl = dynamic loader used by src/version.cpp
|
||||
target_link_libraries( exiv2lib PRIVATE ${CMAKE_DL_LIBS}) # -ldl = dynamic loader used by src/version.cpp
|
||||
endif()
|
||||
target_link_libraries( exiv2lib PRIVATE Threads::Threads)
|
||||
target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES} ${SSH_LIBRARIES})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user