OSX/cmake: workaround for getting right LC_VERSION_MIN_MACOSX with makefiles
authorJens Verwiebe <info@jensverwiebe.de>
Thu, 8 Nov 2012 12:57:01 +0000 (12:57 +0000)
committerJens Verwiebe <info@jensverwiebe.de>
Thu, 8 Nov 2012 12:57:01 +0000 (12:57 +0000)
CMakeLists.txt

index d8ae92d..7da2da4 100644 (file)
@@ -312,6 +312,10 @@ if(APPLE)
                execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
                string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
                unset(XCODE_VERS_BUILD_NR)
+               # force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
+               set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )
+               set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )
+               add_definitions ("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
        endif()
        
        message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})