summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-MSVC.cmake
Commit message (Collapse)AuthorAgeFilesLines
* MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-291-2/+2
| | | | | | | | | | | | CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC, are responsible for calling resource compiler and manifest tool. Before this commit, both of these tools were called directly, with the expectation that they are available in the `PATH`. This has been fixed by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT` defining paths to these tools. Fixes: #17804
* MSVC: Factor out enable_language(RC) call into helper macroBrad King2018-10-291-1/+4
| | | | This will be useful to call from elsewhere later.
* MSVC: Add MSVC_TOOLSET_VERSION variableArkady Shapkin2018-04-041-0/+25
| | | | | | Provide the MSVC toolset version number based on the compiler version. Fixes: #16923
* MSVC,Clang,Flang: Add IPO supportxoviat2018-02-231-0/+28
| | | | Fixes: #17692
* MSVC: Fix MSVC_VERSION when mixing MSVC C/C++ with Intel FortranBrad King2017-11-151-1/+5
| | | | | | | | When using a real MSVC compiler for `C` or `CXX`, use the version of that compiler for `MSVC_VERSION`. This is preferred over the MSVC version that a non-MSVC compiler "simulates". Fixes: #17468
* Merge topic 'MsvcArm64'Brad King2017-09-131-3/+9
|\ | | | | | | | | | | | | bc7c94fe MSVC: Add support for ARM64 architecture Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1215
| * MSVC: Add support for ARM64 architectureMinmin Gong2017-09-121-3/+9
| | | | | | | | | | | | Visual Studio 15.4 adds support for this architecture. Fixes: #17213
* | VS: Update support for LLVM-vs* toolsets from LLVM 5.0Konstantin Ivlev2017-09-111-2/+2
|/ | | | | | | | | Revert commit v3.7.0-rc1~25^2 (VS: Recognize VS/LLVM toolset names as Clang, 2016-09-28). Since at least LLVM 5.0 the VS integration of the LLVM toolchain now mimics cl and accepts MSVC-style command-line arguments (unlike Microsoft Clang/C2). Fixes: #17193, #17235
* Use string(APPEND) in ModulesDaniel Pfeifer2017-05-171-2/+2
| | | | | | | Automate with: find Modules -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_\$\{\}]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
* MSVC: Restore _DEBUG preprocessor definition in RC debug buildsBrad King2017-03-281-0/+3
| | | | | | | | | | | | | | | | | | In commit v3.8.0-rc1~304^2 (MSVC: Do not define _DEBUG explicitly when using /MDd, 2016-11-15) we removed the `_DEBUG` preprocessor definition from MSVC C and C++ flags because the `cl` compiler automatically defines it in Debug builds anyway. However, the VS generators propagate C preprocessor definitions to the RC (Windows Resource Compiler) tool. This means that we used to explicitly define `_DEBUG` for RC debug builds. Therefore existing project code may expect the definition to be there even though the `rc` compiler itself does not implicitly define `_DEBUG` in debug builds. Add the `_DEBUG` flag to the default `CMAKE_RC_FLAGS_DEBUG` instead to restore this definition for RC debug builds. This also makes it available consistently in VS, Ninja, and Makefile generators. Fixes: #16745
* MSVC: Exclude future cl 20+ from MSVC14 variableBrad King2017-03-221-1/+3
|
* CUDA: Detect MSVC architecture idBrad King2017-01-121-0/+2
|
* MSVC: Do not define _DEBUG explicitly when using /MDdBrad King2016-11-151-2/+2
| | | | | | | | With the latter flag the compiler automatically defines `_DEBUG`: https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx Closes: #16430
* Merge topic 'vs-clang-llvm-support'Brad King2016-09-291-2/+2
|\ | | | | | | | | 3f300b84 VS: Recognize VS/LLVM toolset names as Clang
| * VS: Recognize VS/LLVM toolset names as ClangRoman Wüger2016-09-281-2/+2
| | | | | | | | | | | | Update the toolset name matching added by commit v3.6.0-rc1~279^2~10 (VS: in Clang/C2 toolset, setup correct compiler settings, 2016-02-18) to match VS/LLVM toolset names too.
* | Simplify CMake per-source license noticesBrad King2016-09-271-12/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Use string(APPEND) in ModulesDaniel Pfeifer2016-07-271-1/+1
| | | | | | | Automate with: find Modules -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
* Honor CMAKE_*_LINKER_FLAGS[_<CONFIG>]_INIT set in toolchain filesBrad King2016-07-141-6/+6
| | | | | | | | | | | | | | Document these variables. Change our convention for setting these variables from: set(CMAKE_EXE_LINKER_FLAGS_INIT "...") to string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ...") so that any value previously set by a toolchain file will be used.
* MSVC: Set all CMAKE_*_LINKER_FLAGS_INIT directlyBrad King2016-07-131-28/+19
| | | | Avoid copying CMAKE_EXE_LINKER_FLAGS_INIT to the others.
* Honor CMAKE_<LANG>_FLAGS[_<CONFIG>]_INIT set in toolchain filesBrad King2016-07-061-11/+11
| | | | | | | | | | | | | | | | | | | | | | | Document these variables. Change our convention for setting these variables from: set(CMAKE_C_FLAGS_INIT "...") to string(APPEND CMAKE_C_FLAGS_INIT " ...") so that any value previously set by a toolchain file will be used. Automate the conversion with: sed -i 's/set *(\(CMAKE_\(C\|CXX\|Fortran\|RC\|ASM\|${[^}]\+}\)_FLAGS\(_[^_]\+\)\?_INIT \+"\)/string(APPEND \1 /' \ Modules/Compiler/*.cmake Modules/Platform/*.cmake and follow up with some manual fixes (e.g. to cases that already meant to append). Also revert the automated changes to contexts that are not protected from running multiple times.
* Intel: Do not use MSVC-like flags for FortranBrad King2016-07-051-14/+17
| | | | | | | | | | | Teach `Modules/Platform/Windows-MSVC.cmake` not to use MSVC options for Fortran. We use the `__windows_compiler_msvc` for the Intel Fortran compiler on Windows for other settings, but we do not want the flags. Previously this worked only because the options were later overridden by `Modules/Platform/Windows-Intel*.cmake`, but it is cleaner to not set the options in the first place.
* VS: Fix regressed mapping for the cl `/Os` compiler flagBrad King2016-06-171-1/+1
| | | | | | | | | | | | | In commit v3.6.0-rc1~279^2~10 (VS: in Clang/C2 toolset, setup correct compiler settings, 2016-02-18) a flag mapping was added for the clang `-Os` flag. However, this collides with a mapping we already had for the MSVC flag of the same name. This is a symptom of a larger problem in that the VS generators need a per-toolset flag map (issue #16153). For now, simply drop the new mapping and drop `-Os` from clang compiler flags in the MinSizeRel configuration. Reported-by: Felix Bruns <felixbruns@gmail.com>
* MSVC: Drop space in `/DNDEBUG` flag for consistency (#16052)Brad King2016-04-071-6/+6
| | | | | | | | We define `NDEBUG` without a space after the `-D` option for most compilers. Remove the space for MSVC (and Intel Fortran) for consistency. The MS compiler technically does not document that the `-D` argument may be separated from its value, though every version to date supports it.
* Fix spelling typos in comments and documentation (#16037)Felix Geyer2016-03-291-1/+1
| | | | | The Debian package checker tool (lintian) detected several typos in CMake.
* Merge topic 'remove-vs6-generator'Brad King2016-03-101-4/+0
|\ | | | | | | | | | | b42866a3 Drop Visual Studio 6 generator cd9ba3ec cmLocalVisualStudio7Generator: Fix name of helper function
| * Drop Visual Studio 6 generatorBrad King2016-03-091-4/+0
| | | | | | | | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* | VS: in Clang/C2 toolset, setup correct compiler settingsMariusz Pluciński2016-03-101-7/+23
|/
* Ninja: Refactor selection of 'deps = ' value for MS-compatible toolchainsBrad King2015-10-201-0/+2
| | | | | | Set variables in the platform information modules to tell the Ninja generator what deps type to use instead of hard-coding conditions in the generator itself.
* MSVC: Add system libs for WindowsStore on VS 2015Gilles Khouzam2015-10-021-1/+3
| | | | Use WindowsApp.lib for a Universal Application Platform project.
* Add support for *.manifest source files with MSVC toolsBrad King2015-09-171-2/+2
| | | | | | | | Classify .manifest sources separately, add dependencies on them, and pass them to the MS manifest tool to merge with linker-generated manifest files. Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
* MSVC: Rewrite manifest file handling with Makefile and NinjaBrad King2015-09-171-2/+2
| | | | | | | | | Add a helper class private to "cmcmd.cxx" to contain the implementation. Update the link logic to use the intermediate files directory for each target to hold manifest and resource files before embedding into the binary. Preserve the old behavior of placing the .manifest file next to the binary when not linking incrementally even though it will be embedded.
* Factor an <INCLUDES> placeholder out of <FLAGS> in rule variablesBrad King2015-07-131-3/+3
| | | | | | | | | | | Teach the Makefile and Ninja generators to substitute for an <INCLUDES> placeholder instead of putting -I in <FLAGS>. Update our values for CMAKE_<LANG>_COMPILE_OBJECT, CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE, and CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE to place <INCLUDES> just before <FLAGS>.
* Place <DEFINES> before <FLAGS> consistently across compilersBrad King2015-07-131-3/+3
| | | | | | | | | | | | Update our values for CMAKE_<LANG>_COMPILE_OBJECT, CMAKE_<LANG>_CREATE_ASSEMBLY_SOURCE, and CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE to place <DEFINES> before <FLAGS> consistently across supported compilers. We already do this for most compilers, so update the rest for consistency.
* Merge topic 'auto_export_dll_symbols'Brad King2015-07-081-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | 8f86407c Windows: Optionally generate DLL module definition files automatically 069aa93b bindexplib: Add support for "/bigobj" format objects 61bbbdcf bindexplib: Fix treatment of some symbols de70c922 bindexplib: Teach DumpFile to return errors 8ea69dfe bindexplib: Build source as part of CMakeLib 2963cb2a bindexplib: Wrap long lines 4ff09893 bindexplib: Drop code that CMake does not need 7de8276c bindexplib: Add copyright/license notice block 65086ad7 bindexplib: Import original implementation from CERN
| * Windows: Optionally generate DLL module definition files automaticallyBill Hoffman2015-07-061-0/+2
| | | | | | | | | | | | | | Create target property WINDOWS_EXPORT_ALL_SYMBOLS to automatically generate a module definition file from MS-compatible .obj files and give it to the linker in order to export all symbols from the .dll part of a SHARED library.
* | VS: Add /machine: flag to Librarian tool (#11240)Brad King2015-06-261-0/+1
|/ | | | | | | | If a Windows resource (.rc) source file is included in a STATIC library, the VS "link" tool will process the compiled ".res" file and needs to know the target architecture. Without it, we may get a LNK4068 warning and possibly a LNK1112 error. Add /machine: to the default static library flags to give the link tool the information it needs.
* RC: Simplify selection of resource compiler based on C/C++ toolchainBrad King2015-05-071-0/+3
| | | | | | | | | | Revert the refactoring by commit v2.8.11~105^2~1 (Ninja: use MinGW generator code in EnableLanguage, 2013-03-09) and move the MinGW- specific logic back to the "MinGW Makefiles" generator. Instead teach the platform information modules for GNU and MSVC on Windows to set the preferred RC compiler just before enabling the RC language. This way we choose the RC compiler based on the C/C++ toolchain that is actually enabled.
* Merge topic 'windows-rc-enable-later'Brad King2015-02-261-4/+6
|\ | | | | | | | | | | | | 772eae44 RC: Add platform-specific preprocessor definitions (#15404) 4300de3e RC: Enable language after C, CXX, or Fortran is enabled (#15404) 1de4a0fb RC: Drop unused CMAKE_COMPILE_RESOURCE variable setting
| * RC: Add platform-specific preprocessor definitions (#15404)Brad King2015-02-251-0/+4
| | | | | | | | | | | | | | | | | | | | In Platform/Windows-MSVC the C and CXX flags are initialized to contain preprocessor definitions describing the platform. On WinCE platforms this may not be just -DWIN32. This information may be important to RC sources too, so add such preprocessor definitions to the default RC flags. Suggested-by: Gunnar Roth <gunnar.roth@gmx.de>
| * RC: Enable language after C, CXX, or Fortran is enabled (#15404)Brad King2015-02-251-3/+2
| | | | | | | | | | | | | | | | The RC language is special in that it is automatically enabled on Windows-based platforms when another primary language is enabled. Move enablement of RC from early in the enablement of the other language to late. This will allow it to use information detected as part of enabling C, CXX, or Fortran.
| * RC: Drop unused CMAKE_COMPILE_RESOURCE variable settingBrad King2015-02-251-1/+0
| | | | | | | | | | This variable has long been replaced by CMAKE_RC_COMPILE_OBJECT. Stop setting it in platform modules.
* | MSVC: Compile with arch-specific flags on ARM platforms (#14552)Gunnar Roth2015-02-241-0/+11
| | | | | | | | | | Define the exact ARM architecture name as a preprocessor symbol. Compile with /QRarch4T or /QRarch5T on ARMV4I or ARMV5I.
* | MSVC: Distinguish among ARM architectures more precisely (#14552)Gunnar Roth2015-02-241-10/+26
| | | | | | | | | | Detect the exact ARM architecture instead of just "ARM". Treat "ARM" as an architecture family that includes THUMB (ARMV4I and ARMV5I).
* | MSVC: Define /DWINCE when building for WinCE platforms (#14552)Gunnar Roth2015-02-241-1/+1
|/
* MSVC: Fix initialization of RelWithDebInfo shared library link flags (#15385)Brad King2015-02-031-1/+1
| | | | | | | | | | Initialize CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT from the value of CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT rather than the one for the DEBUG configuration. This typo has been present since the logic was first added in commit 36db45082e (ENH: fix up several problems with new stuff, 2002-11-11). Reported-by: Gunnar Roth <gunnar.roth@gmx.de>
* MSVC: Define 'WIN32' for Windows Store and Windows PhoneGilles Khouzam2014-09-021-0/+1
| | | | | This was accidentally left out of commit c72f0887 (MSVC: Add default WindowsPhone and WindowsStore compile flags, 2014-07-28).
* MSVC: Select default standard libraries for ARM platformBrad King2014-08-121-1/+5
| | | | For Windows ARM targets, only kernel32.lib and user32.lib are standard.
* MSVC: Add system libs for WindowsPhone and WindowsStoreBrad King2014-07-311-1/+5
| | | | | Use the libraries that are added by default by the VS 2013 IDE for Windows Phone and Windows Store projects.
* MSVC: Add default WindowsPhone and WindowsStore compile flagsPaul Annetts2014-07-311-0/+4
| | | | Also set the list of standard libraries to empty.
* MSVC: Disable incremental linking for WindowsPhone and WindowsStoreGilles Khouzam2014-07-311-4/+6
| | | | | Do not add a "/INCREMENTAL" flag when using the toolchains for these systems.