summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
Commit message (Collapse)AuthorAgeFilesLines
* Visibility: the Intel compiler does not support -fvisibility on windowsNils Gladitz2014-02-072-8/+0
|
* Update the Clang pattern to specify compiler options.Stephen Kelly2013-11-251-2/+7
| | | | | | | | | | In Clang 3.4, the preferred (and new) option pattern is --target=. http://thread.gmane.org/gmane.comp.compilers.clang.devel/29975 http://llvm.org/viewvc/llvm-project?view=revision&revision=184408 Clang 3.4 is not yet released, but there is a release candidate, and there is a dashboard test of Clang trunk.
* Add CMAKE_SYSROOT variable to set --sysroot when cross compiling.Stephen Kelly2013-11-191-0/+1
| | | | | | | | | | As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
* Allow toolchain files to specify an external toolchain.Stephen Kelly2013-11-191-0/+1
| | | | | | | | | Clang can compile code, but uses the gcc tools for other tasks such as linking. The -gcc-toolchain option can be used for that, but generalize so that other compilers can be treated the same. If such a location is specified, use it as a hint for finding the binutils executables.
* Add compiler target compile options.Stephen Kelly2013-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | For clang, this allows passing -target <triple> to the compiler, and for qcc, -V<arch> using toolchain files containing something like set(triple arm-linux-gnueabihf) set(CMAKE_C_COMPILER "/usr/bin/clang") set(CMAKE_C_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_COMPILER_TARGET ${triple}) or set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) Both clang and qcc are inherently cross compiler( driver)s. When cross-compiling with clang, use the CMAKE_${lang}_COMPILER_TARGET as the _CMAKE_TOOLCHAIN_PREFIX to find the appropriate binutils. When cross-compiling with QNX qcc, use the CMAKE_${lang}_COMPILER_TARGET to set the appropriate _CMAKE_TOOLCHAIN_PREFIX.
* Ninja: add depfile support for Intel's compilerPeter Kümmel2013-11-042-0/+4
|
* Merge topic 'apple-clang-id'Brad King2013-10-093-0/+3
|\ | | | | | | | | | | | | 1763c31 Set policy CMP0025 to NEW while building CMake itself aa53ee5 Add policy CMP0025 for Apple Clang compiler id compatibility ab65862 Clang: Add separate "AppleClang" compiler id
| * Clang: Add separate "AppleClang" compiler idBrad King2013-10-083-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Apple distributes their own Clang build with their own version numbers that differ from upstream Clang. Use the __apple_build_version__ symbol to identify the Apple Clang compiler and report the Apple Build Version as the fourth version component in CMAKE_<LANG>_COMPILER_VERSION. Add Compiler/AppleClang-<lang> and Platform/Darwin-AppleClang-<lang> modules that simply include the upstream equivalents. Fix comparisons of CMAKE_<LANG>_COMPILER_ID to Clang in CMake's own source and tests to account for AppleClang.
* | Clang: Support Windows variants for GNU and MSVC (#13035, #14458)Brad King2013-10-042-8/+16
|/ | | | | | | | | | | | | | | | Teach the compiler identification preprocessor tests to report when Clang simulates MSVC, and what version. If not MSVC, assume GNU. Teach compiler information modules Clang-(C|CXX) to recognize when Clang simulates MSVC and skip loading the GNU information. Teach the Windows-MSVC platform information to recognize when it is loaded as the simulated compiler and use that version information instead of the real compiler's (different) version scheme. Add platform modules Windows-Clang-(C|CXX) and support module Windows-Clang to load either Windows-MSVC or Windows-GNU and wrap the corresponding information macros.
* Revert "Add compiler target compile options."Stephen Kelly2013-08-091-1/+0
| | | | This reverts commit 2d9ec1dadfdd10043a98d425abb25d0aef117699.
* Revert "Use --sysroot when cross compiling."Stephen Kelly2013-07-121-1/+0
| | | | | | | This reverts commit de4da665d3205afa239749c41513a315c3831f51. This feature is not yet ready for release. It needs to be merged with the CMAKE_OSX_SYSROOT feature.
* Merge topic 'COMPILER_TARGET'Brad King2013-06-261-0/+1
|\ | | | | | | | | 2d9ec1d Add compiler target compile options.
| * Add compiler target compile options.Stephen Kelly2013-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For clang, this allows passing -target <triple> to the compiler, and for qcc, -V<arch> using toolchain files containing something like set(triple arm-linux-gnueabihf) set(CMAKE_C_COMPILER "/usr/bin/clang") set(CMAKE_C_COMPILER_TARGET ${triple}) set(CMAKE_CXX_COMPILER "/usr/bin/clang++") set(CMAKE_CXX_COMPILER_TARGET ${triple}) or set(arch gcc_ntoarmv7le) set(CMAKE_C_COMPILER /opt/qnx650/host/linux/x86/usr/bin/qcc) set(CMAKE_C_COMPILER_TARGET ${arch}) set(CMAKE_CXX_COMPILER /opt/qnx650/host/linux/x86/usr/bin/QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) Both clang and qcc are inherently cross compiler( driver)s.
* | Use --sysroot when cross compiling.Stephen Kelly2013-06-071-0/+1
|/ | | | | | | | | | As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is introduced, which is never a list. The contents of this variable is passed to supporting compilers as --sysroot. It is also accounted for when processing implicit link directories reported by the compiler, and when generating RPATH information.
* Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property.Stephen Kelly2013-06-022-0/+12
| | | | | | | This corresponds to the g++ and clang++ option -fvisibility-inlines-hidden on linux. On Windows with MinGW, this corresponds to -fno-keep-inline-dllexport. That option is not supported by clang currently.
* Introduce target property <LANG>_VISIBILITY_PRESETStephen Kelly2013-06-024-0/+12
| | | | | | This is initialized by CMAKE_<LANG>_VISIBILITY_PRESET. The target property is used as the operand to the -fvisibility= compile option with GNU compilers and clang.
* Add support files for C, C++ and ASM for the IAR toolchain.Alex Neundorf2013-04-154-0/+128
| | | | | | | The original feature request is at http://www.cmake.org/Bug/view.php?id=10176 Documentation can be found at http://www.iar.com/website1/1.0.1.0/675/1/ Alex
* Merge topic 'dev/add-isystem-for-clang'Brad King2013-03-281-0/+1
|\ | | | | | | | | 4d668f3 Clang: Add -isystem flag support everywhere
| * Clang: Add -isystem flag support everywhereBen Boeckel2013-03-281-0/+1
| | | | | | | | | | | | | | | | In GNU.cmake, -isystem is not used if APPLE is set. However, Clang has pretty much always supported -isystem, so we should always use it. In the future, GNU.cmake should do a version check to see if -isystem is supported.
* | rename TI_DSP toolchain to TI, since it works also for the ARM compilerAlex Neundorf2013-03-143-0/+0
| | | | | | | | | | | | Additionally, look for a special ar and strip Alex
* | Merge topic 'aix-pic'Brad King2013-03-141-0/+1
|\ \ | |/ |/| | | | | 5c8c1d6 XL: Use -qpic for position independent code (#14010)
| * XL: Use -qpic for position independent code (#14010)Brad King2013-03-131-0/+1
| | | | | | | | | | | | | | According to XL C/C++ V9.0 documentation the default for -qpic/-qnopic is platform-dependent. It won't hurt to add the option on platforms where it is the default, so always add it when we want position independent code.
* | NAG: Use -PIC for Fortran position-independent code (#13932)Neil Carlson2013-02-181-0/+1
| | | | | | | | | | The Numerical Algorithms Group (NAG) Fortran compiler documents -PIC for position-independent code.
* | Add support for Texas Instruments DSP compiler (#12405)Alex Neundorf2012-11-043-0/+28
|/ | | | | | | This is for the cl6x compiler from TI, which is used for TI DSPs. The toolchain can be downloaded for free for Linux and Windows. Alex
* Clang: All versions know about -fPIE (#13550)Brad King2012-09-191-0/+1
| | | | | | The GNU compiler information file tests for GNU >= 3.4 because earlier versions do not have the flag. The version number test is not valid for Clang compiler versions, but we know Clang supports the flag.
* Clang: Split Compiler/Clang* modules out from GNU (#13550)Brad King2012-09-194-3/+34
| | | | | | | While Clang presents an almost identical interface to GNU there will be some differences. Split the compiler information modules to allow separate rules for Clang. Start by loading the GNU rules but leave a place to add Clang-specific information.
* Merge topic 'relwithdebinfo-consistency'David Cole2012-08-2010-10/+10
|\ | | | | | | | | 0ddfc51 Add -DNDEBUG to RelWithDebInfo flags where where Release flags had it.
| * Add -DNDEBUG to RelWithDebInfo flags where where Release flags had it.Clinton Stimpson2012-08-1610-10/+10
| | | | | | | | | | | | Previously, it was inconsistent in that some platforms/compilers had this flag for the RelWithDebInfo configuration and some didn't. This fixes issue #11366.
* | Recognize Clang ASM support (#13473)Brad King2012-08-151-0/+1
|/ | | | | | | | | Since commit 571dc748 (Recognize Clang C and C++ compilers, 2010-05-17) we recognize Clang C and C++ support. Add Compiler/Clang-ASM.cmake to enable use of Clang for ASM too. Also teach Assembler test to try Clang as an assembler. Suggested-by: Tobias Pape <tobiaspape@gmail.com>
* Remove CMake-language block-end command argumentsKitware Robot2012-08-135-6/+6
| | | | | | | | | | | | | | | | | Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Convert CMake-language commands to lower caseKitware Robot2012-08-1325-153/+153
| | | | | | | | | | | | | | | | | Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
* Add platform variable for flags specific to shared librariesStephen Kelly2012-06-121-0/+1
| | | | | | Store in CMAKE_${lang}_COMPILE_OPTIONS_DLL flags from CMAKE_SHARED_LIBRARY_${lang}_FLAGS that are truly exclusive to shared libraries.
* Add platform variables for position independent code flagsStephen Kelly2012-06-124-0/+10
| | | | | | | | | | | | | | | | | | | | 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.
* Support building shared libraries or modules without soname (#13155)Modestas Vainius2012-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a boolean target property NO_SONAME which may be used to disable soname for the specified shared library or module even if the platform supports it. This property should be useful for private shared libraries or various plugins which live in private directories and have not been designed to be found or loaded globally. Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and hard-coded -install_name flags with a conditional <SONAME_FLAG> which is expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG definition as long as soname supports is enabled for the target in question. Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in rules in case third party projects still use it. Such projects would not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be expanded. Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well. Since -install_name is soname on OS X, this should not be a problem if this variable is expanded only if soname is enabled. The Ninja generator performs rule variable substitution only once globally per rule to put its own placeholders. Final substitution is performed by ninja at build time. Therefore we cannot conditionally replace the soname placeholders on a per-target basis. Rather than omitting $SONAME from rules.ninja, simply do not write its contents for targets which have NO_SONAME. Since 3 variables are affected by NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if soname is enabled.
* Ninja: Substitute <OBJECT> and <CMAKE_C_COMPILER> in depfile flagsPeter Collingbourne2012-03-261-1/+4
| | | | | | | | Patch by Amine Khaldi! Also, start using the -MT flag to set a target name for depfiles. This works around a bug observed in distcc, as explained in the comment. Based on a patch by Alexander Usov.
* Provide dependency file flags to generatorPeter Collingbourne2012-02-021-0/+9
| | | | | | | Causes compiler modules (currently only GNU) to set a CMAKE_DEPFILE_FLAGS_${lang} variable, which communicates to the generator the flags required to cause the compiler to create dependency files.
* TinyCC: Add default compilation flags (#12605)Mathieu Malaterre2011-12-051-0/+7
|
* TinyCC: Add compiler info for shared libs on Linux (#12605)Brad King2011-12-021-0/+1
| | | | | | Use the "-shared" option to link shared libraries. The compiler does not support "-Wl," or "-rpath" but does know how to pass "-soname" through to the linker.
* Merge topic 'fortran-format'David Cole2011-09-0712-0/+27
|\ | | | | | | | | | | | | | | 90efed6 Xcode: Honor Fortran_FORMAT target and source file property 5c0c635 Fortran: Add support for free- and fixed-form flags 47a0c75 VS: Map Fortran free- and fixed-format flags to IDE options d6e2a06 VS: Map per-source Fortran flags to IDE options
| * Fortran: Add support for free- and fixed-form flagsBrad King2011-08-3112-0/+27
| | | | | | | | | | | | | | Define a "Fortran_FORMAT" target and source file property. Initialize the target property from a "CMAKE_Fortran_FORMAT" variable. Interpret values "FIXED" and "FREE" to indicate the source file format. Append corresponding flags to the compiler command line.
* | Fix XL compilers on non-AIX machines.Todd Gamblin2011-08-291-10/+15
|/ | | | | | Linking broken on non-AIX machines when using XL compilers due to those machines not using the CreateExportList tool. Made use of this tool conditional on finding it.
* GNU: Fix CMAKE_INCLUDE_SYSTEM_FLAG_<lang> value (#12258)Brad King2011-06-131-1/+1
| | | | | | | | Fix typo introduced by commit e28c16b4 (Split GNU compiler information files, 2009-12-02). Reported-by: Campbell Barton <ideasman42@gmail.com> Suggested-by: Michael Hertling <mhertling@online.de>
* XL: Place Fortran modules with -qmoddir= flag (#12246)Brad King2011-06-011-0/+2
| | | | Suggested-by: Luis Kornblueh <luis.kornblueh@zmaw.de>
* Merge topic 'absoft-fortran-compiler'Brad King2011-05-241-0/+8
|\ | | | | | | | | | | | | 8bd3e51 Absoft: Enable FortranCInterface check in Fortran test d7b376b Absoft: Detect implicit link libraries on Linux and Mac ac5b999 Add Absoft Fortran compiler id and basic flags
| * Add Absoft Fortran compiler id and basic flagsBrad King2011-05-201-0/+8
| | | | | | | | | | Identification at preprocessing time depends on definition of __ABSOFT__ to be added in service pack V11.1.2 of the compiler.
* | XL: Avoid copying archives into shared libraries that link themBrad King2011-04-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The XL toolchain supports shared object files stored in archives. Since CMake lists libraries on link lines by full path it is common for a shared library link line to contain the path to an archive file. When linking a shared library the compiler front-end by default runs CreateExportList to construct the list of symbols to be exported. Unfortunately it passes all files found on the command line to the tool so archive and library files get processed along with the object files. The tool returns a list of all symbols in all objects, archives, and libraries on the command line. This causes the linker to copy every object file out of every archive into the shared library whether they are dependencies of the original object files or not. Work around this problem by running CreateExportList ourselves with just the original object files intended for inclusion in the shared library. Then pass the list it produces on the link line to prevent the compiler front-end from constructing its own. This tells the linker to export only the symbols provided by the original source files of the shared library.
* | XL: Consolidate compiler flag informationBrad King2011-04-074-23/+44
| | | | | | | | | | | | Factor duplicate information out of Compiler/XL-<lang>.cmake modules into a macro in a new Compiler/XL.cmake module. Invoke it from the per-language files to produce the original settings.
* | XL: Set C++ and Fortran flags consistently with CBrad King2011-04-072-0/+8
| | | | | | | | | | | | Since commit e1729238 (Add initial XL C compiler flags for safer builds, 2009-09-30) CMake sets the initial XL C flags to include "-qthreaded" and "-qhalt=e". Do the same for C++ and Fortran with this toolchain.
* | Add support for the Intel compiler used for ASM under WindowsAlex Neundorf2011-03-021-1/+5
| | | | | | | | Alex
* | Add assemble- and preprocess commands for HPAlex Neundorf2011-02-232-3/+6
| | | | | | | | | | | | Also restore HP-C.cmake, I had accidentially overwritten it with HP-ASM.cmake Alex