Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / Platform / Linux.cmake
blob095eac6805178b200a9709868d02b9365e3e449e
1 # GCC is the default compiler on Linux.
2 SET(CMAKE_DL_LIBS "dl")
3 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")        
4 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
5 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-rdynamic")  
6 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
7 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
8 SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
9 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
10 SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,")
11 SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,")
12 SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
13 SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic")
15 # Initialize C link type selection flags.  These flags are used when
16 # building a shared library, shared module, or executable that links
17 # to other libraries to select whether to use the static or shared
18 # versions of the libraries.
19 FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
20   SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
21   SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
22 ENDFOREACH(type)
24 # Debian policy requires that shared libraries be installed without
25 # executable permission.  Fedora policy requires that shared libraries
26 # be installed with the executable permission.  Since the native tools
27 # create shared libraries with execute permission in the first place a
28 # reasonable policy seems to be to install with execute permission by
29 # default.  In order to support debian packages we provide an option
30 # here.  The option default is based on the current distribution, but
31 # packagers can set it explicitly on the command line.
32 IF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
33   # Store the decision variable in the cache.  This preserves any
34   # setting the user provides on the command line.
35   SET(CMAKE_INSTALL_SO_NO_EXE "${CMAKE_INSTALL_SO_NO_EXE}" CACHE INTERNAL
36     "Install .so files without execute permission.")
37 ELSE(DEFINED CMAKE_INSTALL_SO_NO_EXE)
38   # Store the decision variable as an internal cache entry to avoid
39   # checking the platform every time.  This option is advanced enough
40   # that only package maintainers should need to adjust it.  They are
41   # capable of providing a setting on the command line.
42   IF(EXISTS "/etc/debian_version")
43     SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
44       "Install .so files without execute permission.")
45   ELSE(EXISTS "/etc/debian_version")
46     SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
47       "Install .so files without execute permission.")
48   ENDIF(EXISTS "/etc/debian_version")
49 ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
51 INCLUDE(Platform/UnixPaths)
53 # Debian has lib64 paths only for compatibility so they should not be
54 # searched.
55 IF(EXISTS "/etc/debian_version")
56   SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
57 ENDIF(EXISTS "/etc/debian_version")