diff --git a/CMakeLists.txt b/CMakeLists.txt index b27437b6..15f137b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,39 +19,21 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) include (SetPaths.cmake) -############################################################################### -# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4 -# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support. IF(APPLE) - # These are just defaults/recommendations, but how we want to build - # out of the box. But the user needs to be able to change these options. - # So we must only set the values the first time CMake is run, or we - # will overwrite any changes the user sets. - # FORCE is used because the options are not reflected in the UI otherwise. - IF(NOT "${OPENTHREADS_CONFIG_HAS_BEEN_RUN_BEFORE}") - # This is really fragile, but CMake doesn't provide the OS system - # version information we need. (Darwin versions can be changed - # independently of OS X versions.) - # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically. - IF(EXISTS /Developer/SDKs/10.5.sdk) -#Qt does not support ppc64 and x86_64 -# SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) + IF(NOT ZINT_HAS_BEEN_RUN_BEFORE) + IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) - ELSE(EXISTS /Developer/SDKs/10.5.sdk) - IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) -#Qt does not support ppc64 and x86_64 -# SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) + ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) - ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) - # No Universal Binary support - ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) - ENDIF(EXISTS /Developer/SDKs/10.5.sdk) - ENDIF(NOT "${OPENTHREADS_CONFIG_HAS_BEEN_RUN_BEFORE}") + ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) + ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + message("Build architectures for OSX:${CMAKE_OSX_ARCHITECTURES}") + ENDIF(NOT ZINT_HAS_BEEN_RUN_BEFORE) ENDIF(APPLE) - add_subdirectory(backend) add_subdirectory(frontend) @@ -60,7 +42,7 @@ if (QT4_FOUND) set( QT_USE_QTGUI TRUE ) include( ${QT_USE_FILE} ) include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) @@ -77,3 +59,11 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") install(FILES cmake/modules/FindZint.cmake DESTINATION ${CMAKE_ROOT}/Modules COMPONENT Devel) + +# This needs to be run very last so other parts of the scripts can take +# advantage of this. +IF(NOT ZINT_HAS_BEEN_RUN_BEFORE) + SET(ZINT_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before") +ENDIF(NOT ZINT_HAS_BEEN_RUN_BEFORE) + +