mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-26 23:01:04 +08:00
Problem: build system does not play nicely as a cmake subproject #3196
Solution: avoid exporting targets and installing files if neither BUILD_SHARED nor BUILD_STATIC is set
This commit is contained in:
parent
f4aad4d1d2
commit
458f41e349
@ -1219,7 +1219,7 @@ endif ()
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# installer
|
# installer
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC AND (BUILD_SHARED OR BUILD_STATIC))
|
||||||
install (TARGETS ${target_outputs}
|
install (TARGETS ${target_outputs}
|
||||||
EXPORT ${PROJECT_NAME}-targets
|
EXPORT ${PROJECT_NAME}-targets
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
@ -1238,7 +1238,7 @@ if (MSVC)
|
|||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
COMPONENT Runtime)
|
COMPONENT Runtime)
|
||||||
endif ()
|
endif ()
|
||||||
else ()
|
elseif (BUILD_SHARED OR BUILD_STATIC)
|
||||||
install (TARGETS ${target_outputs}
|
install (TARGETS ${target_outputs}
|
||||||
EXPORT ${PROJECT_NAME}-targets
|
EXPORT ${PROJECT_NAME}-targets
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
@ -1281,7 +1281,7 @@ else()
|
|||||||
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for ZeroMQConfig.cmake")
|
set(ZEROMQ_CMAKECONFIG_INSTALL_DIR "share/cmake/${PROJECT_NAME}" CACHE STRING "install path for ZeroMQConfig.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT CMAKE_VERSION VERSION_LESS 3.0)
|
if ((NOT CMAKE_VERSION VERSION_LESS 3.0) AND (BUILD_SHARED OR BUILD_STATIC))
|
||||||
export(EXPORT ${PROJECT_NAME}-targets
|
export(EXPORT ${PROJECT_NAME}-targets
|
||||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
|
||||||
endif()
|
endif()
|
||||||
@ -1291,12 +1291,14 @@ configure_package_config_file(builds/cmake/${PROJECT_NAME}Config.cmake.in
|
|||||||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
||||||
VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}
|
VERSION ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}
|
||||||
COMPATIBILITY AnyNewerVersion)
|
COMPATIBILITY AnyNewerVersion)
|
||||||
install(EXPORT ${PROJECT_NAME}-targets
|
if (BUILD_SHARED OR BUILD_STATIC)
|
||||||
FILE ${PROJECT_NAME}Targets.cmake
|
install(EXPORT ${PROJECT_NAME}-targets
|
||||||
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
FILE ${PROJECT_NAME}Targets.cmake
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||||
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
|
||||||
|
DESTINATION ${ZEROMQ_CMAKECONFIG_INSTALL_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
option(ENABLE_CPACK "Enables cpack rules" ON)
|
option(ENABLE_CPACK "Enables cpack rules" ON)
|
||||||
if (MSVC AND ENABLE_CPACK)
|
if (MSVC AND ENABLE_CPACK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user