Simplify CMake logic for some compiler options related to the XMP target
This commit is contained in:
parent
3b2372e906
commit
a478a74915
@ -32,20 +32,11 @@ set(XMPSRC src/ExpatAdapter.cpp
|
||||
include/XMP_Version.h
|
||||
)
|
||||
|
||||
FOREACH(_currentfile ${XMPSRC})
|
||||
# http://www.openguru.com/2009/04/cmake-detecting-platformoperating.html
|
||||
IF(NOT MSVC AND NOT CYGWIN AND NOT MSYS AND NOT MINGW)
|
||||
SET_SOURCE_FILES_PROPERTIES(${_currentfile} PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
if(NOT MSVC)
|
||||
# http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
|
||||
if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
|
||||
# 1123 - hide xmpsdk symbols
|
||||
add_definitions( -fvisibility=hidden -fvisibility-inlines-hidden )
|
||||
endif()
|
||||
endif()
|
||||
foreach(_currentfile ${XMPSRC})
|
||||
if(UNIX AND NOT CYGWIN)
|
||||
set_source_files_properties(${_currentfile} PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# We generate a CMake OBJECT LIBRARY (a bunch of object files)
|
||||
add_library( xmp_object OBJECT ${XMPSRC} )
|
||||
@ -64,6 +55,12 @@ if( EXIV2_ENABLE_LIBXMP )
|
||||
target_include_directories(xmp PUBLIC ${EXPAT_INCLUDE_DIR})
|
||||
target_include_directories(xmp PUBLIC ${CMAKE_SOURCE_DIR}/xmpsdk/include)
|
||||
|
||||
# http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
|
||||
if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
|
||||
# 1123 - hide xmpsdk symbols
|
||||
target_compile_definitions(xmp PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden )
|
||||
endif()
|
||||
|
||||
# 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel)
|
||||
install(TARGETS xmp
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user