mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
Store in new platform variables
CMAKE_${lang}_COMPILE_OPTIONS_PIC
CMAKE_${lang}_COMPILE_OPTIONS_PIE
flags for position independent code generation.
In almost all cases, this means duplication of the
CMAKE_SHARED_LIBRARY_${lang}_FLAGS for the _PIC case and using the
assumed pie equivalent for the _PIE case. Note that the GNU compiler
has supported -fPIE since 3.4 and that there is no -fPIC on GNU for
Windows or Cygwin.
There is a possibility that the _PIE variables are not correct.
However, as there is no backwards compatibility to be concerned about
(as the POSITION_INDEPENDENT_CODE property is not used anywhere yet),
the current state suffices.
48 lines
1.8 KiB
CMake
48 lines
1.8 KiB
CMake
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_C_COMPILE_OPTIONS_PIC "-fpic")
|
|
SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie")
|
|
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
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,")
|
|
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-rpath ")
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
|
|
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-rpath ")
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
|
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
|
|
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
|
|
|
SET(CMAKE_MAKE_INCLUDE_FROM_ROOT 1) # include $(CMAKE_BINARY_DIR)/...
|
|
|
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
|
# include the gcc flags
|
|
ELSE (CMAKE_COMPILER_IS_GNUCXX)
|
|
# use default OSF compiler flags
|
|
SET (CMAKE_C_FLAGS_INIT "")
|
|
SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
|
|
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
|
|
SET (CMAKE_C_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
|
|
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2")
|
|
SET (CMAKE_CXX_FLAGS_INIT "")
|
|
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
|
|
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-O2 -DNDEBUG")
|
|
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
|
|
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2")
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
INCLUDE(Platform/UnixPaths)
|