1 SET(CMAKE_C_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "" )
2 SET(CMAKE_CXX_CREATE_SHARED_LIBRARY_FORBIDDEN_FLAGS "")
4 # Setup for Leopard Compatibility
5 EXEC_PROGRAM(sw_vers ARGS -productVersion OUTPUT_VARIABLE _OSX_VERSION)
6 # MESSAGE (STATUS "_OSX_VERSION: ${_OSX_VERSION}")
7 IF ( _OSX_VERSION MATCHES "^10.4" )
8 #IF(CMAKE_COMPILER_IS_GNUCC)
9 SET (CMAKE_C_FLAGS_INIT "")
10 SET (CMAKE_C_FLAGS_DEBUG_INIT "-gdwarf-2")
11 SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
12 SET (CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
13 SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")
14 SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
15 SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
16 # ENDIF(CMAKE_COMPILER_IS_GNUCC)
18 # IF(CMAKE_COMPILER_IS_GNUCXX)
19 SET (CMAKE_CXX_FLAGS_INIT "")
20 SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-gdwarf-2")
21 SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
22 SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
23 SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -gdwarf-2")
24 SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
25 SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
26 # ENDIF(CMAKE_COMPILER_IS_GNUCXX)
27 ENDIF ( _OSX_VERSION MATCHES "^10.4" )
30 SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
31 SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
32 SET(CMAKE_SHARED_MODULE_PREFIX "lib")
33 SET(CMAKE_SHARED_MODULE_SUFFIX ".so")
34 SET(CMAKE_MODULE_EXISTS 1)
36 SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names")
37 SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names")
38 SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
39 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
40 SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
41 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
44 # setup for universal binaries if sysroot exists
45 IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
46 # set the sysroot to be used if CMAKE_OSX_ARCHITECTURES
47 # has more than one value
48 SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk CACHE STRING
49 "isysroot used for universal binary support")
50 # set _CMAKE_OSX_MACHINE to umame -m
51 EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
53 # check for environment variable CMAKE_OSX_ARCHITECTURES
55 IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
56 SET(_CMAKE_OSX_MACHINE "$ENV{CMAKE_OSX_ARCHITECTURES}")
57 ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
58 # now put _CMAKE_OSX_MACHINE into the cache
59 SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}
60 CACHE STRING "Build architectures for OSX")
61 ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
64 IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
65 SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
66 "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress")
67 ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
70 # Enable shared library versioning. This flag is not actually referenced
71 # but the fact that the setting exists will cause the generators to support
73 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
74 SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
75 SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name")
78 # Xcode does not support -isystem yet.
80 SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
81 SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
84 SET(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
86 SET(CMAKE_C_CREATE_SHARED_LIBRARY
87 "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
88 SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
89 "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
90 SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
91 "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> -install_name <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
93 SET(CMAKE_CXX_CREATE_SHARED_MODULE
94 "<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
96 SET(CMAKE_C_CREATE_SHARED_MODULE
97 "<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
99 SET(CMAKE_Fortran_CREATE_SHARED_MODULE
100 "<CMAKE_Fortran_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
103 # We can use $ENV{INTEL_LICENSE_FILE} to try and get at the installation location for ICC.
104 # We also need to consider to use cce (which is the 64bit compiler) and not JUST the 32bit compiler.
105 # I have no idea what the best way to do that would be.
108 # default to searching for frameworks first
109 SET(CMAKE_FIND_FRAMEWORK FIRST)
110 # set up the default search directories for frameworks
111 SET(CMAKE_SYSTEM_FRAMEWORK_PATH
114 /Network/Library/Frameworks
115 /System/Library/Frameworks)
117 # default to searching for application bundles first
118 SET(CMAKE_FIND_APPBUNDLE FIRST)
119 # set up the default search directories for application bundles
120 SET(CMAKE_SYSTEM_APPBUNDLE_PATH
123 /Developer/Applications)
125 INCLUDE(Platform/UnixPaths)
126 SET(CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_SYSTEM_INCLUDE_PATH} /sw/include)
127 SET(CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_SYSTEM_LIBRARY_PATH} /sw/lib)