CMake: test compiler version for Positioner

This commit is contained in:
Matteo Cypriani 2013-05-19 12:59:21 -04:00 committed by Matteo Cypriani
parent d4ef0cc306
commit 93a184f083
1 changed files with 21 additions and 1 deletions

View File

@ -87,6 +87,26 @@ else()
"OwlPS Listener can be built only for Linux systems")
endif()
add_subdirectory(owlps-positioner)
# OwlPS Positioner can be built only with GCC, and with a minimal
# version. CMAKE_CXX_COMPILER_VERSION is not guaranteed to be set,
# so we will test GCC's version number only if possible.
set(POSITIONER_MIN_GCC_VERSION 4.7)
if (CMAKE_COMPILER_IS_GNUCXX)
# Test the compiler version if we can
if (${CMAKE_CXX_COMPILER_VERSION})
if (${CMAKE_CXX_COMPILER_VERSION} VERSION_EQUAL ${POSITIONER_MIN_GCC_VERSION} OR
${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER ${POSITIONER_MIN_GCC_VERSION})
add_subdirectory(owlps-positioner)
else() # GCC's version is too low
message(WARNING
"OwlPS Positioner requires GCC >= ${POSITIONER_MIN_GCC_VERSION}")
endif()
else() # we couldn't get GCC's version, let's try to build anyway
add_subdirectory(owlps-positioner)
endif()
else() # we're not using GCC
message(WARNING
"OwlPS Positioner requires GCC (>= ${POSITIONER_MIN_GCC_VERSION})")
endif()
add_subdirectory(owlps-udp-to-http)