summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCCompiler.cmake.in4
-rw-r--r--Modules/CMakeDefaultMakeRuleVariables.cmake69
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake11
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake5
-rw-r--r--Modules/CMakeDetermineSystem.cmake4
-rw-r--r--Modules/CMakePrintSystemInformation.cmake31
-rw-r--r--Modules/CMakeSystem.cmake.in3
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake76
-rw-r--r--Modules/CYGWIN.cmake3
9 files changed, 172 insertions, 34 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
new file mode 100644
index 0000000..86bcd0e
--- /dev/null
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -0,0 +1,4 @@
+SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_COMPILER_IS_GNUGCC @CMAKE_COMPILER_IS_GNUGCC@)
diff --git a/Modules/CMakeDefaultMakeRuleVariables.cmake b/Modules/CMakeDefaultMakeRuleVariables.cmake
new file mode 100644
index 0000000..d0134fc
--- /dev/null
+++ b/Modules/CMakeDefaultMakeRuleVariables.cmake
@@ -0,0 +1,69 @@
+# this file contains rule variables that tell cmake how to
+# do things like build a .o file, create a shared or static library
+#
+
+# create a shared C++ librar
+IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
+ "${CMAKE_CXX_COMPILER} ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS} "
+ "${CMAKE_CXX_LINK_SHARED_OUT_FLAG} <TARGET> <OBJECTS>")
+ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
+
+# create a c++ shared module
+IF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
+ SET(CMAKE_CXX_CREATE_SHARED_MODULE
+ "${CMAKE_CXX_COMPILER} ${CMAKE_SHARED_MODULE_CREATE_FLAGS} "
+ "${CMAKE_CXX_LINK_SHARED_OUT_FLAG} <TARGET> <OBJECTS>")
+ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
+
+# create a C shared library
+IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
+ SET(CMAKE_C_CREATE_SHARED_LIBRARY
+ "${CMAKE_C_COMPILER} ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS} "
+ "${CMAKE_C_LINK_SHARED_OUT_FLAG} <TARGET> <OBJECTS>")
+ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
+
+# create a C shared module
+IF(NOT CMAKE_C_CREATE_SHARED_MODULE)
+ SET(CMAKE_C_CREATE_SHARED_MODULE
+ "${CMAKE_C_COMPILER} ${CMAKE_SHARED_MODULE_CREATE_FLAGS} "
+ "${CMAKE_C_LINK_SHARED_OUT_FLAG} <TARGET> <OBJECTS>")
+ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE)
+
+# create a C++ static library
+IF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY)
+ SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
+ "${CMAKE_CXX_AR} cr <TARGET> <OBJECTS> "
+ "${CMAKE_RANLIB} <TARGET> ")
+ENDIF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY)
+
+# create a C static library
+IF(NOT CMAKE_C_CREATE_STATIC_LIBRARY)
+ SET(CMAKE_C_CREATE_STATIC_LIBRARY
+ "${CMAKE_AR} cr <TARGET> <OBJECTS> "
+ "${CMAKE_RANLIB} <TARGET> ")
+ENDIF(NOT CMAKE_C_CREATE_STATIC_LIBRARY)
+
+# compile a C++ file into an object file
+IF(NOT CMAKE_CXX_COMPILE_OBJECT)
+ SET(CMAKE_CXX_COMPILE_OBJECT
+ "${CMAKE_CXX_COMPILER} -o <OBJECT> <INCLUDE_FLAGS> <SHARED_FLAGS> ${CMAKE_CXX_FLAGS} -c <SOURCE>")
+ENDIF(NOT CMAKE_CXX_COMPILE_OBJECT)
+
+# compile a C file into an object file
+IF(NOT CMAKE_C_COMPILE_OBJECT)
+ SET(CMAKE_C_COMPILE_OBJECT
+ "${CMAKE_C_COMPILER} -o <OBJECT> <INCLUDE_FLAGS> <SHARED_FLAGS> ${CMAKE_C_FLAGS} -c <SOURCE>")
+ENDIF(NOT CMAKE_C_COMPILE_OBJECT)
+
+
+IF(NOT CMAKE_C_LINK_EXECUTABLE)
+ SET(CMAKE_C_LINK_EXECUTABLE
+ "${CMAKE_C_COMPILER} <SHARED_FLAGS> <OBJECTS> -o <TARGET> ")
+ENDIF(NOT CMAKE_C_LINK_EXECUTABLE)
+
+
+IF(NOT CMAKE_CXX_LINK_EXECUTABLE)
+ SET(CMAKE_CXX_LINK_EXECUTABLE
+ "${CMAKE_CXX_COMPILER} <SHARED_FLAGS> <OBJECTS> -o <TARGET> ")
+ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 1035f1b..7f793d3 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -2,7 +2,14 @@
# NOTE, a generator may set CMAKE_C_COMPILER before
# 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 )
+FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} gcc cc cl bcc )
+GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME_WE)
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS /bin /usr/bin /usr/local/bin)
+
+FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib PATHS /bin /usr/bin /usr/local/bin)
+IF(NOT CMAKE_RANLIB)
+ SET(RANLIB :)
+ENDIF(NOT CMAKE_RANLIB)
# test to see if the c compiler is gnu
EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
@@ -13,3 +20,5 @@ IF(NOT CMAKE_COMPILER_RETURN)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
+ ${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 5b09e85..2f0a029 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -2,7 +2,8 @@
# NOTE, a generator may set CMAKE_CXX_COMPILER before
# loading this file to force a compiler.
-FIND_PROGRAM(CMAKE_CXX_COMPILER NAMES $ENV{CXX} c++ g++ CC aCC cl bcc PATHS /bin /usr/bin /usr/local/bin )
+FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} c++ g++ CC aCC cl bcc )
+GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME_WE)
# test to see if the cxx compiler is gnu
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E ${CMAKE_ROOT}/Modules/CMakeTestGNU.c OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
@@ -12,3 +13,5 @@ IF(NOT CMAKE_COMPILER_RETURN)
SET(CMAKE_COMPILER_IS_GNUGXX 1)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
+
+SET(CMAKE_CXX_AR ${CMAKE_AR})
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 5a0296a..c169daf 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -59,4 +59,6 @@ SET(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME})
IF(CMAKE_SYSTEM_VERSION)
SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION})
ENDIF(CMAKE_SYSTEM_VERSION)
-
+MESSAGE(${PROJECT_BIN_DIR}/CMakeSystem.cmake)
+CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
+ ${PROJECT_BINARY_DIR}/CMakeSystem.cmake)
diff --git a/Modules/CMakePrintSystemInformation.cmake b/Modules/CMakePrintSystemInformation.cmake
new file mode 100644
index 0000000..f31a01c
--- /dev/null
+++ b/Modules/CMakePrintSystemInformation.cmake
@@ -0,0 +1,31 @@
+# this file can be used for diagnostic purposes
+# just include it in a project to see various internal cmake
+# variables
+
+MESSAGE("CMAKE_SYSTEM is ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
+MESSAGE("CMAKE_SYSTEM file is ${CMAKE_SYSTEM_INFO_FILE}")
+MESSAGE("CMAKE_C_COMPILER is ${CMAKE_C_COMPILER}")
+MESSAGE("CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
+
+
+MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS}")
+MESSAGE("CMAKE_DL_LIBS is ${CMAKE_DL_LIBS}")
+MESSAGE("CMAKE_SHARED_LIBRARY_PREFIX is ${CMAKE_SHARED_LIBRARY_PREFIX}")
+MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX is ${CMAKE_SHARED_LIBRARY_SUFFIX}")
+MESSAGE("CMAKE_COMPILER_IS_GNUGCC = ${CMAKE_COMPILER_IS_GNUGCC}")
+MESSAGE("CMAKE_COMPILER_IS_GNUGXX = ${CMAKE_COMPILER_IS_GNUGXX}")
+
+MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
+MESSAGE("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}")
+MESSAGE("CMAKE_CXX_CREATE_STATIC_LIBRARY is ${CMAKE_CXX_CREATE_STATIC_LIBRARY}")
+MESSAGE("CMAKE_CXX_COMPILE_OBJECT is ${CMAKE_CXX_COMPILE_OBJECT}")
+MESSAGE("CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_CXX_LINK_EXECUTABLE}")
+
+MESSAGE("CMAKE_C_CREATE_SHARED_LIBRARY is ${CMAKE_C_CREATE_SHARED_LIBRARY}")
+MESSAGE("CMAKE_C_CREATE_SHARED_MODULE is ${CMAKE_C_CREATE_SHARED_MODULE}")
+MESSAGE("CMAKE_C_CREATE_STATIC_LIBRARY is ${CMAKE_C_CREATE_STATIC_LIBRARY}")
+MESSAGE("CMAKE_C_COMPILE_OBJECT is ${CMAKE_C_COMPILE_OBJECT}")
+MESSAGE("CMAKE_C_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}")
+
+MESSAGE("CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE}")
+MESSAGE("CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE}")
diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in
new file mode 100644
index 0000000..80b6e6b
--- /dev/null
+++ b/Modules/CMakeSystem.cmake.in
@@ -0,0 +1,3 @@
+SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
+SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
+SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 3fcaf5e..12203fb 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -5,20 +5,24 @@
# makefiles. Next, it will include a system specific file. Finally,
# it will optionally include a system and compiler specific file that
# can be used to override any of this information.
+# For debugging new systems, and expert users, if the
+# CMAKE_USER_MAKE_RULES_OVERRIDE is set to a file name, that
+# file will be included last, and can override any variable
# 1. set default values that will work for most system
+SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
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_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
-
+SET(CMAKE_LIBRARY_PATH_FLAG "-L")
+SET(CMAKE_LINK_LIBRARY_FLAG "-l")
IF(CMAKE_COMPILER_IS_GNUGXX)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
@@ -38,35 +42,45 @@ ELSE(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
"cmake@www.cmake.org so it can be added to cmake"")
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} <TARGET> <OBJECTS>")
-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} <TARGET> <OBJECTS>")
-ENDIF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY)
-
-
-IF(NOT CMAKE_CXX_COMPILE)
- SET(CMAKE_CXX_COMPILE
- "${CMAKE_CXX_COMPILER} -o <OBJECT> ${CMAKE_CXX_FLAGS} -c <SOURCE>")
-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)
+ GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_C_COMPILER} NAME_WE)
+ # since the gnu compiler has several names force gcc
+ IF(CMAKE_COMPILER_IS_GNUGCC)
+ SET(CMAKE_BASE_NAME gcc)
+ ENDIF(CMAKE_COMPILER_IS_GNUGCC)
+ SET(CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
+ INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_C_COMPILER)
IF(CMAKE_CXX_COMPILER)
- INCLUDE(${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER}.cmake
- OPTIONAL)
+ GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE)
+ # since the gnu compiler has several names force gcc
+ IF(CMAKE_COMPILER_IS_GNUGXX)
+ SET(CMAKE_BASE_NAME g++)
+ ENDIF(CMAKE_COMPILER_IS_GNUGXX)
+ SET(CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
+ INCLUDE(${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_CXX_COMPILER)
+
+
+# for most systems a module is the same as a shared library
+# so unless the variable CMAKE_MODULE_EXISTS is set just
+# copy the values from the LIBRARY variables
+IF(NOT CMAKE_MODULE_EXISTS)
+ SET(CMAKE_SHARED_MODULE_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS)
+ SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
+ SET(CMAKE_SHARED_MODULE_CREATE_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_FLAGS})
+ SET(CMAKE_SHARED_MODULE_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
+ SET(CMAKE_SHARED_MODULE_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
+ SET(CMAKE_SHARED_MODULE_LINK_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_FLAGS})
+ SET(CMAKE_SHARED_MODULE_RUNTIME_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG})
+ SET(CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP})
+ENDIF(NOT CMAKE_MODULE_EXISTS)
+
+# include default rules that work for most unix like systems and compilers
+# this file will not set anything if it is already set
+INCLUDE(${CMAKE_ROOT}/Modules/CMakeDefaultMakeRuleVariables.cmake)
+
+IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
+ INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
+ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
diff --git a/Modules/CYGWIN.cmake b/Modules/CYGWIN.cmake
index 6d18a73..cad44bc 100644
--- a/Modules/CYGWIN.cmake
+++ b/Modules/CYGWIN.cmake
@@ -2,3 +2,6 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "-shared")
SET(CMAKE_DL_LIBS "-lgdi32" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
+# no pic for gcc on cygwin
+SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
+SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")