Browse files

work around "broken" CMAKE_SYSTEM_PROCESSOR on MacOS

  • Loading branch information...
1 parent a3377e4 commit 11faecabaffe2f6b95b9dd9bbc39ab1a39c8423b @DerOrfa DerOrfa committed Dec 27, 2011
Showing with 15 additions and 4 deletions.
  1. +15 −4 CMakeLists.txt
View
19 CMakeLists.txt
@@ -49,11 +49,22 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wstrict-aliasing=2" )
############################################################
# compiler flags on 64Bit cpus
############################################################
-if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
+
+if(${APPLE})
+ if(${CMAKE_OSX_ARCHITECTURES})
+ set(PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+ else(${CMAKE_OSX_ARCHITECTURES})
+ set(PROCESSOR "x86_64")
+ endif(${CMAKE_OSX_ARCHITECTURES})
+else(${APPLE})
+ set(PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+endif(${APPLE})
+
+if("${PROCESSOR}" STREQUAL "x86_64")
message(STATUS "Compiling on x86_64. Using the '-fPIC' option in any case")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" )
-endif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" )
+endif("${PROCESSOR}" STREQUAL "x86_64" )
############################################################
# Logging options are global for all components in the tree
@@ -92,7 +103,7 @@ if (NOT GIT_REVISION)
if (GIT_COMMAND)
execute_process(COMMAND ${GIT_COMMAND} describe OUTPUT_VARIABLE OUT WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+-[^-]+$" GIT_REVISION "${OUT}") #@todo wont work with more complex revisions/modified sources
- set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${GIT_REVISION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_BUILD_TYPE})
+ set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${GIT_REVISION}-${CMAKE_SYSTEM_NAME}-${PROCESSOR}-${CMAKE_BUILD_TYPE})
else(GIT_COMMAND)
message(STATUS "git not found")
endif (GIT_COMMAND)
@@ -132,7 +143,7 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${${CMAKE_PROJECT_NAME}_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${${CMAKE_PROJECT_NAME}_VERSION_PATCH})
-SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${ISIS_CORE_REV_STRING}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_BUILD_TYPE})
+SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${ISIS_CORE_REV_STRING}-${CMAKE_SYSTEM_NAME}-${PROCESSOR}-${CMAKE_BUILD_TYPE})
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${${CMAKE_PROJECT_NAME}_VERSION_MAJOR}.${${CMAKE_PROJECT_NAME}_VERSION_MINOR}")
INCLUDE(CPack)

0 comments on commit 11faeca

Please sign in to comment.