diff options
author | Brad King <brad.king@kitware.com> | 2012-03-19 17:11:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-19 17:11:27 (GMT) |
commit | 93d5509b5b1c208f3ed28daf35f9384ab6918441 (patch) | |
tree | 6d093568d5688670946f0c8ce5c58b8a8a555ca2 /Modules | |
parent | 821037cf2e7847ed00e869f2188e20d84379a6db (diff) | |
parent | 2693dbe085d78951f62487e37e7d75eb4cf7bfdd (diff) | |
download | CMake-93d5509b5b1c208f3ed28daf35f9384ab6918441.zip CMake-93d5509b5b1c208f3ed28daf35f9384ab6918441.tar.gz CMake-93d5509b5b1c208f3ed28daf35f9384ab6918441.tar.bz2 |
Merge branch 'ninja-object-library' into object-library
* ninja-object-library: (37 commits)
Ninja: Honor $<TARGET_OBJECTS:...> source expressions
Build object library targets in Ninja
Pre-compute object file names before Ninja generation
Simplify cmNinjaTargetGenerator using cmGeneratorTarget
Ninja: Avoid using 'this' in member initializers
Ninja: Fix for PDB files with spaces in the path.
Ninja: Constify use of cmCustomCommand
Ninja: add /DEF: flag to linker call
Ninja: Add a cache option CMAKE_ENABLE_NINJA to enable the ninja generator.
Ninja: Add friend struct so it can access the private ConvertToNinjaPath.
Ninja: add .def file support
Ninja: ensure the output dir exists at compile time
Ninja: Remove an unnecessary variable
Ninja: Use cmSystemTools::ExpandListArgument to split compile/link commands
Ninja: Add a missed license header
Ninja: CMake: Adapt Ninja generator for per-target include dirs
Ninja: windows msvc: create for each target a .pdb file
Ninja: Import library support for Windows
Ninja: mark the Windows specific hacks with a comment only
Ninja: disable unfinished Windows ninja support
...
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeNinjaFindMake.cmake | 17 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 9 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 19 | ||||
-rw-r--r-- | Modules/Platform/Windows-cl.cmake | 4 |
4 files changed, 45 insertions, 4 deletions
diff --git a/Modules/CMakeNinjaFindMake.cmake b/Modules/CMakeNinjaFindMake.cmake new file mode 100644 index 0000000..f15c3e0 --- /dev/null +++ b/Modules/CMakeNinjaFindMake.cmake @@ -0,0 +1,17 @@ + +#============================================================================= +# Copyright 2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +FIND_PROGRAM(CMAKE_MAKE_PROGRAM ninja + DOC "Program used to build from build.ninja files.") +MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 8d6f5df..bdcaf9d 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -24,6 +24,15 @@ macro(__compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") + # Older versions of gcc (< 4.5) contain a bug causing them to report a missing + # header file as a warning if depfiles are enabled, causing check_header_file + # tests to always succeed. Work around this by disabling dependency tracking + # in try_compile mode. + GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE) + if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES) + set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MF <DEPFILE>") + endif() + # Initial configuration flags. set(CMAKE_${lang}_FLAGS_INIT "") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index fb55d3b..b6fe190 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -833,6 +833,12 @@ function(ExternalProject_Add_StepTargets name) foreach(step ${steps}) add_custom_target(${name}-${step} DEPENDS ${stamp_dir}${cfgdir}/${name}-${step}) + + # Depend on other external projects (target-level). + get_property(deps TARGET ${name} PROPERTY _EP_DEPENDS) + foreach(arg IN LISTS deps) + add_dependencies(${name}-${step} ${arg}) + endforeach() endforeach() endfunction(ExternalProject_Add_StepTargets) @@ -1451,9 +1457,18 @@ function(ExternalProject_Add name) # depends on the 'done' mark so that it rebuilds when this project # rebuilds. It is important that 'done' is not the output of any # custom command so that CMake does not propagate build rules to - # other external project targets. + # other external project targets, which may cause problems during + # parallel builds. However, the Ninja generator needs to see the entire + # dependency graph, and can cope with custom commands belonging to + # multiple targets, so we add the 'done' mark as an output for Ninja only. + set(complete_outputs ${cmf_dir}${cfgdir}/${name}-complete) + if(${CMAKE_GENERATOR} MATCHES "Ninja") + set(complete_outputs + ${complete_outputs} ${stamp_dir}${cfgdir}/${name}-done) + endif() + add_custom_command( - OUTPUT ${cmf_dir}${cfgdir}/${name}-complete + OUTPUT ${complete_outputs} COMMENT "Completed '${name}'" COMMAND ${CMAKE_COMMAND} -E make_directory ${cmf_dir}${cfgdir} COMMAND ${CMAKE_COMMAND} -E touch ${cmf_dir}${cfgdir}/${name}-complete diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index ccccbc9..be6abb6 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -37,7 +37,7 @@ SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") # that is automatically copied into try_compile directories # by the global generator. SET(MSVC_IDE 1) -IF(CMAKE_GENERATOR MATCHES "Makefiles") +IF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") SET(MSVC_IDE 0) IF(NOT CMAKE_VC_COMPILER_TESTS_RUN) SET(CMAKE_VC_COMPILER_TESTS 1) @@ -125,7 +125,7 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles") ENDIF(CMAKE_COMPILER_RETURN) MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN) -ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") +ENDIF(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") IF(MSVC_C_ARCHITECTURE_ID MATCHES 64) SET(CMAKE_CL_64 1) |