Commit f5d95fb0 authored by Bill Hoffman's avatar Bill Hoffman

Complete rework of makefile generators expect trouble

parent c72462ff
......@@ -5,18 +5,19 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SUBDIRS(Source Modules Templates Utilities)
ENABLE_TESTING()
# Include the standard Dart testing module
INCLUDE (${CMake_SOURCE_DIR}/Modules/Dart.cmake)
INCLUDE (${CMAKE_BINARY_DIR}/Source/InitialConfigureFlags.cmake OPTIONAL)
IF(CMAKE_CONFIGURE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CONFIGURE_INSTALL_PREFIX} )
ENDIF(CMAKE_CONFIGURE_INSTALL_PREFIX)
# use the ansi CXX compile flag for building cmake
IF (CMAKE_ANSI_CXXFLAGS)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
ENDIF (CMAKE_ANSI_CXXFLAGS)
......
#
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
SET( CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
"Does the compiler support sstream or stringstream.")
ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
......@@ -2,3 +2,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@)
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_COMPILER_IS_GNUGXX @CMAKE_COMPILER_IS_GNUGXX@)
SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
......@@ -16,22 +16,22 @@
# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# CXX compiler information
# <CMAKE_CXX_COMPILER>
# <CMAKE_CXX_COMPILE_FLAGS>
# <CMAKE_CXX_SHARED_LIBRARY_CREATE_FLAGS>
# <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>
# <CMAKE_CXX_SHARED_MODULE_CREATE_FLAGS>
# <CMAKE_CXX_LINK_FLAGS>
# C compiler information
# <CMAKE_C_COMPILER>
# <CMAKE_C_COMPILE_FLAGS>
# <CMAKE_C_SHARED_LIBRARY_CREATE_FLAGS>
# <CMAKE_C_SHARED_MODULE_CREATE_FLAGS>
# <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_C_FLAGS>
# <CMAKE_C_LINK_FLAGS>
# Static library tools
......@@ -42,7 +42,7 @@
# create a shared C++ library
IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_SHARED_LIBRARY_CREATE_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
# create a c++ shared module copy the shared library rule by default
......@@ -53,7 +53,7 @@ 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_C_SHARED_LIBRARY_CREATE_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
# create a C shared module just copy the shared library rule
......@@ -78,23 +78,23 @@ 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> <CMAKE_CXX_COMPILE_FLAGS> -c <SOURCE>")
"<CMAKE_CXX_COMPILER> -o <OBJECT> <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> <CMAKE_C_COMPILE_FLAGS> -c <SOURCE>")
"<CMAKE_C_COMPILER> -o <OBJECT> <FLAGS> -c <SOURCE>")
ENDIF(NOT CMAKE_C_COMPILE_OBJECT)
IF(NOT CMAKE_C_LINK_EXECUTABLE)
SET(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
"<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_C_LINK_EXECUTABLE)
IF(NOT CMAKE_CXX_LINK_EXECUTABLE)
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
"<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE)
# determine the compiler to use for C programs
# NOTE, a generator may set CMAKE_C_COMPILER before
# loading this file to force a compiler.
# use environment variable CCC first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator
# as a default compiler
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} gcc cc cl bcc )
FIND_PROGRAM(CMAKE_C_COMPILER_FULLPATH NAMES $ENV{CC} ${CMAKE_GENERATOR_CC} gcc cc cl bcc )
GET_FILENAME_COMPONENT(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_FULLPATH} NAME_WE)
# set this to notfound right after so that it is searched for each time this
# file is included
SET(CMAKE_C_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to c compiler" FORCE)
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 :)
SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(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)
IF(NOT CMAKE_COMPILER_RETURN)
......@@ -19,6 +25,8 @@ IF(NOT CMAKE_COMPILER_RETURN)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake)
${PROJECT_BINARY_DIR}/CMakeCCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_AR CMAKE_C_COMPILER_FULLPATH)
# determine the compiler to use for C++ programs
# NOTE, a generator may set CMAKE_CXX_COMPILER before
# loading this file to force a compiler.
# use environment variable CXX first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_CXX which can be defined by a generator
# as a default compiler
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} c++ g++ CC aCC cl bcc )
FIND_PROGRAM(CMAKE_CXX_COMPILER_FULLPATH NAMES $ENV{CXX} ${CMAKE_GENERATOR_CXX} c++ g++ CC aCC cl bcc )
GET_FILENAME_COMPONENT(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_FULLPATH} NAME_WE)
# set this to notfound right after so that it is searched for each time this
# file is included
SET(CMAKE_CXX_COMPILER_FULLPATH NOTFOUND CACHE INTERNAL "full path to cxx compiler" FORCE)
# 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)
IF(NOT CMAKE_COMPILER_RETURN)
IF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
SET(CMAKE_COMPILER_IS_GNUGXX 1)
SET(CMAKE_COMPILER_IS_GNUCXX 1)
ENDIF(${CMAKE_COMPILER_OUTPUT} MATCHES ".*THIS_IS_GNU.*" )
ENDIF(NOT CMAKE_COMPILER_RETURN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
${PROJECT_BINARY_DIR}/CMakeCXXCompiler.cmake)
${PROJECT_BINARY_DIR}/CMakeCXXCompiler.cmake IMMEDIATE)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER_FULLPATH)
......@@ -60,6 +60,8 @@ IF(CMAKE_SYSTEM_VERSION)
SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION})
ENDIF(CMAKE_SYSTEM_VERSION)
# configure variables set in this file for fast reload
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
${PROJECT_BINARY_DIR}/CMakeSystem.cmake)
${PROJECT_BINARY_DIR}/CMakeSystem.cmake IMMEDIATE)
......@@ -8,12 +8,13 @@ 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_SHARED_LIBRARY_CREATE_C_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
MESSAGE("CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS is ${CMAKE_SHARED_LIBRARY_CREATE_CXX_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_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}")
MESSAGE("CMAKE_CXX_CREATE_SHARED_LIBRARY is ${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
MESSAGE("CMAKE_CXX_CREATE_SHARED_MODULE is ${CMAKE_CXX_CREATE_SHARED_MODULE}")
......
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@")
......@@ -11,29 +11,34 @@
# 1. set default values that will work for most system
# suffix that needs to be added onto a library to link it .lib on windows
# not used on most unix systems
SET(CMAKE_LINK_LIBRARY_SUFFIX "")
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
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "") # -shared
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
SET(CMAKE_DL_LIBS "-ldl")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
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)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
ENDIF(CMAKE_COMPILER_IS_GNUGXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET (CMAKE_SKIP_RPATH "NO" CACHE BOOL
"If set, runtime paths are not added when using shared libraries.")
MARK_AS_ADVANCED(CMAKE_SKIP_RPATH)
# 2. now include SystemName.cmake file to set the system specific information
SET(CMAKE_SYSTEM_INFO_FILE ${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}.cmake)
SET(CMAKE_SYSTEM_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}.cmake)
IF(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
INCLUDE(${CMAKE_SYSTEM_INFO_FILE})
ELSE(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
......@@ -50,17 +55,17 @@ IF(CMAKE_C_COMPILER)
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)
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(${CMAKE_SYSTEM_AND_C_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_C_COMPILER)
IF(CMAKE_CXX_COMPILER)
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)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_BASE_NAME g++)
ENDIF(CMAKE_COMPILER_IS_GNUGXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(${CMAKE_SYSTEM_AND_CXX_COMPILER_INFO_FILE} OPTIONAL)
ENDIF(CMAKE_CXX_COMPILER)
......@@ -71,7 +76,7 @@ ENDIF(CMAKE_CXX_COMPILER)
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_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_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})
......@@ -79,6 +84,28 @@ IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_MODULE_EXISTS)
IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG})
ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
# 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)
......@@ -86,3 +113,19 @@ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDefaultMakeRuleVariables.cmake)
IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES nmake gmake make )
SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only.")
# default build type is none
SET (CMAKE_BUILD_TYPE "" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
MARK_AS_ADVANCED(
CMAKE_VERBOSE_MAKEFILE
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS
)
#include <${CHECK_INCLUDE_FILE_VAR}>
int main()
{
return 0;
}
#
# Check if the include file exists.
#
# CHECK_INCLUDE_FILE - macro which checks the include file exists.
# INCLUDE - name of include file
# VARIABLE - variable to return result
#
MACRO(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx IMMEDIATE)
TRY_COMPILE(${VARIABLE}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.cxx
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
ELSE(${VARIABLE})
SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log
"Determining if the include file ${INCLUDE} "
"exists failed with the following output:\n"
"${OUTPUT}\n")
ENDIF(${VARIABLE})
ENDMACRO(CHECK_INCLUDE_FILE_CXX)
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o") # .so
SET(CMAKE_DL_LIBS "-lld")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-G") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-brtl") # +s, flag for exe link to use shared lib
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_CREATE_FLAGS "-shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
SET(CMAKE_DL_LIBS "-lgdi32" )
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll")
# no pic for gcc on cygwin
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM NAMES gmake make )
SET(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM} CACHE INTERNAL
"What is the target build tool cmake is generating for.")
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
SET(CMAKE_SHARED_MODULE_SUFFIX ".so")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib")
SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -flat_namespace -undefined suppress")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_CXX_CREATE_SHARED_MODULE
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_C_CREATE_SHARED_MODULE
"<CMAKE_C_COMPILER> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
ENDIF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
SET(CMAKE_DL_LIBS "-ldld")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
# C compiler
IF(CMAKE_COMPILER_IS_GNUCC)
# gnu gcc
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-E -Wl,-b") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
ELSE(CMAKE_COMPILER_IS_GNUCC)
# hp cc
SET(CMAKE_ANSI_CFLAGS "-Ae -Aa")
# use ld directly to create shared libraries for hp cc
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "+Z") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b -L/usr/lib") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "+b") # -rpath
ENDIF(CMAKE_COMPILER_IS_GNUCC)
# CXX compiler
IF(CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
# for gnu C++
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-E -Wl,-b") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
ELSE(CMAKE_COMPILER_IS_GNUCXX)
# for hp aCC
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E -b -L/usr/lib") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ELSE(NOT CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP "") # : or empty
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -ar -o <TARGET> <OBJECTS>")
SET(CMAKE_ANSI_CXXFLAGS -LANG:std)
SET (CMAKE_CXX_FLAGS "" CACHE STRING
"Flags used by the compiler during all build types.")
SET (CMAKE_CXX_FLAGS_DEBUG "-g" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_CXX_FLAGS_MINSIZEREL "-O3" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
SET (CMAKE_C_FLAGS "" CACHE STRING
"Flags for C compiler.")
ELSE(NOT CMAKE_COMPILER_IS_GNUCXX)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_DL_LIBS "-ldl")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-rdynamic")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-Bexport")
ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "") # +s, flag for exe link to use shared lib
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,") # -rpath
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":") # : or empty
ENDIF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
IF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
IF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-rpath,")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-rpath,")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_ANSI_CXXFLAGS "-std strict_ansi -nopure_cname")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-D,08000000")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-Kpic -belf")
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-Kpic -belf")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-belf -Wl,-Bexport")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
IF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r -nostdlib")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
IF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -nostdlib")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG "-Wl,-R,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_FLAG_SEP ":")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5*.")
IF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
"<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> ")
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-G 0")
SET(CMAKE_SHARED_LIBRARY_SUFFIX "..o")
SET(CMAKE_DL_LIBS "")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-D,08000000")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_FLAGS "-Wl,-Bexport")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport")
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "")
# create a shared C++ library
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)
SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
# create a C shared library
SET(CMAKE_C_CREATE_SHARED_LIBRARY
"<CMAKE_CXX_COMPILER> @&&|\n-e<TARGET> -tWD <OBJECTS> <LINK_LIBRARIES>\n|"
"implib @&&|\n-w <TARGET_BASE>.lib <TARGET_BASE>.dll\n|"
)
# create a C shared module just copy the shared library rule
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
# create a C++ static library
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "tlib @&&|\n/p512 /a <TARGET> <OBJECTS_QUOTED>\n|")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})
# compile a C++ file into an object file
SET(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> @&&|\n-DWIN32 -o<OBJECT> <FLAGS> -c <SOURCE>\n|")
# compile a C file into an object file
SET(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> @&&|\n-DWIN32 -o<OBJECT> <FLAGS> -c <SOURCE>\n|")
SET(CMAKE_C_LINK_EXECUTABLE
"<CMAKE_C_COMPILER> @&&|\n-e<TARGET> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> \n|")
SET(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> @&&|\n -e<TARGET> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> \n|")
SET (CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
# extra flags for a win32 exe
SET(CMAKE_CREATE_WIN32_EXE -tW -tWM )
# extra flags for a console app
SET(CMAKE_CREATE_CONSOLE_EXE -tWC )
SET (CMAKE_CXX_FLAGS "-w- -whid -waus -wpar -tWM -P" CACHE STRING
"Flags used to compile c++ files.")