From c736de7b284ecc93bac48106e88417e0e6c92ad6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 13 Jul 2015 10:35:04 -0400 Subject: Factor an placeholder out of in rule variables Teach the Makefile and Ninja generators to substitute for an placeholder instead of putting -I in . Update our values for CMAKE__COMPILE_OBJECT, CMAKE__CREATE_ASSEMBLY_SOURCE, and CMAKE__CREATE_PREPROCESSED_SOURCE to place just before . --- Modules/CMakeASMInformation.cmake | 2 +- Modules/CMakeASM_MASMInformation.cmake | 2 +- Modules/CMakeCInformation.cmake | 2 +- Modules/CMakeCXXInformation.cmake | 2 +- Modules/CMakeFortranInformation.cmake | 2 +- Modules/CMakeRCInformation.cmake | 2 +- Modules/Compiler/GNU.cmake | 4 ++-- Modules/Compiler/HP-C.cmake | 4 ++-- Modules/Compiler/HP-CXX.cmake | 4 ++-- Modules/Compiler/HP-Fortran.cmake | 4 ++-- Modules/Compiler/IAR-ASM.cmake | 2 +- Modules/Compiler/IAR-C.cmake | 6 +++--- Modules/Compiler/IAR-CXX.cmake | 6 +++--- Modules/Compiler/Intel-C.cmake | 4 ++-- Modules/Compiler/Intel-CXX.cmake | 4 ++-- Modules/Compiler/Intel-Fortran.cmake | 4 ++-- Modules/Compiler/PGI.cmake | 4 ++-- Modules/Compiler/QCC-CXX.cmake | 2 +- Modules/Compiler/SunPro-C.cmake | 4 ++-- Modules/Compiler/SunPro-CXX.cmake | 4 ++-- Modules/Compiler/SunPro-Fortran.cmake | 4 ++-- Modules/Compiler/TI-ASM.cmake | 2 +- Modules/Compiler/TI-C.cmake | 6 +++--- Modules/Compiler/TI-CXX.cmake | 6 +++--- Modules/Compiler/XL-CXX.cmake | 2 +- Modules/Compiler/XL.cmake | 4 ++-- Modules/Platform/BlueGeneQ-base.cmake | 4 ++-- Modules/Platform/CYGWIN-windres.cmake | 2 +- Modules/Platform/Darwin-NAG-Fortran.cmake | 2 +- Modules/Platform/Generic-SDCC-C.cmake | 2 +- Modules/Platform/HP-UX-HP-C.cmake | 6 +++--- Modules/Platform/HP-UX-HP-CXX.cmake | 4 ++-- Modules/Platform/HP-UX-HP-Fortran.cmake | 4 ++-- Modules/Platform/IRIX64.cmake | 8 ++++---- Modules/Platform/Windows-Embarcadero.cmake | 4 ++-- Modules/Platform/Windows-MSVC.cmake | 6 +++--- Modules/Platform/Windows-wcl386.cmake | 8 ++++---- Modules/Platform/Windows-windres.cmake | 2 +- Source/cmCommonTargetGenerator.cxx | 16 +++++++++++++--- Source/cmCommonTargetGenerator.h | 2 ++ Source/cmLocalGenerator.cxx | 4 ++++ Source/cmLocalGenerator.h | 1 + Source/cmMakefileTargetGenerator.cxx | 9 +++++++++ Source/cmNinjaTargetGenerator.cxx | 3 +++ 44 files changed, 104 insertions(+), 75 deletions(-) diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index 62ef972..0e547c4 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -108,7 +108,7 @@ mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_FLAGS if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) - set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") + set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o -c ") endif() if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY) diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake index 972883c..bd76b98 100644 --- a/Modules/CMakeASM_MASMInformation.cmake +++ b/Modules/CMakeASM_MASMInformation.cmake @@ -18,7 +18,7 @@ set(ASM_DIALECT "_MASM") set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) -set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") +set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " /c /Fo ") include(CMakeASMInformation) set(ASM_DIALECT) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 332b26e..7bcbb19 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -187,7 +187,7 @@ endif() # compile a C file into an object file if(NOT CMAKE_C_COMPILE_OBJECT) set(CMAKE_C_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_C_LINK_EXECUTABLE) diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 72b2857..1aac9d3 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -278,7 +278,7 @@ endif() # compile a C++ file into an object file if(NOT CMAKE_CXX_COMPILE_OBJECT) set(CMAKE_CXX_COMPILE_OBJECT - " -o -c ") + " -o -c ") endif() if(NOT CMAKE_CXX_LINK_EXECUTABLE) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index d638207..835ffcf 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -207,7 +207,7 @@ endif() # (put -o after -c to workaround bug in at least one mpif77 wrapper) if(NOT CMAKE_Fortran_COMPILE_OBJECT) set(CMAKE_Fortran_COMPILE_OBJECT - " -c -o ") + " -c -o ") endif() # link a fortran program diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 27bb416..94abd4b 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -44,7 +44,7 @@ set(CMAKE_INCLUDE_FLAG_RC "-I") # compile a Resource file into an object file if(NOT CMAKE_RC_COMPILE_OBJECT) set(CMAKE_RC_COMPILE_OBJECT - " /fo ") + " /fo ") endif() mark_as_advanced( diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index f01255c..764fbf9 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -50,8 +50,8 @@ macro(__compiler_gnu lang) set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O3 -DNDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") if(NOT APPLE) set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") endif() diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake index 6dddcba..b42ba2b 100644 --- a/Modules/Compiler/HP-C.cmake +++ b/Modules/Compiler/HP-C.cmake @@ -1,4 +1,4 @@ set(CMAKE_C_VERBOSE_FLAG "-v") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake index 6411dac..7548754 100644 --- a/Modules/Compiler/HP-CXX.cmake +++ b/Modules/Compiler/HP-CXX.cmake @@ -1,7 +1,7 @@ set(CMAKE_CXX_VERBOSE_FLAG "-v") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") # HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98 # template support. It is known that version 6.25 doesn't need that flag. diff --git a/Modules/Compiler/HP-Fortran.cmake b/Modules/Compiler/HP-Fortran.cmake index ad821ab..a6ca2c2 100644 --- a/Modules/Compiler/HP-Fortran.cmake +++ b/Modules/Compiler/HP-Fortran.cmake @@ -2,5 +2,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "+source=fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "+source=free") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index 66fb052..844c30e 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -2,7 +2,7 @@ include(Compiler/IAR) -set(CMAKE_ASM_COMPILE_OBJECT " -o ") +set(CMAKE_ASM_COMPILE_OBJECT " -o ") if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm;msa) diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index da29447..d2c7df9 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -3,9 +3,9 @@ include(Compiler/IAR) -set(CMAKE_C_COMPILE_OBJECT " -o ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_C_COMPILE_OBJECT " -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") # The toolchains for ARM and AVR are quite different: if("${IAR_TARGET_ARCHITECTURE}" STREQUAL "ARM") diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index eae9d1b..03ecdf1 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -2,10 +2,10 @@ include(Compiler/IAR) -set(CMAKE_CXX_COMPILE_OBJECT " -o ") +set(CMAKE_CXX_COMPILE_OBJECT " -o ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preprocess=cnl ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -lAH -o .dummy") diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 1d651e3..dfba4b2 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -8,5 +8,5 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_C "-MMD -MT -MF ") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 020e862..7947695 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -8,5 +8,5 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_CXX "-MMD -MT -MF ") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index 9ebac5a..671d284 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -8,5 +8,5 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-v") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/PGI.cmake b/Modules/Compiler/PGI.cmake index 162e3c9..797945f 100644 --- a/Modules/Compiler/PGI.cmake +++ b/Modules/Compiler/PGI.cmake @@ -30,6 +30,6 @@ macro(__compiler_pgi lang) set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -gopt") # Preprocessing and assembly rules. - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") endmacro() diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake index a676bbe..e86d1fa 100644 --- a/Modules/Compiler/QCC-CXX.cmake +++ b/Modules/Compiler/QCC-CXX.cmake @@ -4,7 +4,7 @@ __compiler_qcc(CXX) # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the # default for the driver is not c++. set(CMAKE_CXX_COMPILE_OBJECT - " -lang-c++ -o -c ") + " -lang-c++ -o -c ") set(CMAKE_CXX_LINK_EXECUTABLE " -lang-c++ -o ") diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake index 92252cb..c452983 100644 --- a/Modules/Compiler/SunPro-C.cmake +++ b/Modules/Compiler/SunPro-C.cmake @@ -22,5 +22,5 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic") endforeach() -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index 022b4d4..e0c02d9 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -22,8 +22,8 @@ foreach(type SHARED_LIBRARY SHARED_MODULE EXE) set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic") endforeach() -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " -S -o ") # Create archives with "CC -xar" in case user adds "-instances=extern" # so that template instantiations are available to archive members. diff --git a/Modules/Compiler/SunPro-Fortran.cmake b/Modules/Compiler/SunPro-Fortran.cmake index 196aae4..610e191 100644 --- a/Modules/Compiler/SunPro-Fortran.cmake +++ b/Modules/Compiler/SunPro-Fortran.cmake @@ -18,5 +18,5 @@ set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG") set(CMAKE_Fortran_MODDIR_FLAG "-moddir=") set(CMAKE_Fortran_MODPATH_FLAG "-M") -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -F -o ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Compiler/TI-ASM.cmake b/Modules/Compiler/TI-ASM.cmake index e097626..a566d70 100644 --- a/Modules/Compiler/TI-ASM.cmake +++ b/Modules/Compiler/TI-ASM.cmake @@ -2,7 +2,7 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_ASM "--include_path=") -set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") +set(CMAKE_ASM_COMPILE_OBJECT " --compile_only --asm_file= --output_file=") set(CMAKE_ASM_LINK_EXECUTABLE " --run_linker --output_file= ") set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs) diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index b580994..479666c 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_C "--include_path=") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") -set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") +set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") set(CMAKE_C_ARCHIVE_CREATE " -r ") set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 8cf5ac3..4104c3b 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -2,9 +2,9 @@ set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") set(CMAKE_LINK_LIBRARY_FLAG "--library=") set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") -set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") +set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") set(CMAKE_CXX_ARCHIVE_CREATE " -r ") set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 6c842cd..41372c1 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -8,4 +8,4 @@ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT} -DNDEBUG set(CMAKE_CXX_FLAGS_INIT "-qthreaded -qhalt=e") set(CMAKE_CXX_COMPILE_OBJECT - " -+ -o -c ") + " -+ -o -c ") diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 7bf5020..bf4f554 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -33,8 +33,8 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O") set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-g") - set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") - set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " -E > ") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " -S -o ") # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. # If we found the tool, we'll use it to create exports, otherwise stick with the regular diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake index fa8dc52..9372166 100644 --- a/Modules/Platform/BlueGeneQ-base.cmake +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -112,8 +112,8 @@ macro(__BlueGeneQ_common_setup compiler_id lang) foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") endforeach() - set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") - set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") + set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") # # Code below does setup for shared libraries. That this is done diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake index c082b5d..7d787dd 100644 --- a/Modules/Platform/CYGWIN-windres.cmake +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake index 4c28e62..e3ac9b5 100644 --- a/Modules/Platform/Darwin-NAG-Fortran.cmake +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -16,7 +16,7 @@ set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. # Need -fpp explicitly on case-insensitive filesystem. set(CMAKE_Fortran_COMPILE_OBJECT - " -fpp -o -c ") + " -fpp -o -c ") set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,") set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,") diff --git a/Modules/Platform/Generic-SDCC-C.cmake b/Modules/Platform/Generic-SDCC-C.cmake index 588bf32..a1ca812 100644 --- a/Modules/Platform/Generic-SDCC-C.cmake +++ b/Modules/Platform/Generic-SDCC-C.cmake @@ -38,7 +38,7 @@ if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS_INIT) endif() # compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT " -o -c ") +set(CMAKE_C_COMPILE_OBJECT " -o -c ") # link object files to an executable set(CMAKE_C_LINK_EXECUTABLE " --out-fmt-ihx -o ") diff --git a/Modules/Platform/HP-UX-HP-C.cmake b/Modules/Platform/HP-UX-HP-C.cmake index 1000935..7610383 100644 --- a/Modules/Platform/HP-UX-HP-C.cmake +++ b/Modules/Platform/HP-UX-HP-C.cmake @@ -1,6 +1,6 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(C) -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") +set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_C_COMPILE_OBJECT " -Aa -Ae -o -c ") diff --git a/Modules/Platform/HP-UX-HP-CXX.cmake b/Modules/Platform/HP-UX-HP-CXX.cmake index dfa1e4e..6d90191 100644 --- a/Modules/Platform/HP-UX-HP-CXX.cmake +++ b/Modules/Platform/HP-UX-HP-CXX.cmake @@ -1,9 +1,9 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(CXX) -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " "rm -f `basename \"\" | sed 's/\\.[^./]*$$//'`.o" ) diff --git a/Modules/Platform/HP-UX-HP-Fortran.cmake b/Modules/Platform/HP-UX-HP-Fortran.cmake index e5c5d10..12007e4 100644 --- a/Modules/Platform/HP-UX-HP-Fortran.cmake +++ b/Modules/Platform/HP-UX-HP-Fortran.cmake @@ -1,5 +1,5 @@ include(Platform/HP-UX-HP) __hpux_compiler_hp(Fortran) -set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") -set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") +set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") +set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index 5acbd81..ee9b96e 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -44,17 +44,17 @@ endif() include(Platform/UnixPaths) if(NOT CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_C_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_C_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() if(NOT CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") + set (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " -E > ") set (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " -S " + " -S " "mv `basename \"\" | sed 's/\\.[^./]*$$//'`.s " ) endif() diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 04f6bc2..5295a48e 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -90,7 +90,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_COMPILE_OBJECT - " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " + " ${_tR} -DWIN32 -o ${_COMPILE_${lang}} " ) set(CMAKE_${lang}_LINK_EXECUTABLE @@ -101,7 +101,7 @@ macro(__embarcadero_language lang) # place outside the response file because Borland refuses # to parse quotes from the response file. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " + "cpp32 -DWIN32 -o ${_COMPILE_${lang}} " ) # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b1e38cf..94470c3 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -284,11 +284,11 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") set(CMAKE_${lang}_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd${_FS_${lang}} -c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) set(CMAKE_${lang}_LINK_EXECUTABLE diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index d532566..3bc5444 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -58,19 +58,19 @@ set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) # compile a C++ file into an object file set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc++ ${CMAKE_END_TEMP_FILE}") # compile a C file into an object file set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -c -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C source file set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc ${CMAKE_END_TEMP_FILE}") # preprocess a C++ source file set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name option implib= file {} ${CMAKE_END_TEMP_FILE}") diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake index c082b5d..7d787dd 100644 --- a/Modules/Platform/Windows-windres.cmake +++ b/Modules/Platform/Windows-windres.cmake @@ -1 +1 @@ -set(CMAKE_RC_COMPILE_OBJECT " -O coff ") +set(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index ce351ee..2225fdc 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -312,9 +312,6 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string &l) this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang); - // Add include directory flags. - this->AddIncludeFlags(flags, lang); - // Append old-style preprocessor definition flags. this->LocalGenerator-> AppendFlags(flags, this->Makefile->GetDefineFlags()); @@ -358,3 +355,16 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l) } return i->second; } + +std::string cmCommonTargetGenerator::GetIncludes(std::string const& l) +{ + ByLanguageMap::iterator i = this->IncludesByLanguage.find(l); + if (i == this->IncludesByLanguage.end()) + { + std::string includes; + this->AddIncludeFlags(includes, l); + ByLanguageMap::value_type entry(l, includes); + i = this->IncludesByLanguage.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index e184dba..5451a5a 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -83,6 +83,8 @@ protected: ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); ByLanguageMap DefinesByLanguage; + std::string GetIncludes(std::string const& l); + ByLanguageMap IncludesByLanguage; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e170253..5c9ee0e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -766,6 +766,10 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, { return replaceValues.Defines; } + if(replaceValues.Includes && variable == "INCLUDES") + { + return replaceValues.Includes; + } if(replaceValues.TargetPDB ) { if(variable == "TARGET_PDB") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 98f4d3a..2dfe825 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -230,6 +230,7 @@ public: const char* LinkFlags; const char* LanguageCompileFlags; const char* Defines; + const char* Includes; const char* RuleLauncher; const char* DependencyFile; const char* FilterPrefix; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ef4bbbe..9cac5bd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -295,11 +295,14 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { std::string flags = this->GetFlags(*l); std::string defines = this->GetDefines(*l); + std::string includes = this->GetIncludes(*l); // Escape comment characters so they do not terminate assignment. cmSystemTools::ReplaceString(flags, "#", "\\#"); cmSystemTools::ReplaceString(defines, "#", "\\#"); + cmSystemTools::ReplaceString(includes, "#", "\\#"); *this->FlagFileStream << *l << "_FLAGS = " << flags << "\n\n"; *this->FlagFileStream << *l << "_DEFINES = " << defines << "\n\n"; + *this->FlagFileStream << *l << "_INCLUDES = " << includes << "\n\n"; } } @@ -611,6 +614,9 @@ cmMakefileTargetGenerator vars.Defines = definesString.c_str(); + std::string const includesString = "$(" + lang + "_INCLUDES)"; + vars.Includes = includesString.c_str(); + // At the moment, it is assumed that C, C++, and Fortran have both // assembly and preprocessor capabilities. The same is true for the // ability to export compile commands @@ -643,6 +649,9 @@ cmMakefileTargetGenerator std::string langDefines = std::string("$(") + lang + "_DEFINES)"; compileCommand.replace(compileCommand.find(langDefines), langDefines.size(), this->GetDefines(lang)); + std::string langIncludes = std::string("$(") + lang + "_INCLUDES)"; + compileCommand.replace(compileCommand.find(langIncludes), + langIncludes.size(), this->GetIncludes(lang)); this->GlobalGenerator->AddCXXCompileCommand( source.GetFullPath(), workingDirectory, compileCommand); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a72bc72..3441149 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -315,6 +315,7 @@ cmNinjaTargetGenerator vars.Source = "$in"; vars.Object = "$out"; vars.Defines = "$DEFINES"; + vars.Includes = "$INCLUDES"; vars.TargetPDB = "$TARGET_PDB"; vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; @@ -592,6 +593,7 @@ cmNinjaTargetGenerator cmNinjaVars vars; vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); + vars["INCLUDES"] = this->GetIncludes(language); if (!this->NeedDepTypeMSVC(language)) { vars["DEP_FILE"] = cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); @@ -637,6 +639,7 @@ cmNinjaTargetGenerator compileObjectVars.ObjectFileDir = objectFileDir.c_str(); compileObjectVars.Flags = vars["FLAGS"].c_str(); compileObjectVars.Defines = vars["DEFINES"].c_str(); + compileObjectVars.Includes = vars["INCLUDES"].c_str(); // Rule for compiling object file. std::string compileCmdVar = "CMAKE_"; -- cgit v0.12