diff --git a/CMakeLists.txt b/CMakeLists.txt index 5493401..a630bba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)