detect 64bit processors and add -fPIC
authorDiane Trout <diane@caltech.edu>
Sat, 3 Feb 2007 01:55:46 +0000 (01:55 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 3 Feb 2007 01:55:46 +0000 (01:55 +0000)
this is an intermediate solution as I probably can use ADD_DEFINES()
to add the command line options for the compiler instead of fiddingly
with CMAKE variables

Props to Brandon for finding the solution in an openwengo patch.
http://dev.openwengo.org/trac/openwengo/trac.cgi/changeset/9139
Long Live CMake!

makelib/Platform.cmake

index 87d81640907d421d0a4060b9cf51621eee21cb0c..ee55fec828372bc7135e3ceb92e65f713ea2187d 100644 (file)
@@ -16,14 +16,16 @@ ELSE(PYTHONINTERP_FOUND)
   SET(PYTHON_LINKFORSTATIC "")               
 ENDIF(PYTHONINTERP_FOUND)
 
-MACRO(GET_MUSSA_COMPILE_FLAGS return)
- SET(return "") 
- IF(APPLE)
-   SET(${return}
-         ${${return}} 
-         "-isysroot /Developer/SDKS/MacOSX10.4u.sdk -arch ppc -arch i386 -I/usr/local/include"
-      )
- ENDIF(APPLE)
+MACRO(GET_MUSSA_COMPILE_FLAGS)
+  SET(${return} "")
+  IF(APPLE)
+    ADD_DEFINITIONS("-isysroot /Developer/SDKS/MacOSX10.4u.sdk -arch ppc -arch i386 -I/usr/local/include")
+  ENDIF(APPLE)
+  IF (UNIX AND NOT WIN32)
+    IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+      ADD_DEFINITIONS("-fPIC")
+    ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+  ENDIF(UNIX AND NOT WIN32)
 ENDMACRO(GET_MUSSA_COMPILE_FLAGS)
 
 MACRO(GET_MUSSA_LINK_FLAGS return)