diff -r 6d6b5b529890 -r 90f445317e8a CMakeLists.txt --- a/CMakeLists.txt Thu Feb 28 23:02:12 2013 +0100 +++ b/CMakeLists.txt Thu Feb 28 23:05:07 2013 +0100 @@ -2,11 +2,19 @@ #initialise cmake environment cmake_minimum_required(VERSION 2.6.0) +if(CMAKE_VERSION VERSION_LESS "2.8") + set(WARNING "WARNING: ") + set(allow_parse_args FALSE) +else() + set(WARNING WARNING) + set(allow_parse_args TRUE) +endif() foreach(hwpolicy CMP0003 CMP0012 CMP0017) if(POLICY ${hwpolicy}) cmake_policy(SET ${hwpolicy} NEW) endif() endforeach() + #use available modules, fallback to ours if not present (CMP0017 helps) set(CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") @@ -53,7 +61,7 @@ message(STATUS "Building revision ${revision_number} from hash ${revision_hash} ${HGCHANGED}") if(HGCHANGED) - MESSAGE(WARNING "Notice: you have uncommitted changes in your repository") + MESSAGE(${WARNING} "Notice: you have uncommitted changes in your repository") endif() set(version_suffix "-${revision_number}${HGCHANGED}") endif() @@ -114,7 +122,7 @@ if(NOT minimum_macosx_version) message(FATAL_ERROR "sw_vers not found! Need explicit MACOSX_DEPLOYMENT_TARGET variable set") else() - message(WARNING "sw_vers not found! Fallback to MACOSX_DEPLOYMENT_TARGET variable") + message(${WARNING} "sw_vers not found! Fallback to MACOSX_DEPLOYMENT_TARGET variable") set(current_macosx_version ${minimum_macosx_version}) endif() endif() @@ -171,7 +179,7 @@ #silly libav that always brings in VideoDecoderAcceleration, avaible only from 10.6.3 if(NOT NOVIDEOREC AND ${minimum_macosx_version} VERSION_LESS "10.6") - set(WARNING "Video recording support before OS X 10.6 is experimental") + set(${WARNING} "Video recording support before OS X 10.6 is experimental") endif() endif(APPLE) @@ -205,9 +213,8 @@ #parse additional parameters if(FPFLAGS OR GHFLAGS) - set(cmake_version "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}") - if(cmake_version VERSION_LESS "2.8") - message(WARNING "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8") + if(${allow_parse_args}) + message(${WARNING} "FPFLAGS and GHFLAGS are available only when using CMake >= 2.8") else() separate_arguments(fpflags_parsed UNIX_COMMAND ${FPFLAGS}) separate_arguments(ghflags_parsed UNIX_COMMAND ${GHFLAGS}) @@ -257,7 +264,7 @@ add_subdirectory(gameServer) message(STATUS "Found GHC: ${ghc_executable}") else() - message(WARNING "Could NOT find GHC, server will not be built") + message(${WARNING} "Could NOT find GHC, server will not be built") set(HAVE_NETSERVER false) endif() else()