Replace EXIV2_ENABLE_SHARED by BUILD_SHARED_LIBS. Also use EXV_HAVE_DLL only for the exiv2lib target

This commit is contained in:
Luis Díaz Más 2017-08-23 21:03:58 +02:00 committed by Luis Diaz Mas
parent 1bd985a287
commit 31a51fda8a
10 changed files with 16 additions and 19 deletions

View File

@ -30,7 +30,7 @@ set( GENERIC_LIB_VERSION "26.0.0" )
set( GENERIC_LIB_SOVERSION "26" )
# options and their default values
option( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )

View File

@ -86,7 +86,7 @@ Usual CMake options :
Specific Exiv2 options :
-DEXIV2_ENABLE_SHARED : Build exiv2 as a shared library (dll). [default=on ]
-DBUILD_SHARED_LIBS : CMake variable controlling whether exiv2lib is build as a shared library (dll). [default=on]
-DEXIV2_ENABLE_XMP : Build with XMP metadata support. [default=on ]
-DEXIV2_ENABLE_LIBXMP : Build a static convenience Library for XMP. [default=on ]
-DEXIV2_ENABLE_PNG : Build with png support (requires libz). [default=on ]

View File

@ -17,7 +17,7 @@ cd build.cmake
cmake -G "$MAKEFILES_TYPE" . \
-DCMAKE_BUILD_TYPE=debugfull \
-DCMAKE_INSTALL_PREFIX=/usr \
-DEXIV2_ENABLE_SHARED=ON \
-DBUILD_SHARED_LIBS=ON \
-DEXIV2_ENABLE_XMP=ON \
-DEXIV2_ENABLE_LIBXMP=ON \
-DEXIV2_ENABLE_PNG=ON \

View File

@ -60,7 +60,7 @@ cmake -G "$MAKEFILES_TYPE" . \
-DCMAKE_INSTALL_NAME_DIR=${INSTALL_PREFIX}/lib \
-DCMAKE_SYSTEM_PREFIX_PATH="${INSTALL_PREFIX};/usr" \
-DCMAKE_MODULE_PATH="${INSTALL_PREFIX}/share/cmake/modules" \
-DEXIV2_ENABLE_SHARED=ON \
-DBUILD_SHARED_LIBS=ON \
-DEXIV2_ENABLE_XMP=ON \
-DEXIV2_ENABLE_LIBXMP=ON \
-DEXIV2_ENABLE_PNG=ON \

View File

@ -31,13 +31,6 @@
#
# ConfigureChecks for exiv2
if( EXIV2_ENABLE_SHARED )
add_definitions( -DEXV_HAVE_DLL )
set( STATIC_FLAG SHARED )
else()
set( STATIC_FLAG STATIC )
endif()
if( EXIV2_ENABLE_COMMERCIAL )
add_definitions( -DEXV_COMMERCIAL_VERSION )
endif()

View File

@ -23,7 +23,7 @@ if(MSVC)
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if ( ${EXIV2_ENABLE_SHARED} OR ${EXIV2_ENABLE_DYNAMIC_RUNTIME})
if ( ${BUILD_SHARED_LIBS} OR ${EXIV2_ENABLE_DYNAMIC_RUNTIME})
message(STATUS "MSVC -> forcing use of dynamically-linked runtime." )
foreach(variable ${variables})
if(${variable} MATCHES "/MT")
@ -51,7 +51,7 @@ if(MSVC)
endforeach()
# don't link msvcrt for .exe which use shared libraries (use default libcmt)
if ( NOT ${EXIV2_ENABLE_SHARED} AND NOT ${EXIV2_ENABLE_DYNAMIC_RUNTIME})
if ( NOT ${BUILD_SHARED_LIBS} AND NOT ${EXIV2_ENABLE_DYNAMIC_RUNTIME})
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/NODEFAULTLIB:MSVCRTD")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/NODEFAULTLIB:MSVCRT")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/NODEFAULTLIB:MSVCRT")

View File

@ -19,7 +19,7 @@ message( STATUS "Compiler info: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER})
message( STATUS "------------------------------------------------------------------" )
message( STATUS "${PACKAGE_STRING} configure results <${PACKAGE_URL}>" )
OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND )
OptionOutput( "Building shared library: " EXIV2_ENABLE_SHARED )
OptionOutput( "Building shared library: " BUILD_SHARED_LIBS )
OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP )
OptionOutput( "Building static libxmp: " EXIV2_ENABLE_LIBXMP )
OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )

View File

@ -119,7 +119,7 @@ How to use this
cd temp\exiv2
cmake -G "Visual Studio 8 2005 Win64" "-DCMAKE_INSTALL_PREFIX=..\..\dist" ^
"-DCMAKE_LIBRARY_PATH=..\..\dist\lib" "-DCMAKE_INCLUDE_PATH=..\..\dist\include" ^
-DEXIV2_ENABLE_SHARED=ON ^
-DBUILD_SHARED_LIBS=ON ^
..\..\..\<exiv2dir>
cmake --build . --config Release
cmake --build . --config Release --target install
@ -170,7 +170,7 @@ How to use this
C:\cygwin64\home\rmills\gnu\exiv2\build>cd ..\trunk
C:\cygwin64\home\rmills\gnu\exiv2\trunk>grep OPTION CMakeLists.txt
OPTION( EXIV2_ENABLE_SHARED "Build exiv2 as a shared library (dll)" ON )
OPTION( BUILD_SHARED_LIBS "Build exiv2 as a shared library (dll)" ON )
OPTION( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
OPTION( EXIV2_ENABLE_VIDEO "Build with video support" OFF )

View File

@ -292,7 +292,7 @@ pushd "%EXIV_B%"
call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %_LINK_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% ^
-DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_BUILD_SAMPLES=%BUILD_SAMPLES% ^
-DEXIV2_ENABLE_WIN_UNICODE=OFF -DEXIV2_ENABLE_SHARED=%ENABLE_SHARED% ^
-DEXIV2_ENABLE_WIN_UNICODE=OFF -DBUILD_SHARED_LIBS=%ENABLE_SHARED% ^
-DEXIV2_ENABLE_DYNAMIC_RUNTIME=%ENABLE_DYNAMIC% ^
%ENABLE_WEBREADY% %ENABLE_CURL% %ENABLE_LIBSSH% %ENABLE_VIDEO% ^
"%_EXIV2_%"

View File

@ -166,10 +166,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
# exiv2lib library
if( EXIV2_ENABLE_XMP AND NOT EXIV2_ENABLE_LIBXMP )
add_library( exiv2lib ${STATIC_FLAG} ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR} $<TARGET_OBJECTS:xmp_object>)
add_library( exiv2lib ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR} $<TARGET_OBJECTS:xmp_object>)
target_link_libraries(exiv2lib PUBLIC ${EXPAT_LIBRARIES})
else()
add_library( exiv2lib ${STATIC_FLAG} ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR})
add_library( exiv2lib ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR})
endif()
set_target_properties( exiv2lib PROPERTIES
@ -181,6 +181,10 @@ set_target_properties( exiv2lib PROPERTIES
target_compile_definitions(exiv2lib PRIVATE EXV_LOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}" )
if ( ${BUILD_SHARED_LIBS} )
target_compile_definitions(exiv2lib PUBLIC EXV_HAVE_DLL)
endif()
if ( UNIX AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
set (FREEBSD 1)
endif()