From 0692323fe0f0bbbb5ba325e21d0f155717436f84 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 22 Oct 2002 15:04:52 -0400 Subject: *** empty log message *** --- Modules/CMakeDetermineCCompiler.cmake | 6 ++++ Modules/CMakeSystemSpecificInformation.cmake | 45 +++++++++++++++++++++++++--- Modules/CYGWIN.cmake | 4 +++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 Modules/CYGWIN.cmake diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 100412a..c1fc85c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -3,3 +3,9 @@ # loading this file to force a compiler. FIND_PROGRAM(CMAKE_C_COMPILER NAMES $ENV{CC} gcc cc cl bcc PATHS /bin /usr/bin /usr/local/bin ) + + +# to check for is gnu we need to compile this: +# #ifdef __GNUC__ +# yes; +# #endif diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 1615d9f..3fcaf5e 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -8,11 +8,25 @@ # 1. set default values that will work for most system -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "${CMAKE_CXX_COMPILE} ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS} ${CMAKE_CXX_LINK_SHARED_OUT_FLAG} ") +SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic +SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") # -pic +# for gnu compiler always + +SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "") # -shared +SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so +SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, or some flag that an exe needs to use a shared lib +SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "") # -rpath +SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty -SET(CMAKE_CXX_CREATE_AR_LIBRARY - "${CMAKE_AR} ${CMAKE_AR_FLAGS} ") +IF(CMAKE_COMPILER_IS_GNUGXX) + SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic + SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic +ENDIF(CMAKE_COMPILER_IS_GNUGXX) + + +SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL + "If set, runtime paths are not added when using shared libraries.") # 2. now include SystemName.cmake file to set the system specific information SET(CMAKE_SYSTEM_INFO_FILE ${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}.cmake) @@ -25,6 +39,29 @@ ELSE(EXISTS ${CMAKE_SYSTEM_INFO_FILE}) ENDIF(EXISTS ${CMAKE_SYSTEM_INFO_FILE}) + +# Set up default values for things that have not been set either +# in SYSTEM.cmake or SYSTEM-compiler.cmake + +IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) + SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "${CMAKE_CXX_COMPILE} ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS} " + "${CMAKE_CXX_LINK_SHARED_OUT_FLAG} ") +ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) + + +IF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY) + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + "${CMAKE_CXX_AR} ${CMAKE_AR_FLAGS} ") +ENDIF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY) + + +IF(NOT CMAKE_CXX_COMPILE) + SET(CMAKE_CXX_COMPILE + "${CMAKE_CXX_COMPILER} -o ${CMAKE_CXX_FLAGS} -c ") +ENDIF(NOT CMAKE_CXX_COMPILE) + + # 3. include optional systemname-compiler.cmake files IF(CMAKE_C_COMPILER) INCLUDE(${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER}.cmake OPTIONAL) diff --git a/Modules/CYGWIN.cmake b/Modules/CYGWIN.cmake new file mode 100644 index 0000000..6d18a73 --- /dev/null +++ b/Modules/CYGWIN.cmake @@ -0,0 +1,4 @@ +SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "-shared") +SET(CMAKE_DL_LIBS "-lgdi32" ) +SET(CMAKE_SHARED_LIBRARY_PREFIX "") +SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -- cgit v0.12