Minor changes for ATAPI Srb Functions
[reactos.git] / cmake / Compiler / GNU.cmake
1
2 #=============================================================================
3 # Copyright 2002-2009 Kitware, Inc.
4 #
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
7 #
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12 # (To distribute this file outside of CMake, substitute the full
13 # License text for the above reference.)
14
15 # This module is shared by multiple languages; use include blocker.
16 if(__COMPILER_GNU)
17 return()
18 endif()
19 set(__COMPILER_GNU 1)
20
21 macro(__compiler_gnu lang)
22 # Feature flags.
23 set(CMAKE_${lang}_VERBOSE_FLAG "-v")
24 set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
25 if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
26 set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
27 endif()
28 if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.2)
29 set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
30 endif()
31 set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
32 set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
33 set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
34
35 # Older versions of gcc (< 4.5) contain a bug causing them to report a missing
36 # header file as a warning if depfiles are enabled, causing check_header_file
37 # tests to always succeed. Work around this by disabling dependency tracking
38 # in try_compile mode.
39 get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
40 if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
41 # distcc does not transform -o to -MT when invoking the preprocessor
42 # internally, as it ought to. Work around this bug by setting -MT here
43 # even though it isn't strictly necessary.
44 set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT <OBJECT> -MF <DEPFILE>")
45 endif()
46
47 # Initial configuration flags.
48 set(CMAKE_${lang}_FLAGS_INIT "")
49 set(CMAKE_${lang}_FLAGS_DEBUG_INIT "")
50 set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
51 set(CMAKE_${lang}_FLAGS_RELEASE_INIT "")
52 set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
53 set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
54 set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
55 if(NOT APPLE)
56 set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
57 endif()
58 endmacro()