minor change to support cmake2.8 builds

Reduce cmake version requirement to 2.8.12 (ubuntu trusty),
and conditionalize export() in PocoMacros to support 2.8 syntax.
This commit is contained in:
Josh Blum 2015-12-14 17:32:18 -08:00
parent 910e2f3f29
commit df8b868da6
2 changed files with 14 additions and 5 deletions

View File

@ -6,7 +6,7 @@
# ENABLE_{COMPONENT}
# ENABLE_TESTS
cmake_minimum_required(VERSION 3.0.0)
cmake_minimum_required(VERSION 2.8.12)
project(Poco)

View File

@ -202,10 +202,19 @@ write_basic_package_version_file(
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
export(EXPORT "${target_name}Targets"
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
)
if ("${CMAKE_VERSION}" VERSION_LESS "3.0.0")
if (NOT EXISTS "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake")
export(TARGETS "${target_name}" APPEND
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
)
endif ()
else ()
export(EXPORT "${target_name}Targets"
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
)
endif ()
configure_file("cmake/Poco${target_name}Config.cmake"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
@ONLY