From d6f61233cec47fb4f8c730879532597af9f61be5 Mon Sep 17 00:00:00 2001 From: Karl Goetz Date: Mon, 15 Dec 2014 18:29:57 +1100 Subject: [PATCH 1/2] Change test for GIT_VERSION_CMD an xcode check Following the work I did on GH ' Remove special casing on GIT_VERSION_CMD #33 ' I've done more experiements and test rebuilds. I've found that the test should actually be to find out if we are working with Xcode specifically as using the gnu build chain is working correctly with the code in the 'else' clause - the codepath i tested before doing my original changes - but doesn't work using the special 'apple' version. This change should mean both methods of building work correctly. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e45ad3d..899ea733 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -242,7 +242,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) ENDIF() ENDIF() - IF(APPLE) + IF(CMAKE_GENERATOR STREQUAL Xcode) SET(GIT_VERSION_CMD "-DGITVERSION='\\\\'${GIT_LIVE_REV_CMD}\\\\''") ELSE() SET(GIT_VERSION_CMD "-DGITVERSION='\\\"${GIT_LIVE_REV_CMD}\\\"'") From 56a5cc6f980b6774a536005a382f9af6ebfce0e8 Mon Sep 17 00:00:00 2001 From: Karl Goetz Date: Mon, 15 Dec 2014 20:31:24 +1100 Subject: [PATCH 2/2] Don't strip binaries when building through Xcode Without this change building the Release version results in an error (which claims to be a warning) due to using -s which is obsolete. This removes -s when building through xcode - gnumake and other platforms are (presumably) unaffected. --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e45ad3d..24b87360 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,14 +196,23 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW) # Release compiler flags SET(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS_RELEASE} -O3 ") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s") ## Strip binary + IF(CMAKE_GENERATOR STREQUAL Xcode) + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") ## Strip binary + ELSE() + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s") ## Strip binary + ENDIF() # Release with debug info compiler flags SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3 ") # Release minimum size compiler flags SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 ${CMAKE_CXX_FLAGS_MINSIZEREL} -O3 ") - SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s") ## Strip binary + SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}") ## Strip binary + IF(CMAKE_GENERATOR STREQUAL Xcode) + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") ## Strip binary + ELSE() + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s") ## Strip binary + ENDIF() # Get the git revision info for the binary SET(HAS_GIT "FALSE")