From 28dcccfaced3c3f0a8a751cf31ae108bf6c8dda7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 19 Feb 2014 09:30:37 -0500 Subject: [PATCH 001/278] Begin post-3.0 development --- Help/release/dev/0-sample-topic.rst | 7 +++++++ Help/release/index.rst | 2 ++ Source/CMakeVersion.cmake | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Help/release/dev/0-sample-topic.rst diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 000000000..e4cc01e23 --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 752c5685e..15ce06565 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,6 +5,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5ce43f56c..abe9a6689 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 1) +set(CMake_VERSION_PATCH 20140219) +#set(CMake_VERSION_RC 1) From 44e784342d34d63db79214203108e3f968992d15 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 20 Feb 2014 00:01:10 -0500 Subject: [PATCH 002/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index abe9a6689..7db058788 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140219) +set(CMake_VERSION_PATCH 20140220) #set(CMake_VERSION_RC 1) From c0bbefbfe7209e849c04f57e79908401ba825fe0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 21 Feb 2014 00:01:11 -0500 Subject: [PATCH 003/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7db058788..0c481addf 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140220) +set(CMake_VERSION_PATCH 20140221) #set(CMake_VERSION_RC 1) From 73e5c6aead4d2c748ced061a7de27f2ffc7e2d31 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Feb 2014 10:59:06 -0500 Subject: [PATCH 004/278] ExternalProject: Add option to always run the build step Teach ExternalProject_Add a new BUILD_ALWAYS option to skip using the build step stamp file and execute the step on every build. Extend the BuildDepends test with a case to cover this option. --- Modules/ExternalProject.cmake | 9 ++++++ Tests/BuildDepends/CMakeLists.txt | 30 +++++++++++++++++++ Tests/BuildDepends/Project/CMakeLists.txt | 12 ++++++++ .../Project/External/CMakeLists.txt | 14 +++++++++ 4 files changed, 65 insertions(+) create mode 100644 Tests/BuildDepends/Project/External/CMakeLists.txt diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0df51a878..1e8316319 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -54,6 +54,7 @@ # [BINARY_DIR dir] # Specify build dir location # [BUILD_COMMAND cmd...] # Command to drive the native build # [BUILD_IN_SOURCE 1] # Use source dir for build dir +# [BUILD_ALWAYS 1] # No stamp file, build step always runs # #--Install step--------------- # [INSTALL_DIR dir] # Installation prefix # [INSTALL_COMMAND cmd...] # Command to drive install after build @@ -1716,10 +1717,18 @@ function(_ep_add_build_command name) set(log "") endif() + get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS) + if(build_always) + set(always 1) + else() + set(always 0) + endif() + ExternalProject_Add_Step(${name} build COMMAND ${cmd} WORKING_DIRECTORY ${binary_dir} DEPENDEES configure + ALWAYS ${always} ${log} ) endfunction() diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 972793046..a875f0757 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -68,6 +68,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h "#define link_depends_no_shared_exe_value 0\n") set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) +file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") + help_xcode_depends() message("Building project first time") @@ -166,6 +168,19 @@ else() "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) + file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) + if("${external_out}" STREQUAL "external original") + message(STATUS "external.out contains '${external_out}'") + else() + message(SEND_ERROR "Project did not initially build properly: " + "external.out contains '${external_out}'") + endif() +else() + message(SEND_ERROR "Project did not initially build properly: " + "external.out is missing") +endif() + message("Waiting 3 seconds...") # any additional argument will cause ${bar} to wait forever execute_process(COMMAND ${bar} -infinite TIMEOUT 3 OUTPUT_VARIABLE out) @@ -191,6 +206,8 @@ if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() +file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n") + help_xcode_depends() message("Building project second time") @@ -294,3 +311,16 @@ else() message(SEND_ERROR "Project did not rebuild properly. " "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() + +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) + file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) + if("${external_out}" STREQUAL "external changed") + message(STATUS "external.out contains '${external_out}'") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "external.out contains '${external_out}'") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly: " + "external.out is missing") +endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 8806ecdf1..9ee4a43aa 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -139,3 +139,15 @@ add_custom_target(header_tgt DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dir/header.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(ninjadep ninjadep.cpp) add_dependencies(ninjadep header_tgt) + +include(ExternalProject) +ExternalProject_Add(ExternalBuild + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/External + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/External + STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/External/Stamp + BUILD_ALWAYS 1 + CMAKE_ARGS + -Dexternal_in=${CMAKE_CURRENT_BINARY_DIR}/external.in + -Dexternal_out=${CMAKE_CURRENT_BINARY_DIR}/external.out + INSTALL_COMMAND "" + ) diff --git a/Tests/BuildDepends/Project/External/CMakeLists.txt b/Tests/BuildDepends/Project/External/CMakeLists.txt new file mode 100644 index 000000000..c6015b651 --- /dev/null +++ b/Tests/BuildDepends/Project/External/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.0) +project(BuildDependsExternal NONE) +if(NOT DEFINED external_in) + message(FATAL_ERROR "Define external_in") +endif() +if(NOT DEFINED external_out) + message(FATAL_ERROR "Define external_out") +endif() +add_custom_command( + OUTPUT ${external_out} + COMMAND ${CMAKE_COMMAND} -E copy ${external_in} ${external_out} + DEPENDS ${external_in} + ) +add_custom_target(drive ALL DEPENDS ${external_out}) From a9bdef2dda7985762e2eae7e6ae323606d917b4e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 17:53:31 -0500 Subject: [PATCH 005/278] tests: Add variable expansion tests There are some corner cases in variable expansion which would be nice to capture before going and rewriting the variable expansion code. The majority of these are related to configuring files and strings with '@' in them in conjunction with @ONLY being specified. Another is testing for '(' usage inside of ENV variable references based on whether it is quoted or not. --- .../RunCMake/Syntax/AtWithVariable-stderr.txt | 1 + Tests/RunCMake/Syntax/AtWithVariable.cmake | 9 +++++++++ .../Syntax/AtWithVariableAtOnly-stderr.txt | 1 + .../Syntax/AtWithVariableAtOnly.cmake | 8 ++++++++ .../AtWithVariableAtOnlyFile-stderr.txt | 5 +++++ .../Syntax/AtWithVariableAtOnlyFile.cmake | 9 +++++++++ .../AtWithVariableEmptyExpansion-stderr.txt | 1 + .../Syntax/AtWithVariableEmptyExpansion.cmake | 8 ++++++++ ...ithVariableEmptyExpansionAtOnly-stderr.txt | 1 + .../AtWithVariableEmptyExpansionAtOnly.cmake | 8 ++++++++ .../Syntax/AtWithVariableFile-stderr.txt | 5 +++++ .../RunCMake/Syntax/AtWithVariableFile.cmake | 8 ++++++++ Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt | 1 + Tests/RunCMake/Syntax/EscapeQuotes.cmake | 9 +++++++++ Tests/RunCMake/Syntax/EscapedAt-stderr.txt | 1 + Tests/RunCMake/Syntax/EscapedAt.cmake | 5 +++++ Tests/RunCMake/Syntax/ExpandInAt-stderr.txt | 1 + Tests/RunCMake/Syntax/ExpandInAt.cmake | 6 ++++++ Tests/RunCMake/Syntax/ParenInENV-result.txt | 1 + Tests/RunCMake/Syntax/ParenInENV-stderr.txt | 20 +++++++++++++++++++ Tests/RunCMake/Syntax/ParenInENV.cmake | 2 ++ .../Syntax/ParenInQuotedENV-stderr.txt | 1 + Tests/RunCMake/Syntax/ParenInQuotedENV.cmake | 2 ++ Tests/RunCMake/Syntax/RunCMakeTest.cmake | 13 ++++++++++++ Tests/RunCMake/Syntax/atfile.txt.in | 4 ++++ 25 files changed, 130 insertions(+) create mode 100644 Tests/RunCMake/Syntax/AtWithVariable-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariable.cmake create mode 100644 Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake create mode 100644 Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake create mode 100644 Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake create mode 100644 Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake create mode 100644 Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt create mode 100644 Tests/RunCMake/Syntax/AtWithVariableFile.cmake create mode 100644 Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt create mode 100644 Tests/RunCMake/Syntax/EscapeQuotes.cmake create mode 100644 Tests/RunCMake/Syntax/EscapedAt-stderr.txt create mode 100644 Tests/RunCMake/Syntax/EscapedAt.cmake create mode 100644 Tests/RunCMake/Syntax/ExpandInAt-stderr.txt create mode 100644 Tests/RunCMake/Syntax/ExpandInAt.cmake create mode 100644 Tests/RunCMake/Syntax/ParenInENV-result.txt create mode 100644 Tests/RunCMake/Syntax/ParenInENV-stderr.txt create mode 100644 Tests/RunCMake/Syntax/ParenInENV.cmake create mode 100644 Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt create mode 100644 Tests/RunCMake/Syntax/ParenInQuotedENV.cmake create mode 100644 Tests/RunCMake/Syntax/atfile.txt.in diff --git a/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt new file mode 100644 index 000000000..5dcd4d7a1 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariable-stderr.txt @@ -0,0 +1 @@ +-->wrong<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariable.cmake b/Tests/RunCMake/Syntax/AtWithVariable.cmake new file mode 100644 index 000000000..2bbf61db3 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariable.cmake @@ -0,0 +1,9 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here. +set(ref "@var@") + +# 'right' is dereferenced because 'var' was dereferenced when +# assigning to 'ref' above. +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt new file mode 100644 index 000000000..cbd1be472 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnly-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake b/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake new file mode 100644 index 000000000..e06484c22 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnly.cmake @@ -0,0 +1,8 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here. +set(ref "@var@") + +# No dereference done at all. +string(CONFIGURE "${ref}" output @ONLY) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt new file mode 100644 index 000000000..90bffb6c8 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile-stderr.txt @@ -0,0 +1,5 @@ +-->==>\${right}<== +==><== +==>\${var}<== +==>\${empty}<== +<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake new file mode 100644 index 000000000..bdd7bcd25 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableAtOnlyFile.cmake @@ -0,0 +1,9 @@ +set(right "wrong") +set(var "\${right}") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/atfile.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" + @ONLY) +file(READ "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt new file mode 100644 index 000000000..cbd1be472 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake new file mode 100644 index 000000000..840c7f0d6 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansion.cmake @@ -0,0 +1,8 @@ +# Literal since 'var' is not defined. +set(ref "@var@") +set(right "wrong") +set(var "\${right}") + +# 'var' is dereferenced here. +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt new file mode 100644 index 000000000..cbd1be472 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly-stderr.txt @@ -0,0 +1 @@ +-->\${right}<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake new file mode 100644 index 000000000..b657506be --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableEmptyExpansionAtOnly.cmake @@ -0,0 +1,8 @@ +# Literal since 'var' is not defined. +set(ref "@var@") +set(right "wrong") +set(var "\${right}") + +# 'var' is dereferenced, but now 'right' +string(CONFIGURE "${ref}" output @ONLY) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt b/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt new file mode 100644 index 000000000..43f029fe0 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableFile-stderr.txt @@ -0,0 +1,5 @@ +-->==>\${right}<== +==><== +==>\${right}<== +==><== +<-- diff --git a/Tests/RunCMake/Syntax/AtWithVariableFile.cmake b/Tests/RunCMake/Syntax/AtWithVariableFile.cmake new file mode 100644 index 000000000..c70909928 --- /dev/null +++ b/Tests/RunCMake/Syntax/AtWithVariableFile.cmake @@ -0,0 +1,8 @@ +set(right "wrong") +set(var "\${right}") + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/atfile.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt") +file(READ "${CMAKE_CURRENT_BINARY_DIR}/atfile.txt" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt new file mode 100644 index 000000000..077272d4b --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeQuotes-stderr.txt @@ -0,0 +1 @@ +-->"<-- diff --git a/Tests/RunCMake/Syntax/EscapeQuotes.cmake b/Tests/RunCMake/Syntax/EscapeQuotes.cmake new file mode 100644 index 000000000..46d2b6f47 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeQuotes.cmake @@ -0,0 +1,9 @@ +set(var "\"") +set(ref "@var@") +set(rref "\${var}") + +string(CONFIGURE "${ref}" output ESCAPE_QUOTES) +message("-->${output}<--") + +string(CONFIGURE "${rref}" output ESCAPE_QUOTES) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/EscapedAt-stderr.txt b/Tests/RunCMake/Syntax/EscapedAt-stderr.txt new file mode 100644 index 000000000..a51c0d3fa --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapedAt-stderr.txt @@ -0,0 +1 @@ +-->\\n<-- diff --git a/Tests/RunCMake/Syntax/EscapedAt.cmake b/Tests/RunCMake/Syntax/EscapedAt.cmake new file mode 100644 index 000000000..1ced62085 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapedAt.cmake @@ -0,0 +1,5 @@ +set(var "n") +set(ref "\\@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt b/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt new file mode 100644 index 000000000..5da8b60c5 --- /dev/null +++ b/Tests/RunCMake/Syntax/ExpandInAt-stderr.txt @@ -0,0 +1 @@ +-->@foo@<-- diff --git a/Tests/RunCMake/Syntax/ExpandInAt.cmake b/Tests/RunCMake/Syntax/ExpandInAt.cmake new file mode 100644 index 000000000..98f0277da --- /dev/null +++ b/Tests/RunCMake/Syntax/ExpandInAt.cmake @@ -0,0 +1,6 @@ +set("\${varname}" bar) +set(var foo) +set(ref "@\${var}@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/ParenInENV-result.txt b/Tests/RunCMake/Syntax/ParenInENV-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt new file mode 100644 index 000000000..7ecfe1124 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV-stderr.txt @@ -0,0 +1,20 @@ +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2:21 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at ParenInENV.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInENV.cmake:2 + + when parsing string + + -->\$ENV{e + + syntax error, unexpected \$end, expecting } \(9\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInENV.cmake b/Tests/RunCMake/Syntax/ParenInENV.cmake new file mode 100644 index 000000000..148f7266d --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInENV.cmake @@ -0,0 +1,2 @@ +set("ENV{e(x)}" value) +message(-->$ENV{e(x)}<--) diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt new file mode 100644 index 000000000..7020c7e73 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInQuotedENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake new file mode 100644 index 000000000..633371740 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInQuotedENV.cmake @@ -0,0 +1,2 @@ +set("ENV{e(x)}" value) +message("-->$ENV{e(x)}<--") diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 5f05cfc37..dcabd8ac4 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -52,3 +52,16 @@ run_cmake(UnterminatedString) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) + +# Variable expansion tests +run_cmake(ExpandInAt) +run_cmake(EscapedAt) +run_cmake(EscapeQuotes) +run_cmake(AtWithVariable) +run_cmake(AtWithVariableEmptyExpansion) +run_cmake(AtWithVariableAtOnly) +run_cmake(AtWithVariableEmptyExpansionAtOnly) +run_cmake(AtWithVariableFile) +run_cmake(AtWithVariableAtOnlyFile) +run_cmake(ParenInENV) +run_cmake(ParenInQuotedENV) diff --git a/Tests/RunCMake/Syntax/atfile.txt.in b/Tests/RunCMake/Syntax/atfile.txt.in new file mode 100644 index 000000000..3775919f6 --- /dev/null +++ b/Tests/RunCMake/Syntax/atfile.txt.in @@ -0,0 +1,4 @@ +==>@var@<== +==>@empty@<== +==>${var}<== +==>${empty}<== From 67253133f8ca99034a1eabe326a51c74f5e95c87 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 11:35:52 -0500 Subject: [PATCH 006/278] ExpandListArguments: Optimize the parser Optimize cmSystemTools::ExpandListArguments so as not to build a string character-by-character. This avoids excess reallocations of the result string. --- Source/cmSystemTools.cxx | 51 ++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ff0597563..7cc63bbdf 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1044,7 +1044,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, bool emptyArgs) { // If argument is empty, it is an empty list. - if(arg.length() == 0 && !emptyArgs) + if(!emptyArgs && arg.empty()) { return; } @@ -1054,10 +1054,11 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, newargs.push_back(arg); return; } - std::vector newArgVec; + std::string newArg; + const char *last = arg.c_str(); // Break the string at non-escaped semicolons not nested in []. int squareNesting = 0; - for(const char* c = arg.c_str(); *c; ++c) + for(const char* c = last; *c; ++c) { switch(*c) { @@ -1065,34 +1066,21 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, { // We only want to allow escaping of semicolons. Other // escapes should not be processed here. - ++c; - if(*c == ';') + const char* next = c + 1; + if(*next == ';') { - newArgVec.push_back(*c); - } - else - { - newArgVec.push_back('\\'); - if(*c) - { - newArgVec.push_back(*c); - } - else - { - // Terminate the loop properly. - --c; - } + newArg.append(last, c - last); + // Skip over the escape character + last = c = next; } } break; case '[': { ++squareNesting; - newArgVec.push_back(*c); } break; case ']': { --squareNesting; - newArgVec.push_back(*c); } break; case ';': { @@ -1100,31 +1088,28 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, // brackets. if(squareNesting == 0) { - if ( newArgVec.size() || emptyArgs ) + newArg.append(last, c - last); + // Skip over the semicolon + last = c + 1; + if ( !newArg.empty() || emptyArgs ) { // Add the last argument if the string is not empty. - newArgVec.push_back(0); - newargs.push_back(&*newArgVec.begin()); - newArgVec.clear(); + newargs.push_back(newArg); + newArg = ""; } } - else - { - newArgVec.push_back(*c); - } } break; default: { // Just append this character. - newArgVec.push_back(*c); } break; } } - if ( newArgVec.size() || emptyArgs ) + newArg.append(last); + if ( !newArg.empty() || emptyArgs ) { // Add the last argument if the string is not empty. - newArgVec.push_back(0); - newargs.push_back(&*newArgVec.begin()); + newargs.push_back(newArg); } } From 68eb1757445dd1bb6537e32be8c9a72360112978 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 12:01:30 -0500 Subject: [PATCH 007/278] cmGeneratorExpressionLexer: Use a switch statement to parse Optimize cmGeneratorExpressionLexer::Tokenize to use a switch statement. The many dereferences of the input pointer were expensive. Also remove excess pointer arithmetic. --- Source/cmGeneratorExpressionLexer.cxx | 70 +++++++++++++-------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index cd71ec033..117a24e09 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -42,42 +42,42 @@ cmGeneratorExpressionLexer::Tokenize(const char *input) const char *upto = c; for ( ; *c; ++c) - { - if(c[0] == '$' && c[1] == '<') { - InsertText(upto, c, result); - upto = c; - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::BeginExpression, upto, 2)); - upto = c + 2; - ++c; - SawBeginExpression = true; - } - else if(c[0] == '>') - { - InsertText(upto, c, result); - upto = c; - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::EndExpression, upto, 1)); - upto = c + 1; - SawGeneratorExpression = SawBeginExpression; - } - else if(c[0] == ':') - { - InsertText(upto, c, result); - upto = c; - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::ColonSeparator, upto, 1)); - upto = c + 1; - } - else if(c[0] == ',') - { - InsertText(upto, c, result); - upto = c; - result.push_back(cmGeneratorExpressionToken( - cmGeneratorExpressionToken::CommaSeparator, upto, 1)); - upto = c + 1; - } + switch(*c) + { + case '$': + if(c[1] == '<') + { + InsertText(upto, c, result); + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::BeginExpression, c, 2)); + upto = c + 2; + ++c; + SawBeginExpression = true; + } + break; + case '>': + InsertText(upto, c, result); + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::EndExpression, c, 1)); + upto = c + 1; + SawGeneratorExpression = SawBeginExpression; + break; + case ':': + InsertText(upto, c, result); + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::ColonSeparator, c, 1)); + upto = c + 1; + break; + case ',': + InsertText(upto, c, result); + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::CommaSeparator, c, 1)); + upto = c + 1; + break; + default: + break; + } } InsertText(upto, c, result); From 7c565d2fd5e86d420ea83eb724ad5380ca5c2e97 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 05:09:52 -0500 Subject: [PATCH 008/278] cmGeneratorExpression: Improve parsing in StripEmptyListElements The char-by-char parsing causes lots of reallocations which shouldn't be necessary. To improve this, fast-path strings without a semicolon, reserve space in the result, and insert into the result in chunks. --- Source/cmGeneratorExpression.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 2e66d7822..cd3054614 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -157,17 +157,24 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() std::string cmGeneratorExpression::StripEmptyListElements( const std::string &input) { + if (input.find(';') == input.npos) + { + return input; + } std::string result; + result.reserve(input.size()); const char *c = input.c_str(); + const char *last = c; bool skipSemiColons = true; for ( ; *c; ++c) { - if(c[0] == ';') + if(*c == ';') { if(skipSemiColons) { - continue; + result.append(last, c - last); + last = c + 1; } skipSemiColons = true; } @@ -175,8 +182,8 @@ std::string cmGeneratorExpression::StripEmptyListElements( { skipSemiColons = false; } - result += *c; } + result.append(last); if (!result.empty() && *(result.end() - 1) == ';') { From 4e647cf6b5114307ff0e4bc985b53a0c04661623 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 22 Feb 2014 00:01:06 -0500 Subject: [PATCH 009/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0c481addf..ef128e10d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140221) +set(CMake_VERSION_PATCH 20140222) #set(CMake_VERSION_RC 1) From 01981d8e45a60a66f3140a981c0bc1e7fe2ea804 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 23 Feb 2014 00:01:05 -0500 Subject: [PATCH 010/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ef128e10d..693144a84 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140222) +set(CMake_VERSION_PATCH 20140223) #set(CMake_VERSION_RC 1) From 2f2bb105d5eb27920518e144959cb706a619f2ce Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 24 Feb 2014 00:01:04 -0500 Subject: [PATCH 011/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 693144a84..e9a17213b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140223) +set(CMake_VERSION_PATCH 20140224) #set(CMake_VERSION_RC 1) From f0111deb1ea21f667b2fbf57f55d5ee2a80f5ccc Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Sun, 23 Feb 2014 19:58:43 +0100 Subject: [PATCH 012/278] UseSWIG: Name extra generated files after module name (#10080) --- Modules/UseSWIG.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 11ca205e1..4ae6f813a 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -85,9 +85,6 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) set(${outfiles} "") get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} SWIG_MODULE_NAME) - if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") - get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) - endif() foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) set(${outfiles} ${${outfiles}} "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") @@ -103,6 +100,10 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) get_source_file_property(swig_source_file_generated ${infile} GENERATED) get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) + get_source_file_property(_SWIG_MODULE_NAME ${infile} SWIG_MODULE_NAME) + if ( NOT _SWIG_MODULE_NAME ) + set_source_files_properties(${infile} PROPERTIES SWIG_MODULE_NAME ${name}) + endif () if("${swig_source_file_flags}" STREQUAL "NOTFOUND") set(swig_source_file_flags "") endif() From 84e5f5a004fc4659504f25a2d23984b2bceb1a9f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 6 Feb 2014 11:24:37 +0100 Subject: [PATCH 013/278] cmTarget: Move SourceFileFlags to cmGeneratorTarget. --- Source/cmGeneratorTarget.cxx | 106 ++++++++++++++++++++++++++++- Source/cmGeneratorTarget.h | 29 ++++++++ Source/cmGlobalXCodeGenerator.cxx | 28 ++++---- Source/cmOSXBundleGenerator.cxx | 32 ++++----- Source/cmOSXBundleGenerator.h | 2 +- Source/cmTarget.cxx | 108 ------------------------------ Source/cmTarget.h | 29 -------- 7 files changed, 166 insertions(+), 168 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 175bb0eec..4db27cad6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -25,7 +25,8 @@ #include "assert.h" //---------------------------------------------------------------------------- -cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) +cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), + SourceFileFlagsConstructed(false) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); @@ -876,3 +877,106 @@ bool cmStrictTargetComparison::operator()(cmTarget const* t1, } return nameResult < 0; } + +//---------------------------------------------------------------------------- +struct cmGeneratorTarget::SourceFileFlags +cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const +{ + struct SourceFileFlags flags; + this->ConstructSourceFileFlags(); + std::map::iterator si = + this->SourceFlagsMap.find(sf); + if(si != this->SourceFlagsMap.end()) + { + flags = si->second; + } + return flags; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::ConstructSourceFileFlags() const +{ + if(this->SourceFileFlagsConstructed) + { + return; + } + this->SourceFileFlagsConstructed = true; + + // Process public headers to mark the source files. + if(const char* files = this->Target->GetProperty("PUBLIC_HEADER")) + { + std::vector relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + for(std::vector::iterator it = relFiles.begin(); + it != relFiles.end(); ++it) + { + if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + { + SourceFileFlags& flags = this->SourceFlagsMap[sf]; + flags.MacFolder = "Headers"; + flags.Type = cmGeneratorTarget::SourceFileTypePublicHeader; + } + } + } + + // Process private headers after public headers so that they take + // precedence if a file is listed in both. + if(const char* files = this->Target->GetProperty("PRIVATE_HEADER")) + { + std::vector relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + for(std::vector::iterator it = relFiles.begin(); + it != relFiles.end(); ++it) + { + if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + { + SourceFileFlags& flags = this->SourceFlagsMap[sf]; + flags.MacFolder = "PrivateHeaders"; + flags.Type = cmGeneratorTarget::SourceFileTypePrivateHeader; + } + } + } + + // Mark sources listed as resources. + if(const char* files = this->Target->GetProperty("RESOURCE")) + { + std::vector relFiles; + cmSystemTools::ExpandListArgument(files, relFiles); + for(std::vector::iterator it = relFiles.begin(); + it != relFiles.end(); ++it) + { + if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + { + SourceFileFlags& flags = this->SourceFlagsMap[sf]; + flags.MacFolder = "Resources"; + flags.Type = cmGeneratorTarget::SourceFileTypeResource; + } + } + } + + // Handle the MACOSX_PACKAGE_LOCATION property on source files that + // were not listed in one of the other lists. + std::vector sources; + this->GetSourceFiles(sources); + for(std::vector::const_iterator si = sources.begin(); + si != sources.end(); ++si) + { + cmSourceFile* sf = *si; + if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) + { + SourceFileFlags& flags = this->SourceFlagsMap[sf]; + if(flags.Type == cmGeneratorTarget::SourceFileTypeNormal) + { + flags.MacFolder = location; + if(strcmp(location, "Resources") == 0) + { + flags.Type = cmGeneratorTarget::SourceFileTypeResource; + } + else + { + flags.Type = cmGeneratorTarget::SourceFileTypeMacContent; + } + } + } + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index a4caba1df..9a3339d37 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -88,6 +88,31 @@ public: /** Get sources that must be built before the given source. */ std::vector const* GetSourceDepends(cmSourceFile* sf) const; + /** + * Flags for a given source file as used in this target. Typically assigned + * via SET_TARGET_PROPERTIES when the property is a list of source files. + */ + enum SourceFileType + { + SourceFileTypeNormal, + SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property + SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property + SourceFileTypeResource, // is in "RESOURCE" target property *or* + // has MACOSX_PACKAGE_LOCATION=="Resources" + SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources" + }; + struct SourceFileFlags + { + SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {} + SourceFileFlags(SourceFileFlags const& r): + Type(r.Type), MacFolder(r.MacFolder) {} + SourceFileType Type; + const char* MacFolder; // location inside Mac content folders + }; + + struct SourceFileFlags + GetTargetSourceFileFlags(const cmSourceFile* sf) const; + private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; @@ -107,6 +132,10 @@ private: std::vector ObjectLibraries; mutable std::map > SystemIncludesCache; + void ConstructSourceFileFlags() const; + mutable bool SourceFileFlagsConstructed; + mutable std::map SourceFlagsMap; + cmGeneratorTarget(cmGeneratorTarget const&); void operator=(cmGeneratorTarget const&); }; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 484b28fe8..004f7acf1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -713,22 +713,23 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, // Is this a resource file in this target? Add it to the resources group... // - cmTarget::SourceFileFlags tsFlags = cmtarget.GetTargetSourceFileFlags(sf); - bool isResource = (tsFlags.Type == cmTarget::SourceFileTypeResource); + cmGeneratorTarget::SourceFileFlags tsFlags = + this->GetGeneratorTarget(&cmtarget)->GetTargetSourceFileFlags(sf); + bool isResource = tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource; // Is this a "private" or "public" framework header file? // Set the ATTRIBUTES attribute appropriately... // if(cmtarget.IsFrameworkOnApple()) { - if(tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) + if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) { cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); attrs->AddObject(this->CreateString("Private")); settings->AddAttribute("ATTRIBUTES", attrs); isResource = true; } - else if(tsFlags.Type == cmTarget::SourceFileTypePublicHeader) + else if(tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader) { cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST); attrs->AddObject(this->CreateString("Public")); @@ -973,6 +974,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { cmTarget& cmtarget = l->second; + cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); // make sure ALL_BUILD, INSTALL, etc are only done once if(this->SpecialTargetEmitted(l->first.c_str())) @@ -1011,8 +1013,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); - cmTarget::SourceFileFlags tsFlags = - cmtarget.GetTargetSourceFileFlags(*i); + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(*i); if(filetype && strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) @@ -1020,12 +1022,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, externalObjFiles.push_back(xsf); } else if(this->IsHeaderFile(*i) || - (tsFlags.Type == cmTarget::SourceFileTypePrivateHeader) || - (tsFlags.Type == cmTarget::SourceFileTypePublicHeader)) + (tsFlags.Type == cmGeneratorTarget::SourceFileTypePrivateHeader) || + (tsFlags.Type == cmGeneratorTarget::SourceFileTypePublicHeader)) { headerFiles.push_back(xsf); } - else if(tsFlags.Type == cmTarget::SourceFileTypeResource) + else if(tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { resourceFiles.push_back(xsf); } @@ -1048,7 +1050,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, // the externalObjFiles above, except each one is not a cmSourceFile // within the target.) std::vector objs; - this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs); + gtgt->UseObjectLibraries(objs); for(std::vector::const_iterator oi = objs.begin(); oi != objs.end(); ++oi) { @@ -1138,9 +1140,9 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, for(std::vector::const_iterator i = classes.begin(); i != classes.end(); ++i) { - cmTarget::SourceFileFlags tsFlags = - cmtarget.GetTargetSourceFileFlags(*i); - if(tsFlags.Type == cmTarget::SourceFileTypeMacContent) + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(*i); + if(tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { bundleFiles[tsFlags.MacFolder].push_back(*i); } diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 9a340dc52..78b59b382 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -20,7 +20,7 @@ cmOSXBundleGenerator:: cmOSXBundleGenerator(cmGeneratorTarget* target, const char* configName) - : Target(target->Target) + : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(Makefile->GetLocalGenerator()) , ConfigName(configName) @@ -34,7 +34,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target, //---------------------------------------------------------------------------- bool cmOSXBundleGenerator::MustSkip() { - return !this->Target->HaveWellDefinedOutputFiles(); + return !this->GT->Target->HaveWellDefinedOutputFiles(); } //---------------------------------------------------------------------------- @@ -47,7 +47,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, // Compute bundle directory names. std::string out = outpath; out += "/"; - out += this->Target->GetAppBundleDirectory(this->ConfigName, false); + out += this->GT->Target->GetAppBundleDirectory(this->ConfigName, false); cmSystemTools::MakeDirectory(out.c_str()); this->Makefile->AddCMakeOutputFile(out); @@ -57,9 +57,9 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, // to be set. std::string plist = outpath; plist += "/"; - plist += this->Target->GetAppBundleDirectory(this->ConfigName, true); + plist += this->GT->Target->GetAppBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; - this->LocalGenerator->GenerateAppleInfoPList(this->Target, + this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, targetName.c_str(), plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); @@ -77,20 +77,20 @@ void cmOSXBundleGenerator::CreateFramework( // Compute the location of the top-level foo.framework directory. std::string contentdir = outpath + "/" + - this->Target->GetFrameworkDirectory(this->ConfigName, true); + this->GT->Target->GetFrameworkDirectory(this->ConfigName, true); contentdir += "/"; std::string newoutpath = outpath + "/" + - this->Target->GetFrameworkDirectory(this->ConfigName, false); + this->GT->Target->GetFrameworkDirectory(this->ConfigName, false); - std::string frameworkVersion = this->Target->GetFrameworkVersion(); + std::string frameworkVersion = this->GT->Target->GetFrameworkVersion(); // Configure the Info.plist file into the Resources directory. this->MacContentFolders->insert("Resources"); std::string plist = newoutpath; plist += "/Resources/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); - this->LocalGenerator->GenerateFrameworkInfoPList(this->Target, + this->LocalGenerator->GenerateFrameworkInfoPList(this->GT->Target, name.c_str(), plist.c_str()); @@ -172,16 +172,16 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, // Compute bundle directory names. std::string out = root; out += "/"; - out += this->Target->GetCFBundleDirectory(this->ConfigName, false); + out += this->GT->Target->GetCFBundleDirectory(this->ConfigName, false); cmSystemTools::MakeDirectory(out.c_str()); this->Makefile->AddCMakeOutputFile(out); // Configure the Info.plist file. Note that it needs the executable name // to be set. std::string plist = - this->Target->GetCFBundleDirectory(this->ConfigName, true); + this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; - this->LocalGenerator->GenerateAppleInfoPList(this->Target, + this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, targetName.c_str(), plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); @@ -199,9 +199,9 @@ GenerateMacOSXContentStatements(std::vector const& sources, for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { - cmTarget::SourceFileFlags tsFlags = - this->Target->GetTargetSourceFileFlags(*si); - if(tsFlags.Type != cmTarget::SourceFileTypeNormal) + cmGeneratorTarget::SourceFileFlags tsFlags = + this->GT->GetTargetSourceFileFlags(*si); + if(tsFlags.Type != cmGeneratorTarget::SourceFileTypeNormal) { (*generator)(**si, tsFlags.MacFolder); } @@ -215,7 +215,7 @@ cmOSXBundleGenerator::InitMacOSXContentDirectory(const char* pkgloc) // Construct the full path to the content subdirectory. std::string macdir = - this->Target->GetMacContentDirectory(this->ConfigName, + this->GT->Target->GetMacContentDirectory(this->ConfigName, /*implib*/ false); macdir += "/"; macdir += pkgloc; diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 29b7611d4..2f3639402 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -59,7 +59,7 @@ private: bool MustSkip(); private: - cmTarget* Target; + cmGeneratorTarget* GT; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; const char* ConfigName; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index db34bd826..61f05a1a4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -83,17 +83,12 @@ public: cmTargetInternals() { this->PolicyWarnedCMP0022 = false; - this->SourceFileFlagsConstructed = false; } cmTargetInternals(cmTargetInternals const&) { this->PolicyWarnedCMP0022 = false; - this->SourceFileFlagsConstructed = false; } ~cmTargetInternals(); - typedef cmTarget::SourceFileFlags SourceFileFlags; - mutable std::map SourceFlagsMap; - mutable bool SourceFileFlagsConstructed; // The backtrace when the target was created. cmListFileBacktrace Backtrace; @@ -647,109 +642,6 @@ void cmTarget::ProcessSourceExpression(std::string const& expr) } } -//---------------------------------------------------------------------------- -struct cmTarget::SourceFileFlags -cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const -{ - struct SourceFileFlags flags; - this->ConstructSourceFileFlags(); - std::map::iterator si = - this->Internal->SourceFlagsMap.find(sf); - if(si != this->Internal->SourceFlagsMap.end()) - { - flags = si->second; - } - return flags; -} - -//---------------------------------------------------------------------------- -void cmTarget::ConstructSourceFileFlags() const -{ - if(this->Internal->SourceFileFlagsConstructed) - { - return; - } - this->Internal->SourceFileFlagsConstructed = true; - - // Process public headers to mark the source files. - if(const char* files = this->GetProperty("PUBLIC_HEADER")) - { - std::vector relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - for(std::vector::iterator it = relFiles.begin(); - it != relFiles.end(); ++it) - { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) - { - SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf]; - flags.MacFolder = "Headers"; - flags.Type = cmTarget::SourceFileTypePublicHeader; - } - } - } - - // Process private headers after public headers so that they take - // precedence if a file is listed in both. - if(const char* files = this->GetProperty("PRIVATE_HEADER")) - { - std::vector relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - for(std::vector::iterator it = relFiles.begin(); - it != relFiles.end(); ++it) - { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) - { - SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf]; - flags.MacFolder = "PrivateHeaders"; - flags.Type = cmTarget::SourceFileTypePrivateHeader; - } - } - } - - // Mark sources listed as resources. - if(const char* files = this->GetProperty("RESOURCE")) - { - std::vector relFiles; - cmSystemTools::ExpandListArgument(files, relFiles); - for(std::vector::iterator it = relFiles.begin(); - it != relFiles.end(); ++it) - { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) - { - SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf]; - flags.MacFolder = "Resources"; - flags.Type = cmTarget::SourceFileTypeResource; - } - } - } - - // Handle the MACOSX_PACKAGE_LOCATION property on source files that - // were not listed in one of the other lists. - std::vector sources; - this->GetSourceFiles(sources); - for(std::vector::const_iterator si = sources.begin(); - si != sources.end(); ++si) - { - cmSourceFile* sf = *si; - if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) - { - SourceFileFlags& flags = this->Internal->SourceFlagsMap[sf]; - if(flags.Type == cmTarget::SourceFileTypeNormal) - { - flags.MacFolder = location; - if(strcmp(location, "Resources") == 0) - { - flags.Type = cmTarget::SourceFileTypeResource; - } - else - { - flags.Type = cmTarget::SourceFileTypeMacContent; - } - } - } - } -} - //---------------------------------------------------------------------------- void cmTarget::MergeLinkLibraries( cmMakefile& mf, const char *selfname, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 271824ba9..a02ed094a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -139,34 +139,6 @@ public: return this->ObjectLibraries; } - /** - * Flags for a given source file as used in this target. Typically assigned - * via SET_TARGET_PROPERTIES when the property is a list of source files. - */ - enum SourceFileType - { - SourceFileTypeNormal, - SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property - SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property - SourceFileTypeResource, // is in "RESOURCE" target property *or* - // has MACOSX_PACKAGE_LOCATION=="Resources" - SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources" - }; - struct SourceFileFlags - { - SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {} - SourceFileFlags(SourceFileFlags const& r): - Type(r.Type), MacFolder(r.MacFolder) {} - SourceFileType Type; - const char* MacFolder; // location inside Mac content folders - }; - - /** - * Get the flags for a given source file as used in this target - */ - struct SourceFileFlags - GetTargetSourceFileFlags(const cmSourceFile* sf) const; - /** * Add sources to the target. */ @@ -756,7 +728,6 @@ private: friend class cmTargetTraceDependencies; cmTargetInternalPointer Internal; - void ConstructSourceFileFlags() const; void ComputeVersionedName(std::string& vName, std::string const& prefix, std::string const& base, From f81eb49e8be851cef5e75a5074ff46435c941301 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 14 Feb 2014 12:07:34 +0100 Subject: [PATCH 014/278] cmTarget: Find source files on request. In a follow-up, the list of sources will become dependent on the config, so check for existence in cmTarget::GetSourceFiles instead of up-front with cmGlobalGenerator::CheckTargets(). --- Source/cmGlobalGenerator.cxx | 35 ----------------------------------- Source/cmGlobalGenerator.h | 1 - Source/cmTarget.cxx | 14 ++++---------- Source/cmTarget.h | 5 ----- 4 files changed, 4 insertions(+), 51 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4f3328d02..e143ebafa 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1148,12 +1148,6 @@ void cmGlobalGenerator::Generate() return; } - // Check that all targets are valid. - if(!this->CheckTargets()) - { - return; - } - this->FinalizeTargetCompileInfo(); #ifdef CMAKE_BUILD_WITH_CMAKE @@ -1305,35 +1299,6 @@ bool cmGlobalGenerator::ComputeTargetDepends() return true; } -//---------------------------------------------------------------------------- -bool cmGlobalGenerator::CheckTargets() -{ - // Make sure all targets can find their source files. - for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) - { - cmTargets& targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); - for(cmTargets::iterator ti = targets.begin(); - ti != targets.end(); ++ti) - { - cmTarget& target = ti->second; - if(target.GetType() == cmTarget::EXECUTABLE || - target.GetType() == cmTarget::STATIC_LIBRARY || - target.GetType() == cmTarget::SHARED_LIBRARY || - target.GetType() == cmTarget::MODULE_LIBRARY || - target.GetType() == cmTarget::OBJECT_LIBRARY || - target.GetType() == cmTarget::UTILITY) - { - if(!target.FindSourceFiles()) - { - return false; - } - } - } - } - return true; -} - //---------------------------------------------------------------------------- void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 753eebfea..b66f01e86 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -340,7 +340,6 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; - bool CheckTargets(); typedef std::vector > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 61f05a1a4..5fa92764f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -522,10 +522,11 @@ bool cmTarget::IsBundleOnApple() const } //---------------------------------------------------------------------------- -bool cmTarget::FindSourceFiles() +void cmTarget::GetSourceFiles(std::vector &files) const { + assert(this->GetType() != INTERFACE_LIBRARY); for(std::vector::const_iterator - si = this->SourceFiles.begin(); + si = this->SourceFiles.begin(); si != this->SourceFiles.end(); ++si) { std::string e; @@ -537,16 +538,9 @@ bool cmTarget::FindSourceFiles() cm->IssueMessage(cmake::FATAL_ERROR, e, this->GetBacktrace()); } - return false; + return; } } - return true; -} - -//---------------------------------------------------------------------------- -void cmTarget::GetSourceFiles(std::vector &files) const -{ - assert(this->GetType() != INTERFACE_LIBRARY); files = this->SourceFiles; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a02ed094a..4d487f718 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -330,11 +330,6 @@ public: void GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; - /** - * Make sure the full path to all source files is known. - */ - bool FindSourceFiles(); - ///! Return the preferred linker language for this target const char* GetLinkerLanguage(const char* config = 0, cmTarget const* head = 0) const; From 21e91350b06b562ac2668c6ff2a3b220e41d4bc1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 09:53:27 +0100 Subject: [PATCH 015/278] cmTarget: Change GetTransitivePropertyLinkLibraries to output targets. The callers already skip non-targets, so unify the target search. Change supporting functions to accept a container of targets instead of strings where possible. --- Source/cmGeneratorExpressionEvaluator.cxx | 51 ++++++++++++++++------- Source/cmGeneratorTarget.cxx | 32 ++++++-------- Source/cmTarget.cxx | 26 ++++++++++-- Source/cmTarget.h | 4 +- 4 files changed, 71 insertions(+), 42 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 7036992d8..ebedf65b9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -800,7 +800,7 @@ static const char* targetPropertyTransitiveWhitelist[] = { #undef TRANSITIVE_PROPERTY_NAME -std::string getLinkedTargetsContent(const std::vector &libraries, +std::string getLinkedTargetsContent(const std::vector &targets, cmTarget const* target, cmTarget const* headTarget, cmGeneratorExpressionContext *context, @@ -811,23 +811,21 @@ std::string getLinkedTargetsContent(const std::vector &libraries, std::string sep; std::string depString; - for (std::vector::const_iterator - it = libraries.begin(); - it != libraries.end(); ++it) + for (std::vector::const_iterator + it = targets.begin(); + it != targets.end(); ++it) { - if (*it == target->GetName()) + if (*it == target) { // Broken code can have a target in its own link interface. // Don't follow such link interface entries so as not to create a // self-referencing loop. continue; } - if (context->Makefile->FindTargetToUse(*it)) - { - depString += - sep + "$"; - sep = ";"; - } + depString += + sep + "$GetName() + "," + interfacePropertyName + ">"; + sep = ";"; } cmsys::auto_ptr cge = ge.Parse(depString); std::string linkedTargetsContent = cge->Evaluate(context->Makefile, @@ -843,6 +841,27 @@ std::string getLinkedTargetsContent(const std::vector &libraries, return linkedTargetsContent; } +std::string getLinkedTargetsContent(const std::vector &libraries, + cmTarget const* target, + cmTarget const* headTarget, + cmGeneratorExpressionContext *context, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string &interfacePropertyName) +{ + std::vector tgts; + for (std::vector::const_iterator + it = libraries.begin(); + it != libraries.end(); ++it) + { + if (cmTarget *tgt = context->Makefile->FindTargetToUse(*it)) + { + tgts.push_back(tgt); + } + } + return getLinkedTargetsContent(tgts, target, headTarget, context, + dagChecker, interfacePropertyName); +} + //---------------------------------------------------------------------------- static const struct TargetPropertyNode : public cmGeneratorExpressionNode { @@ -1065,13 +1084,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode cmStrCmp(propertyName)) != transEnd) { - std::vector libs; - target->GetTransitivePropertyLinkLibraries(context->Config, - headTarget, libs); - if (!libs.empty()) + std::vector tgts; + target->GetTransitivePropertyTargets(context->Config, + headTarget, tgts); + if (!tgts.empty()) { linkedTargetsContent = - getLinkedTargetsContent(libs, target, + getLinkedTargetsContent(tgts, target, headTarget, context, &dagChecker, interfacePropertyName); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4db27cad6..6223ed102 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -63,19 +63,12 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const return 0; } -static void handleSystemIncludesDep(cmMakefile *mf, const std::string &name, +static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, const char *config, cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, std::vector& result, bool excludeImported) { - cmTarget* depTgt = mf->FindTargetToUse(name); - - if (!depTgt) - { - return; - } - cmListFileBacktrace lfbt; if (const char* dirs = @@ -225,26 +218,25 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, &dagChecker), result); } - std::set uniqueDeps; + std::set uniqueDeps; for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { - if (uniqueDeps.insert(*li).second) + cmTarget* tgt = this->Makefile->FindTargetToUse(*li); + if (!tgt) { - cmTarget* tgt = this->Makefile->FindTargetToUse(*li); + continue; + } - if (!tgt) - { - continue; - } - - handleSystemIncludesDep(this->Makefile, *li, config, this->Target, + if (uniqueDeps.insert(tgt).second) + { + handleSystemIncludesDep(this->Makefile, tgt, config, this->Target, &dagChecker, result, excludeImported); - std::vector deps; - tgt->GetTransitivePropertyLinkLibraries(config, this->Target, deps); + std::vector deps; + tgt->GetTransitivePropertyTargets(config, this->Target, deps); - for(std::vector::const_iterator di = deps.begin(); + for(std::vector::const_iterator di = deps.begin(); di != deps.end(); ++di) { if (uniqueDeps.insert(*di).second) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5fa92764f..faf53c16b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5213,10 +5213,9 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::GetTransitivePropertyLinkLibraries( - const char* config, +void cmTarget::GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, - std::vector &libs) const + std::vector &tgts) const { cmTarget::LinkInterface const* iface = this->GetLinkInterface(config, headTarget); @@ -5228,7 +5227,15 @@ void cmTarget::GetTransitivePropertyLinkLibraries( || this->GetPolicyStatusCMP0022() == cmPolicies::WARN || this->GetPolicyStatusCMP0022() == cmPolicies::OLD) { - libs = iface->Libraries; + for(std::vector::const_iterator it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + if (cmTarget* tgt = headTarget->GetMakefile() + ->FindTargetToUse(it->c_str())) + { + tgts.push_back(tgt); + } + } return; } @@ -5246,12 +5253,23 @@ void cmTarget::GetTransitivePropertyLinkLibraries( cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(), linkIfaceProp, 0, 0); dagChecker.SetTransitivePropertiesOnly(); + std::vector libs; cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate( this->Makefile, config, false, headTarget, this, &dagChecker), libs); + + for(std::vector::const_iterator it = libs.begin(); + it != libs.end(); ++it) + { + if (cmTarget* tgt = headTarget->GetMakefile() + ->FindTargetToUse(it->c_str())) + { + tgts.push_back(tgt); + } + } } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4d487f718..0d852594a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -264,9 +264,9 @@ public: if the target cannot be linked. */ LinkInterface const* GetLinkInterface(const char* config, cmTarget const* headTarget) const; - void GetTransitivePropertyLinkLibraries(const char* config, + void GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, - std::vector &libs) const; + std::vector &libs) const; /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ From 326d07d27ec173d3e67a314010764ebbe7b2aa9c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 11:26:08 +0100 Subject: [PATCH 016/278] cmTarget: Extract a ComputeLinkImplementationLanguages method. --- Source/cmTarget.cxx | 6 ++++++ Source/cmTarget.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index faf53c16b..bc57c5177 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5537,6 +5537,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const // Compute the link implementation for this configuration. LinkImplementation impl; this->ComputeLinkImplementation(config, impl, head); + this->ComputeLinkImplementationLanguages(impl); // Store the information for this configuration. cmTargetInternals::LinkImplMapType::value_type entry(key, impl); @@ -5619,7 +5620,12 @@ void cmTarget::ComputeLinkImplementation(const char* config, impl.WrongConfigLibraries.push_back(item); } } +} +//---------------------------------------------------------------------------- +void +cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const +{ // This target needs runtime libraries for its source languages. std::set languages; // Get languages used in our source files. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 0d852594a..234adba34 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -696,6 +696,7 @@ private: void ComputeLinkImplementation(const char* config, LinkImplementation& impl, cmTarget const* head) const; + void ComputeLinkImplementationLanguages(LinkImplementation& impl) const; void ComputeLinkClosure(const char* config, LinkClosure& lc, cmTarget const* head) const; From 3bcb197c11be54445db3282e9811dc29f2321c70 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 15:11:07 +0100 Subject: [PATCH 017/278] cmTarget: Re-arrange the ComputeLinkInterface method. Arrange the logic so that the part which deals with libraries only is at the top. In a follow-up commit, this will be split into two methods. Ensure that the explanatory CMP0022 comment is only present in one location. --- Source/cmTarget.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bc57c5177..edef7a0b3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5366,7 +5366,22 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, false, headTarget, this, &dagChecker), iface.Libraries); + } + else if (this->PolicyStatusCMP0022 == cmPolicies::WARN + || this->PolicyStatusCMP0022 == cmPolicies::OLD) + // If CMP0022 is NEW then the plain tll signature sets the + // INTERFACE_LINK_LIBRARIES, so if we get here then the project + // cleared the property explicitly and we should not fall back + // to the link implementation. + { + // The link implementation is the default link interface. + LinkImplementation const* impl = this->GetLinkImplementation(config, + headTarget); + iface.Libraries = impl->Libraries; + } + if(explicitLibraries) + { if(this->GetType() == cmTarget::SHARED_LIBRARY || this->GetType() == cmTarget::STATIC_LIBRARY || this->GetType() == cmTarget::INTERFACE_LIBRARY) @@ -5415,16 +5430,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } else if (this->PolicyStatusCMP0022 == cmPolicies::WARN || this->PolicyStatusCMP0022 == cmPolicies::OLD) - // If CMP0022 is NEW then the plain tll signature sets the - // INTERFACE_LINK_LIBRARIES, so if we get here then the project - // cleared the property explicitly and we should not fall back - // to the link implementation. { // The link implementation is the default link interface. LinkImplementation const* impl = this->GetLinkImplementation(config, headTarget); iface.ImplementationIsInterface = true; - iface.Libraries = impl->Libraries; iface.WrongConfigLibraries = impl->WrongConfigLibraries; if(this->LinkLanguagePropagatesToDependents()) { From d93e1af2928cbb06a66ad67d56c3a5cb217f3963 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 11:07:22 +0100 Subject: [PATCH 018/278] cmTarget: Extract a ComputeLinkInterfaceLibraries method. When evaluating the SOURCES property, we will need to be able to access the link libraries without accessing the link languages, as the languages depend on the SOURCES. --- Source/cmTarget.cxx | 161 +++++++++++++++++++++++++------------------- Source/cmTarget.h | 10 ++- 2 files changed, 99 insertions(+), 72 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index edef7a0b3..f20331282 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5202,7 +5202,9 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, { // Compute the link interface for this configuration. cmTargetInternals::OptionalLinkInterface iface; - iface.Exists = this->ComputeLinkInterface(config, iface, head); + const char* explicitLibraries = + this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists); + this->ComputeLinkInterface(config, iface, head, explicitLibraries); // Store the information for this configuration. cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); @@ -5273,8 +5275,10 @@ void cmTarget::GetTransitivePropertyTargets(const char* config, } //---------------------------------------------------------------------------- -bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, - cmTarget const* headTarget) const +const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, + LinkInterface& iface, + cmTarget const* headTarget, + bool &exists) const { // Construct the property name suffix for this configuration. std::string suffix = "_"; @@ -5350,8 +5354,10 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, (this->GetType() == cmTarget::EXECUTABLE || (this->GetType() == cmTarget::MODULE_LIBRARY))) { - return false; + exists = false; + return 0; } + exists = true; if(explicitLibraries) { @@ -5378,70 +5384,6 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, LinkImplementation const* impl = this->GetLinkImplementation(config, headTarget); iface.Libraries = impl->Libraries; - } - - if(explicitLibraries) - { - if(this->GetType() == cmTarget::SHARED_LIBRARY - || this->GetType() == cmTarget::STATIC_LIBRARY - || this->GetType() == cmTarget::INTERFACE_LIBRARY) - { - // Shared libraries may have runtime implementation dependencies - // on other shared libraries that are not in the interface. - std::set emitted; - for(std::vector::const_iterator - li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) - { - emitted.insert(*li); - } - if (this->GetType() != cmTarget::INTERFACE_LIBRARY) - { - LinkImplementation const* impl = this->GetLinkImplementation(config, - headTarget); - for(std::vector::const_iterator - li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) - { - if(emitted.insert(*li).second) - { - if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li)) - { - // This is a runtime dependency on another shared library. - if(tgt->GetType() == cmTarget::SHARED_LIBRARY) - { - iface.SharedDeps.push_back(*li); - } - } - else - { - // TODO: Recognize shared library file names. Perhaps this - // should be moved to cmComputeLinkInformation, but that creates - // a chicken-and-egg problem since this list is needed for its - // construction. - } - } - } - if(this->LinkLanguagePropagatesToDependents()) - { - // Targets using this archive need its language runtime libraries. - iface.Languages = impl->Languages; - } - } - } - } - else if (this->PolicyStatusCMP0022 == cmPolicies::WARN - || this->PolicyStatusCMP0022 == cmPolicies::OLD) - { - // The link implementation is the default link interface. - LinkImplementation const* impl = this->GetLinkImplementation(config, - headTarget); - iface.ImplementationIsInterface = true; - iface.WrongConfigLibraries = impl->WrongConfigLibraries; - if(this->LinkLanguagePropagatesToDependents()) - { - // Targets using this archive need its language runtime libraries. - iface.Languages = impl->Languages; - } - if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022) { @@ -5506,9 +5448,90 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } + return explicitLibraries; +} + +//---------------------------------------------------------------------------- +void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, + cmTarget const* headTarget, + const char* explicitLibraries) const +{ + if(explicitLibraries) + { + if(this->GetType() == cmTarget::SHARED_LIBRARY + || this->GetType() == cmTarget::STATIC_LIBRARY + || this->GetType() == cmTarget::INTERFACE_LIBRARY) + { + // Shared libraries may have runtime implementation dependencies + // on other shared libraries that are not in the interface. + std::set emitted; + for(std::vector::const_iterator + li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) + { + emitted.insert(*li); + } + if (this->GetType() != cmTarget::INTERFACE_LIBRARY) + { + LinkImplementation const* impl = this->GetLinkImplementation(config, + headTarget); + for(std::vector::const_iterator + li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) + { + if(emitted.insert(*li).second) + { + if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li)) + { + // This is a runtime dependency on another shared library. + if(tgt->GetType() == cmTarget::SHARED_LIBRARY) + { + iface.SharedDeps.push_back(*li); + } + } + else + { + // TODO: Recognize shared library file names. Perhaps this + // should be moved to cmComputeLinkInformation, but that creates + // a chicken-and-egg problem since this list is needed for its + // construction. + } + } + } + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } + } + } + } + else if (this->PolicyStatusCMP0022 == cmPolicies::WARN + || this->PolicyStatusCMP0022 == cmPolicies::OLD) + { + // The link implementation is the default link interface. + LinkImplementation const* impl = this->GetLinkImplementation(config, + headTarget); + iface.ImplementationIsInterface = true; + iface.WrongConfigLibraries = impl->WrongConfigLibraries; + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } + } if(this->GetType() == cmTarget::STATIC_LIBRARY) { + // Construct the property name suffix for this configuration. + std::string suffix = "_"; + if(config && *config) + { + suffix += cmSystemTools::UpperCase(config); + } + else + { + suffix += "NOCONFIG"; + } + // How many repetitions are needed if this library has cyclic // dependencies? std::string propName = "LINK_INTERFACE_MULTIPLICITY"; @@ -5523,8 +5546,6 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, sscanf(reps, "%u", &iface.Multiplicity); } } - - return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 234adba34..09c6f74ec 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -690,8 +690,14 @@ private: void CheckPropertyCompatibility(cmComputeLinkInformation *info, const char* config) const; - bool ComputeLinkInterface(const char* config, LinkInterface& iface, - cmTarget const* head) const; + void ComputeLinkInterface(const char* config, LinkInterface& iface, + cmTarget const* head, + const char *explicitLibraries) const; + + const char* ComputeLinkInterfaceLibraries(const char* config, + LinkInterface& iface, + cmTarget const* head, + bool &exists) const; void ComputeLinkImplementation(const char* config, LinkImplementation& impl, From 01bca553b83cd8c3a4a4d0348bd317d118a98995 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 16:00:55 +0100 Subject: [PATCH 019/278] cmTarget: Move ComputeLinkInterface to the internal class. In a follow-up, this will use the OptionalLinkInterface in its API. That class is in the cmTargetInternals class. --- Source/cmTarget.cxx | 48 ++++++++++++++++++++++++++------------------- Source/cmTarget.h | 4 ---- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f20331282..0a192e6cc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -99,6 +99,11 @@ public: OptionalLinkInterface(): Exists(false) {} bool Exists; }; + void ComputeLinkInterface(cmTarget const* thisTarget, + const char* config, OptionalLinkInterface& iface, + cmTarget const* head, + const char *explicitLibraries) const; + typedef std::map LinkInterfaceMapType; LinkInterfaceMapType LinkInterfaceMap; @@ -5204,7 +5209,8 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, cmTargetInternals::OptionalLinkInterface iface; const char* explicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists); - this->ComputeLinkInterface(config, iface, head, explicitLibraries); + this->Internal->ComputeLinkInterface(this, config, iface, + head, explicitLibraries); // Store the information for this configuration. cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); @@ -5452,15 +5458,17 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, - cmTarget const* headTarget, - const char* explicitLibraries) const +void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, + const char* config, + OptionalLinkInterface& iface, + cmTarget const* headTarget, + const char* explicitLibraries) const { if(explicitLibraries) { - if(this->GetType() == cmTarget::SHARED_LIBRARY - || this->GetType() == cmTarget::STATIC_LIBRARY - || this->GetType() == cmTarget::INTERFACE_LIBRARY) + if(thisTarget->GetType() == cmTarget::SHARED_LIBRARY + || thisTarget->GetType() == cmTarget::STATIC_LIBRARY + || thisTarget->GetType() == cmTarget::INTERFACE_LIBRARY) { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. @@ -5470,16 +5478,16 @@ void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, { emitted.insert(*li); } - if (this->GetType() != cmTarget::INTERFACE_LIBRARY) + if (thisTarget->GetType() != cmTarget::INTERFACE_LIBRARY) { - LinkImplementation const* impl = this->GetLinkImplementation(config, - headTarget); + cmTarget::LinkImplementation const* impl = + thisTarget->GetLinkImplementation(config, headTarget); for(std::vector::const_iterator li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li) { if(emitted.insert(*li).second) { - if(cmTarget* tgt = this->Makefile->FindTargetToUse(*li)) + if(cmTarget* tgt = thisTarget->Makefile->FindTargetToUse(*li)) { // This is a runtime dependency on another shared library. if(tgt->GetType() == cmTarget::SHARED_LIBRARY) @@ -5496,7 +5504,7 @@ void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } - if(this->LinkLanguagePropagatesToDependents()) + if(thisTarget->LinkLanguagePropagatesToDependents()) { // Targets using this archive need its language runtime libraries. iface.Languages = impl->Languages; @@ -5504,22 +5512,22 @@ void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } - else if (this->PolicyStatusCMP0022 == cmPolicies::WARN - || this->PolicyStatusCMP0022 == cmPolicies::OLD) + else if (thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN + || thisTarget->PolicyStatusCMP0022 == cmPolicies::OLD) { // The link implementation is the default link interface. - LinkImplementation const* impl = this->GetLinkImplementation(config, - headTarget); + cmTarget::LinkImplementation const* + impl = thisTarget->GetLinkImplementation(config, headTarget); iface.ImplementationIsInterface = true; iface.WrongConfigLibraries = impl->WrongConfigLibraries; - if(this->LinkLanguagePropagatesToDependents()) + if(thisTarget->LinkLanguagePropagatesToDependents()) { // Targets using this archive need its language runtime libraries. iface.Languages = impl->Languages; } } - if(this->GetType() == cmTarget::STATIC_LIBRARY) + if(thisTarget->GetType() == cmTarget::STATIC_LIBRARY) { // Construct the property name suffix for this configuration. std::string suffix = "_"; @@ -5536,12 +5544,12 @@ void cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, // dependencies? std::string propName = "LINK_INTERFACE_MULTIPLICITY"; propName += suffix; - if(const char* config_reps = this->GetProperty(propName.c_str())) + if(const char* config_reps = thisTarget->GetProperty(propName.c_str())) { sscanf(config_reps, "%u", &iface.Multiplicity); } else if(const char* reps = - this->GetProperty("LINK_INTERFACE_MULTIPLICITY")) + thisTarget->GetProperty("LINK_INTERFACE_MULTIPLICITY")) { sscanf(reps, "%u", &iface.Multiplicity); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 09c6f74ec..8bc5af485 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -690,10 +690,6 @@ private: void CheckPropertyCompatibility(cmComputeLinkInformation *info, const char* config) const; - void ComputeLinkInterface(const char* config, LinkInterface& iface, - cmTarget const* head, - const char *explicitLibraries) const; - const char* ComputeLinkInterfaceLibraries(const char* config, LinkInterface& iface, cmTarget const* head, From b8b99cc1e5efa8f1513ceb3025c66f3b28fc5bab Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 15:02:09 +0100 Subject: [PATCH 020/278] cmTarget: Avoid computing languages when computing transitive targets. For the OLD CMP0022 behavior, we need to treat the implementation as the interface when computing the interface libraries. Make it possible to do that without computing the link languages by adding a new GetLinkImplementationLibraries method. Extend the existing GetLinkImplementation method to populate the languages if the libraries have already been computed and cached. Change GetTransitivePropertyTargets to invoke GetLinkInterfaceLibraries instead of GetLinkInterface. This is key, as it is a method called by cmGeneratorExpressionEvaluator. Change the cmGeneratorExpressionEvaluator to invoke GetLinkImplementationLibraries instead of GetLinkImplementation. --- Source/cmGeneratorExpressionEvaluator.cxx | 6 +- Source/cmTarget.cxx | 109 ++++++++++++++++++++-- Source/cmTarget.h | 5 + 3 files changed, 108 insertions(+), 12 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index ebedf65b9..bdefcfb28 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1099,9 +1099,9 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode else if (std::find_if(transBegin, transEnd, cmStrCmp(interfacePropertyName)) != transEnd) { - const cmTarget::LinkImplementation *impl = target->GetLinkImplementation( - context->Config, - headTarget); + const cmTarget::LinkImplementation *impl + = target->GetLinkImplementationLibraries(context->Config, + headTarget); if(impl) { linkedTargetsContent = diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0a192e6cc..ea031cd5c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -96,8 +96,11 @@ public: // Cache link interface computation from each configuration. struct OptionalLinkInterface: public cmTarget::LinkInterface { - OptionalLinkInterface(): Exists(false) {} + OptionalLinkInterface(): + Exists(false), Complete(false), ExplicitLibraries(0) {} bool Exists; + bool Complete; + const char* ExplicitLibraries; }; void ComputeLinkInterface(cmTarget const* thisTarget, const char* config, OptionalLinkInterface& iface, @@ -5207,17 +5210,70 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, { // Compute the link interface for this configuration. cmTargetInternals::OptionalLinkInterface iface; - const char* explicitLibraries = + iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, iface, head, iface.Exists); - this->Internal->ComputeLinkInterface(this, config, iface, - head, explicitLibraries); + if (iface.Exists) + { + this->Internal->ComputeLinkInterface(this, config, iface, + head, iface.ExplicitLibraries); + } + + // Store the information for this configuration. + cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); + i = this->Internal->LinkInterfaceMap.insert(entry).first; + } + else if(!i->second.Complete && i->second.Exists) + { + this->Internal->ComputeLinkInterface(this, config, i->second, head, + i->second.ExplicitLibraries); + } + + return i->second.Exists ? &i->second : 0; +} + +//---------------------------------------------------------------------------- +cmTarget::LinkInterface const* +cmTarget::GetLinkInterfaceLibraries(const char* config, + cmTarget const* head) const +{ + // Imported targets have their own link interface. + if(this->IsImported()) + { + if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, head)) + { + return &info->LinkInterface; + } + return 0; + } + + // Link interfaces are not supported for executables that do not + // export symbols. + if(this->GetType() == cmTarget::EXECUTABLE && + !this->IsExecutableWithExports()) + { + return 0; + } + + // Lookup any existing link interface for this configuration. + TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + + cmTargetInternals::LinkInterfaceMapType::iterator + i = this->Internal->LinkInterfaceMap.find(key); + if(i == this->Internal->LinkInterfaceMap.end()) + { + // Compute the link interface for this configuration. + cmTargetInternals::OptionalLinkInterface iface; + iface.ExplicitLibraries = this->ComputeLinkInterfaceLibraries(config, + iface, + head, + iface.Exists); // Store the information for this configuration. cmTargetInternals::LinkInterfaceMapType::value_type entry(key, iface); i = this->Internal->LinkInterfaceMap.insert(entry).first; } - return i->second.Exists? &i->second : 0; + return i->second.Exists ? &i->second : 0; } //---------------------------------------------------------------------------- @@ -5225,8 +5281,8 @@ void cmTarget::GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, std::vector &tgts) const { - cmTarget::LinkInterface const* iface = this->GetLinkInterface(config, - headTarget); + cmTarget::LinkInterface const* iface + = this->GetLinkInterfaceLibraries(config, headTarget); if (!iface) { return; @@ -5387,8 +5443,8 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, // to the link implementation. { // The link implementation is the default link interface. - LinkImplementation const* impl = this->GetLinkImplementation(config, - headTarget); + LinkImplementation const* impl = + this->GetLinkImplementationLibraries(config, headTarget); iface.Libraries = impl->Libraries; if(this->PolicyStatusCMP0022 == cmPolicies::WARN && !this->Internal->PolicyWarnedCMP0022) @@ -5554,6 +5610,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, sscanf(reps, "%u", &iface.Multiplicity); } } + iface.Complete = true; } //---------------------------------------------------------------------------- @@ -5578,6 +5635,40 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const this->ComputeLinkImplementation(config, impl, head); this->ComputeLinkImplementationLanguages(impl); + // Store the information for this configuration. + cmTargetInternals::LinkImplMapType::value_type entry(key, impl); + i = this->Internal->LinkImplMap.insert(entry).first; + } + else if (i->second.Languages.empty()) + { + this->ComputeLinkImplementationLanguages(i->second); + } + + return &i->second; +} + +//---------------------------------------------------------------------------- +cmTarget::LinkImplementation const* +cmTarget::GetLinkImplementationLibraries(const char* config, + cmTarget const* head) const +{ + // There is no link implementation for imported targets. + if(this->IsImported()) + { + return 0; + } + + // Lookup any existing link implementation for this configuration. + TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + + cmTargetInternals::LinkImplMapType::iterator + i = this->Internal->LinkImplMap.find(key); + if(i == this->Internal->LinkImplMap.end()) + { + // Compute the link implementation for this configuration. + LinkImplementation impl; + this->ComputeLinkImplementation(config, impl, head); + // Store the information for this configuration. cmTargetInternals::LinkImplMapType::value_type entry(key, impl); i = this->Internal->LinkImplMap.insert(entry).first; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 8bc5af485..f3cd87427 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -264,6 +264,8 @@ public: if the target cannot be linked. */ LinkInterface const* GetLinkInterface(const char* config, cmTarget const* headTarget) const; + LinkInterface const* GetLinkInterfaceLibraries(const char* config, + cmTarget const* headTarget) const; void GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, std::vector &libs) const; @@ -285,6 +287,9 @@ public: LinkImplementation const* GetLinkImplementation(const char* config, cmTarget const* head) const; + LinkImplementation const* GetLinkImplementationLibraries(const char* config, + cmTarget const* head) const; + /** Link information from the transitive closure of the link implementation and the interfaces of its dependencies. */ struct LinkClosure From a6dd4990dbfa1afadbaeea33250e52affa5e00d9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Feb 2014 13:48:47 +0100 Subject: [PATCH 021/278] cmTarget: Create a temporary cmTarget in checkInterfacePropertyCompatibility This simplifies further refactoring. --- Source/cmTarget.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ea031cd5c..eca8bb76d 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4459,23 +4459,24 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, // target itself has a POSITION_INDEPENDENT_CODE which disagrees // with a dependency. - if (!li->Target) + cmTarget const* theTarget = li->Target; + if (!theTarget) { continue; } - const bool ifaceIsSet = li->Target->GetProperties() + const bool ifaceIsSet = theTarget->GetProperties() .find("INTERFACE_" + p) - != li->Target->GetProperties().end(); + != theTarget->GetProperties().end(); PropertyType ifacePropContent = - getTypedProperty(li->Target, + getTypedProperty(theTarget, ("INTERFACE_" + p).c_str(), 0); std::string reportEntry; if (ifaceIsSet) { reportEntry += " * Target \""; - reportEntry += li->Target->GetName(); + reportEntry += theTarget->GetName(); reportEntry += "\" property value \""; reportEntry += valueAsString(ifacePropContent); reportEntry += "\" "; @@ -4496,7 +4497,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, e << "Property " << p << " on target \"" << tgt->GetName() << "\" does\nnot match the " "INTERFACE_" << p << " property requirement\nof " - "dependency \"" << li->Target->GetName() << "\".\n"; + "dependency \"" << theTarget->GetName() << "\".\n"; cmSystemTools::Error(e.str().c_str()); break; } @@ -4530,7 +4531,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, << tgt->GetName() << "\" is\nimplied to be " << defaultValue << " because it was used to determine the link libraries\n" "already. The INTERFACE_" << p << " property on\ndependency \"" - << li->Target->GetName() << "\" is in conflict.\n"; + << theTarget->GetName() << "\" is in conflict.\n"; cmSystemTools::Error(e.str().c_str()); break; } @@ -4561,7 +4562,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, { cmOStringStream e; e << "The INTERFACE_" << p << " property of \"" - << li->Target->GetName() << "\" does\nnot agree with the value " + << theTarget->GetName() << "\" does\nnot agree with the value " "of " << p << " already determined\nfor \"" << tgt->GetName() << "\".\n"; cmSystemTools::Error(e.str().c_str()); From 5771f81d91d232a143345dc05835323f36ab7ecc Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 18:27:31 +0100 Subject: [PATCH 022/278] cmTarget: Add GetTransitiveTargetClosure method. Replace calls to GetLinkInformation with calls to a method to get only the target closure, not the link languages etc. The replaced calls are used while evaluating generator expressions only. This makes transitive generator expression evaluation independent from the languages of a target. In a follow-up topic, it will be possible to make the languages depend on generator expression evaluation, via evaluation of the SOURCES and INTERFACE_SOURCES target properties. Because the order of entries is not the same as the final link line, the order of debug output is different in the RunCMake.CompatibleInterface test, because the BOOL_PROP7 target property is evaluated first. Adjust the test to account for that new order. --- Source/cmTarget.cxx | 76 ++++++++++++++----- Source/cmTarget.h | 3 + .../DebugProperties-stderr.txt | 14 ++-- 3 files changed, 67 insertions(+), 26 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index eca8bb76d..7df2928cb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4424,12 +4424,13 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, assert((impliedByUse ^ explicitlySet) || (!impliedByUse && !explicitlySet)); - cmComputeLinkInformation *info = tgt->GetLinkInformation(config); - if(!info) + std::vector deps; + tgt->GetTransitiveTargetClosure(config, tgt, deps); + + if(deps.empty()) { return propContent; } - const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); bool propInitialized = explicitlySet; std::string report = " * Target \""; @@ -4449,7 +4450,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, report += "\" property not set.\n"; } - for(cmComputeLinkInformation::ItemVector::const_iterator li = + for(std::vector::const_iterator li = deps.begin(); li != deps.end(); ++li) { @@ -4459,11 +4460,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, // target itself has a POSITION_INDEPENDENT_CODE which disagrees // with a dependency. - cmTarget const* theTarget = li->Target; - if (!theTarget) - { - continue; - } + cmTarget const* theTarget = *li; const bool ifaceIsSet = theTarget->GetProperties() .find("INTERFACE_" + p) @@ -4643,23 +4640,19 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, const char *interfaceProperty, const char *config) { - cmComputeLinkInformation *info = tgt->GetLinkInformation(config); - if(!info) + std::vector deps; + tgt->GetTransitiveTargetClosure(config, tgt, deps); + + if(deps.empty()) { return false; } - const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); - - for(cmComputeLinkInformation::ItemVector::const_iterator li = + for(std::vector::const_iterator li = deps.begin(); li != deps.end(); ++li) { - if (!li->Target) - { - continue; - } - const char *prop = li->Target->GetProperty(interfaceProperty); + const char *prop = (*li)->GetProperty(interfaceProperty); if (!prop) { continue; @@ -5277,6 +5270,51 @@ cmTarget::GetLinkInterfaceLibraries(const char* config, return i->second.Exists ? &i->second : 0; } +//---------------------------------------------------------------------------- +void processILibs(const char* config, + cmTarget const* headTarget, + std::string const& name, + std::vector& tgts, std::set& emitted) +{ + if (cmTarget* tgt = headTarget->GetMakefile() + ->FindTargetToUse(name.c_str())) + { + if (emitted.insert(tgt).second) + { + tgts.push_back(tgt); + std::vector ilibs; + cmTarget::LinkInterface const* iface = + tgt->GetLinkInterfaceLibraries(config, headTarget); + if (iface) + { + for(std::vector::const_iterator + it = iface->Libraries.begin(); + it != iface->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); + } + } + } + } +} + +//---------------------------------------------------------------------------- +void cmTarget::GetTransitiveTargetClosure(const char* config, + cmTarget const* headTarget, + std::vector &tgts) const +{ + std::set emitted; + + cmTarget::LinkImplementation const* impl + = this->GetLinkImplementationLibraries(config, headTarget); + + for(std::vector::const_iterator it = impl->Libraries.begin(); + it != impl->Libraries.end(); ++it) + { + processILibs(config, headTarget, *it, tgts, emitted); + } +} + //---------------------------------------------------------------------------- void cmTarget::GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f3cd87427..5dec9e2b6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -269,6 +269,9 @@ public: void GetTransitivePropertyTargets(const char* config, cmTarget const* headTarget, std::vector &libs) const; + void GetTransitiveTargetClosure(const char* config, + cmTarget const* headTarget, + std::vector &libs) const; /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ diff --git a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt index 17b8a5cfe..82a34d530 100644 --- a/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt +++ b/Tests/RunCMake/CompatibleInterface/DebugProperties-stderr.txt @@ -1,3 +1,10 @@ +CMake Debug Log: + Boolean compatibility of property "BOOL_PROP7" for target + "CompatibleInterface" \(result: "FALSE"\): + + \* Target "CompatibleInterface" property is implied by use. + \* Target "iface1" property value "FALSE" \(Agree\) ++ CMake Debug Log: Boolean compatibility of property "BOOL_PROP1" for target "CompatibleInterface" \(result: "TRUE"\): @@ -39,13 +46,6 @@ CMake Debug Log: \* Target "iface1" property value "FALSE" \(Interface set\) \* Target "iface2" property value "FALSE" \(Agree\) + -CMake Debug Log: - Boolean compatibility of property "BOOL_PROP7" for target - "CompatibleInterface" \(result: "FALSE"\): - - \* Target "CompatibleInterface" property is implied by use. - \* Target "iface1" property value "FALSE" \(Agree\) -+ CMake Debug Log: String compatibility of property "STRING_PROP1" for target "CompatibleInterface" \(result: "prop1"\): From d3682d8647789db759270a2f9c96493167468e61 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 14 Feb 2014 10:23:23 +0100 Subject: [PATCH 023/278] cmGeneratorTarget: Use a method to access the definition file. --- Source/cmGeneratorTarget.cxx | 6 ++++++ Source/cmGeneratorTarget.h | 3 ++- Source/cmMakefileTargetGenerator.cxx | 11 ++++++----- Source/cmNinjaTargetGenerator.cxx | 6 +++--- Source/cmVisualStudio10TargetGenerator.cxx | 6 +++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6223ed102..e2810acb0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -430,6 +430,12 @@ void cmGeneratorTarget::LookupObjectLibraries() } } +//---------------------------------------------------------------------------- +std::string cmGeneratorTarget::GetModuleDefinitionFile() const +{ + return this->ModuleDefinitionFile; +} + //---------------------------------------------------------------------------- void cmGeneratorTarget::UseObjectLibraries(std::vector& objs) const diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 9a3339d37..51d51f327 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -52,7 +52,7 @@ public: cmLocalGenerator* LocalGenerator; cmGlobalGenerator const* GlobalGenerator; - std::string ModuleDefinitionFile; + std::string GetModuleDefinitionFile() const; /** Full path with trailing slash to the top-level directory holding object files for this target. Includes the build @@ -118,6 +118,7 @@ private: struct SourceEntry { std::vector Depends; }; typedef std::map SourceEntriesType; SourceEntriesType SourceEntries; + std::string ModuleDefinitionFile; std::vector CustomCommands; std::vector ExtraSources; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c3ca85d5a..5a841edfd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1650,9 +1650,10 @@ void cmMakefileTargetGenerator this->AppendTargetDepends(depends); // Add a dependency on the link definitions file, if any. - if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) + std::string def = this->GeneratorTarget->GetModuleDefinitionFile(); + if(!def.empty()) { - depends.push_back(this->GeneratorTarget->ModuleDefinitionFile); + depends.push_back(def); } // Add user-specified dependencies. @@ -2019,7 +2020,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) { - if(this->GeneratorTarget->ModuleDefinitionFile.empty()) + std::string def = this->GeneratorTarget->GetModuleDefinitionFile(); + if(def.empty()) { return; } @@ -2035,8 +2037,7 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // Append the flag and value. Use ConvertToLinkReference to help // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference( - this->GeneratorTarget->ModuleDefinitionFile.c_str())); + flag += (this->LocalGenerator->ConvertToLinkReference(def.c_str())); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 900af8d6e..5f6fc2d2a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -498,10 +498,10 @@ cmNinjaTargetGenerator { this->WriteObjectBuildStatement(*si); } - if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) + std::string def = this->GeneratorTarget->GetModuleDefinitionFile(); + if(!def.empty()) { - this->ModuleDefinitionFile = this->ConvertToNinjaPath( - this->GeneratorTarget->ModuleDefinitionFile.c_str()); + this->ModuleDefinitionFile = this->ConvertToNinjaPath(def.c_str()); } { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ed7e243e8..d760b3fa7 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1666,10 +1666,10 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) linkOptions.AddFlag("ImportLibrary", imLib.c_str()); linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str()); linkOptions.Parse(flags.c_str()); - if(!this->GeneratorTarget->ModuleDefinitionFile.empty()) + std::string def = this->GeneratorTarget->GetModuleDefinitionFile(); + if(!def.empty()) { - linkOptions.AddFlag("ModuleDefinitionFile", - this->GeneratorTarget->ModuleDefinitionFile.c_str()); + linkOptions.AddFlag("ModuleDefinitionFile", def.c_str()); } this->LinkOptions[config] = pOptions.release(); From 64d398416ad678c1c57fbd3a7981623e28d69bca Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Feb 2014 21:07:31 +0100 Subject: [PATCH 024/278] cmGeneratorTarget: Classify sources on demand, not up front. Implement a Visitor to hold the sequence of source file tests for populating outputs. Use VS 6 and 7 workaround from Brad King for lack of partial template specialization and function template specialization capabilities. This will make it possible to use context dependent generator expressions to determine the sources of a target. --- Source/cmGeneratorTarget.cxx | 355 +++++++++++++++++++++++------------ Source/cmGeneratorTarget.h | 15 +- Source/cmGlobalGenerator.cxx | 1 - 3 files changed, 243 insertions(+), 128 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e2810acb0..4cb19044c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -24,6 +24,194 @@ #include "assert.h" +//---------------------------------------------------------------------------- +void reportBadObjLib(std::vector const& badObjLib, + cmTarget *target, cmake *cm) +{ + if(!badObjLib.empty()) + { + cmOStringStream e; + e << "OBJECT library \"" << target->GetName() << "\" contains:\n"; + for(std::vector::const_iterator i = badObjLib.begin(); + i != badObjLib.end(); ++i) + { + e << " " << (*i)->GetLocation().GetName() << "\n"; + } + e << "but may contain only headers and sources that compile."; + cm->IssueMessage(cmake::FATAL_ERROR, e.str(), + target->GetBacktrace()); + } +} + +struct ObjectSourcesTag {}; +struct CustomCommandsTag {}; +struct ExtraSourcesTag {}; +struct HeaderSourcesTag {}; +struct ExternalObjectsTag {}; +struct IDLSourcesTag {}; +struct ResxTag {}; +struct ModuleDefinitionFileTag {}; + +#if !defined(_MSC_VER) || _MSC_VER >= 1310 +template +struct IsSameTag +{ + enum { + Result = false + }; +}; + +template +struct IsSameTag +{ + enum { + Result = true + }; +}; +#else +struct IsSameTagBase +{ + typedef char (&no_type)[1]; + typedef char (&yes_type)[2]; + template struct Check; + template static yes_type check(Check*, Check*); + static no_type check(...); +}; +template +struct IsSameTag: public IsSameTagBase +{ + enum { + Result = (sizeof(check(static_cast< Check* >(0), + static_cast< Check* >(0))) == + sizeof(yes_type)) + }; +}; +#endif + +template +struct DoAccept +{ + template static void Do(T&, cmSourceFile*) {} +}; + +template<> +struct DoAccept +{ + static void Do(std::vector& files, cmSourceFile* f) + { + files.push_back(f); + } + static void Do(cmGeneratorTarget::ResxData& data, cmSourceFile* f) + { + // Build and save the name of the corresponding .h file + // This relationship will be used later when building the project files. + // Both names would have been auto generated from Visual Studio + // where the user supplied the file name and Visual Studio + // appended the suffix. + std::string resx = f->GetFullPath(); + std::string hFileName = resx.substr(0, resx.find_last_of(".")) + ".h"; + data.ExpectedResxHeaders.insert(hFileName); + data.ResxSources.push_back(f); + } + static void Do(std::string& data, cmSourceFile* f) + { + data = f->GetFullPath(); + } +}; + +//---------------------------------------------------------------------------- +template > +struct TagVisitor +{ + DataType& Data; + std::vector BadObjLibFiles; + cmTarget *Target; + cmGlobalGenerator *GlobalGenerator; + cmsys::RegularExpression Header; + bool IsObjLib; + + TagVisitor(cmTarget *target, DataType& data) + : Data(data), Target(target), + GlobalGenerator(target->GetMakefile() + ->GetLocalGenerator()->GetGlobalGenerator()), + Header(CM_HEADER_REGEX), + IsObjLib(target->GetType() == cmTarget::OBJECT_LIBRARY) + { + } + + ~TagVisitor() + { + reportBadObjLib(this->BadObjLibFiles, this->Target, + this->GlobalGenerator->GetCMakeInstance()); + } + + void Accept(cmSourceFile *sf) + { + std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); + if(sf->GetCustomCommand()) + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(this->Target->GetType() == cmTarget::UTILITY) + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY")) + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT")) + { + DoAccept::Result>::Do(this->Data, sf); + if(this->IsObjLib) + { + this->BadObjLibFiles.push_back(sf); + } + } + else if(sf->GetLanguage()) + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(ext == "def") + { + DoAccept::Result>::Do(this->Data, + sf); + if(this->IsObjLib) + { + this->BadObjLibFiles.push_back(sf); + } + } + else if(ext == "idl") + { + DoAccept::Result>::Do(this->Data, sf); + if(this->IsObjLib) + { + this->BadObjLibFiles.push_back(sf); + } + } + else if(ext == "resx") + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(this->Header.find(sf->GetFullPath().c_str())) + { + DoAccept::Result>::Do(this->Data, sf); + } + else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) + { + DoAccept::Result>::Do(this->Data, sf); + } + else + { + DoAccept::Result>::Do(this->Data, sf); + if(this->IsObjLib && ext != "txt") + { + this->BadObjLibFiles.push_back(sf); + } + } + } +}; + //---------------------------------------------------------------------------- cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t), SourceFileFlagsConstructed(false) @@ -96,11 +284,34 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, } } +#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \ + { \ + std::vector sourceFiles; \ + this->Target->GetSourceFiles(sourceFiles); \ + TagVisitor visitor(this->Target, data); \ + for(std::vector::const_iterator si = sourceFiles.begin(); \ + si != sourceFiles.end(); ++si) \ + { \ + visitor.Accept(*si); \ + } \ + } \ + + +#define IMPLEMENT_VISIT(DATA) \ + IMPLEMENT_VISIT_IMPL(DATA, EMPTY) \ + +#define EMPTY +#define COMMA , + //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetObjectSources(std::vector &objs) const +cmGeneratorTarget::GetObjectSources(std::vector &data) const { - objs = this->ObjectSources; + IMPLEMENT_VISIT(ObjectSources); + if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY) + { + this->ObjectSources = data; + } } //---------------------------------------------------------------------------- @@ -129,49 +340,53 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetResxSources(std::vector& srcs) const +void cmGeneratorTarget::GetIDLSources(std::vector& data) const { - srcs = this->ResxSources; -} - -//---------------------------------------------------------------------------- -void cmGeneratorTarget::GetIDLSources(std::vector& srcs) const -{ - srcs = this->IDLSources; + IMPLEMENT_VISIT(IDLSources); } //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetHeaderSources(std::vector& srcs) const +cmGeneratorTarget::GetHeaderSources(std::vector& data) const { - srcs = this->HeaderSources; + IMPLEMENT_VISIT(HeaderSources); } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetExtraSources(std::vector& srcs) const +void cmGeneratorTarget::GetExtraSources(std::vector& data) const { - srcs = this->ExtraSources; + IMPLEMENT_VISIT(ExtraSources); } //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetCustomCommands(std::vector& srcs) const +cmGeneratorTarget::GetCustomCommands(std::vector& data) const { - srcs = this->CustomCommands; + IMPLEMENT_VISIT(CustomCommands); +} + +//---------------------------------------------------------------------------- +void +cmGeneratorTarget::GetExternalObjects(std::vector& data) const +{ + IMPLEMENT_VISIT(ExternalObjects); } //---------------------------------------------------------------------------- void cmGeneratorTarget::GetExpectedResxHeaders(std::set& srcs) const { - srcs = this->ExpectedResxHeaders; + ResxData data; + IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) + srcs = data.ExpectedResxHeaders; } //---------------------------------------------------------------------------- -void -cmGeneratorTarget::GetExternalObjects(std::vector& srcs) const +void cmGeneratorTarget::GetResxSources(std::vector& srcs) const { - srcs = this->ExternalObjects; + ResxData data; + IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) + srcs = data.ResxSources; } //---------------------------------------------------------------------------- @@ -282,102 +497,6 @@ void cmGeneratorTarget::GetSourceFiles(std::vector &files) const this->Target->GetSourceFiles(files); } -//---------------------------------------------------------------------------- -void cmGeneratorTarget::ClassifySources() -{ - cmsys::RegularExpression header(CM_HEADER_REGEX); - - cmTarget::TargetType targetType = this->Target->GetType(); - bool isObjLib = targetType == cmTarget::OBJECT_LIBRARY; - - std::vector badObjLib; - std::vector sources; - this->Target->GetSourceFiles(sources); - for(std::vector::const_iterator si = sources.begin(); - si != sources.end(); ++si) - { - cmSourceFile* sf = *si; - std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); - if(sf->GetCustomCommand()) - { - this->CustomCommands.push_back(sf); - } - else if(targetType == cmTarget::UTILITY) - { - this->ExtraSources.push_back(sf); - } - else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY")) - { - this->HeaderSources.push_back(sf); - } - else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT")) - { - this->ExternalObjects.push_back(sf); - if(isObjLib) { badObjLib.push_back(sf); } - } - else if(sf->GetLanguage()) - { - this->ObjectSources.push_back(sf); - } - else if(ext == "def") - { - this->ModuleDefinitionFile = sf->GetFullPath(); - if(isObjLib) { badObjLib.push_back(sf); } - } - else if(ext == "idl") - { - this->IDLSources.push_back(sf); - if(isObjLib) { badObjLib.push_back(sf); } - } - else if(ext == "resx") - { - // Build and save the name of the corresponding .h file - // This relationship will be used later when building the project files. - // Both names would have been auto generated from Visual Studio - // where the user supplied the file name and Visual Studio - // appended the suffix. - std::string resx = sf->GetFullPath(); - std::string hFileName = resx.substr(0, resx.find_last_of(".")) + ".h"; - this->ExpectedResxHeaders.insert(hFileName); - this->ResxSources.push_back(sf); - } - else if(header.find(sf->GetFullPath().c_str())) - { - this->HeaderSources.push_back(sf); - } - else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str())) - { - // We only get here if a source file is not an external object - // and has an extension that is listed as an ignored file type. - // No message or diagnosis should be given. - this->ExtraSources.push_back(sf); - } - else - { - this->ExtraSources.push_back(sf); - if(isObjLib && ext != "txt") - { - badObjLib.push_back(sf); - } - } - } - - if(!badObjLib.empty()) - { - cmOStringStream e; - e << "OBJECT library \"" << this->Target->GetName() << "\" contains:\n"; - for(std::vector::iterator i = badObjLib.begin(); - i != badObjLib.end(); ++i) - { - e << " " << (*i)->GetLocation().GetName() << "\n"; - } - e << "but may contain only headers and sources that compile."; - this->GlobalGenerator->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str(), - this->Target->GetBacktrace()); - } -} - //---------------------------------------------------------------------------- void cmGeneratorTarget::LookupObjectLibraries() { @@ -433,7 +552,9 @@ void cmGeneratorTarget::LookupObjectLibraries() //---------------------------------------------------------------------------- std::string cmGeneratorTarget::GetModuleDefinitionFile() const { - return this->ModuleDefinitionFile; + std::string data; + IMPLEMENT_VISIT_IMPL(ModuleDefinitionFile, COMMA std::string) + return data; } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 51d51f327..1e6ce64c0 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -82,7 +82,6 @@ public: */ void TraceDependencies(); - void ClassifySources(); void LookupObjectLibraries(); /** Get sources that must be built before the given source. */ @@ -113,23 +112,19 @@ public: struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf) const; + struct ResxData { + mutable std::set ExpectedResxHeaders; + mutable std::vector ResxSources; + }; private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; typedef std::map SourceEntriesType; SourceEntriesType SourceEntries; - std::string ModuleDefinitionFile; - std::vector CustomCommands; - std::vector ExtraSources; - std::vector HeaderSources; - std::vector ExternalObjects; - std::vector IDLSources; - std::vector ResxSources; std::map Objects; std::set ExplicitObjectName; - std::set ExpectedResxHeaders; - std::vector ObjectSources; + mutable std::vector ObjectSources; std::vector ObjectLibraries; mutable std::map > SystemIncludesCache; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index e143ebafa..f76c6d19a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1439,7 +1439,6 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects() continue; } cmGeneratorTarget* gt = ti->second; - gt->ClassifySources(); gt->LookupObjectLibraries(); this->ComputeTargetObjects(gt); } From f9d5b1fd0fe1e1c5a0083c6518c7da6c36776042 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 14 Feb 2014 12:24:13 +0100 Subject: [PATCH 025/278] Handle Mac OSX source flags for individual files lazily. The actual list of files will become config dependent in a follow-up commit. --- Source/cmGeneratorTarget.cxx | 43 ++++++++++++++---------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4cb19044c..a7b2fb69c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1009,6 +1009,23 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const { flags = si->second; } + else + { + // Handle the MACOSX_PACKAGE_LOCATION property on source files that + // were not listed in one of the other lists. + if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) + { + flags.MacFolder = location; + if(strcmp(location, "Resources") == 0) + { + flags.Type = cmGeneratorTarget::SourceFileTypeResource; + } + else + { + flags.Type = cmGeneratorTarget::SourceFileTypeMacContent; + } + } + } return flags; } @@ -1072,30 +1089,4 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const } } } - - // Handle the MACOSX_PACKAGE_LOCATION property on source files that - // were not listed in one of the other lists. - std::vector sources; - this->GetSourceFiles(sources); - for(std::vector::const_iterator si = sources.begin(); - si != sources.end(); ++si) - { - cmSourceFile* sf = *si; - if(const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) - { - SourceFileFlags& flags = this->SourceFlagsMap[sf]; - if(flags.Type == cmGeneratorTarget::SourceFileTypeNormal) - { - flags.MacFolder = location; - if(strcmp(location, "Resources") == 0) - { - flags.Type = cmGeneratorTarget::SourceFileTypeResource; - } - else - { - flags.Type = cmGeneratorTarget::SourceFileTypeMacContent; - } - } - } - } } From b4aac0caca76c7d2041556785799b5ea1bbf1ce7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Feb 2014 09:25:30 -0500 Subject: [PATCH 026/278] Makefile: Fix per-config linker PDB output directory Also, now that all call sites of cmTarget::GetPDBName and cmTarget::GetPDBDirectory pass the configuration, make the argument non-optional. --- Source/cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmTarget.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 69b8092a0..664d73e87 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -129,7 +129,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } } - std::string pdbOutputPath = this->Target->GetPDBDirectory(); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d6a0cd4b2..b9af63815 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -321,7 +321,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } - std::string pdbOutputPath = this->Target->GetPDBDirectory(); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 271824ba9..599e85d88 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -340,7 +340,7 @@ public: If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical pdb output directory is given. */ - std::string GetPDBDirectory(const char* config = 0) const; + std::string GetPDBDirectory(const char* config) const; /** Get the location of the target in the build tree for the given configuration. This location is suitable for use as the LOCATION @@ -375,7 +375,7 @@ public: const char* config=0, bool implib = false) const; /** Get the name of the pdb file for the target. */ - std::string GetPDBName(const char* config=0) const; + std::string GetPDBName(const char* config) const; /** Whether this library has soname enabled and platform supports it. */ bool HasSOName(const char* config) const; From aae5184c169b037c027d4ede5ba42c37395ba7b4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Feb 2014 11:45:49 -0500 Subject: [PATCH 027/278] Help: Refactor PDB_NAME and PDB_OUTPUT_DIRECTORY docs Move the note about VS 6 into the PDB_NOTE.txt common include file and include it from the per-config properties too. Also re-word the note to clarify the separate compiler and linker flags involved and state explicitly that compiler flags are not affected. --- Help/prop_tgt/PDB_NAME.rst | 3 --- Help/prop_tgt/PDB_NAME_CONFIG.rst | 3 +-- Help/prop_tgt/PDB_NOTE.txt | 10 +++++++--- Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst | 3 --- Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst | 3 +-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Help/prop_tgt/PDB_NAME.rst b/Help/prop_tgt/PDB_NAME.rst index e8fc3be52..333c8656b 100644 --- a/Help/prop_tgt/PDB_NAME.rst +++ b/Help/prop_tgt/PDB_NAME.rst @@ -8,6 +8,3 @@ This property specifies the base name for the debug symbols file. If not set, the logical target name is used by default. .. include:: PDB_NOTE.txt - -This property is not implemented by the :generator:`Visual Studio 6` -generator. diff --git a/Help/prop_tgt/PDB_NAME_CONFIG.rst b/Help/prop_tgt/PDB_NAME_CONFIG.rst index c846b57d1..7bf9e43dc 100644 --- a/Help/prop_tgt/PDB_NAME_CONFIG.rst +++ b/Help/prop_tgt/PDB_NAME_CONFIG.rst @@ -6,5 +6,4 @@ generated by the linker for an executable or shared library target. This is the configuration-specific version of :prop_tgt:`PDB_NAME`. -This property is not implemented by the :generator:`Visual Studio 6` -generator. +.. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NOTE.txt b/Help/prop_tgt/PDB_NOTE.txt index e55aba285..c03bd3a56 100644 --- a/Help/prop_tgt/PDB_NOTE.txt +++ b/Help/prop_tgt/PDB_NOTE.txt @@ -3,6 +3,10 @@ is invoked to produce them so they have no linker-generated ``.pdb`` file containing debug symbols. - The compiler-generated program database files specified by the MSVC - ``/Fd`` flag are not the same as linker-generated program database - files and so are not influenced by this property. + The linker-generated program database files are specified by the + ``/pdb`` linker flag and are not the same as compiler-generated + program database files specified by the ``/Fd`` compiler flag. + This property does not influence the latter. + + This property is not implemented by the :generator:`Visual Studio 6` + generator. diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst index 9a863a1d1..48773685f 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst @@ -10,6 +10,3 @@ value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is set when a target is created. .. include:: PDB_NOTE.txt - -This property is not implemented by the :generator:`Visual Studio 6` -generator. diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst index caec2de25..7bbc23706 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,5 +11,4 @@ property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_` variable if it is set when a target is created. -This property is not implemented by the :generator:`Visual Studio 6` -generator. +.. include:: PDB_NOTE.txt From 718a9532c6bfa8c68864dd5dadba9f55e0f1bcf3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Feb 2014 14:09:05 -0500 Subject: [PATCH 028/278] cmTarget: Refactor ComputePDBOutputDir interface Add a runtime parameter to specify the property name prefix. Update the call site to pass "PDB" to preserve the existing name for that call path. --- Source/cmTarget.cxx | 10 +++++----- Source/cmTarget.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index db34bd826..cf0926973 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2467,7 +2467,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const OutputInfo info; this->ComputeOutputDir(config, false, info.OutDir); this->ComputeOutputDir(config, true, info.ImpDir); - if(!this->ComputePDBOutputDir(config, info.PdbDir)) + if(!this->ComputePDBOutputDir("PDB", config, info.PdbDir)) { info.PdbDir = info.OutDir; } @@ -4111,13 +4111,13 @@ bool cmTarget::ComputeOutputDir(const char* config, } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* config, std::string& out) const +bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, + std::string& out) const { // Look for a target property defining the target output directory // based on the target type. - std::string targetTypeName = "PDB"; const char* propertyName = 0; - std::string propertyNameStr = targetTypeName; + std::string propertyNameStr = kind; if(!propertyNameStr.empty()) { propertyNameStr += "_OUTPUT_DIRECTORY"; @@ -4127,7 +4127,7 @@ bool cmTarget::ComputePDBOutputDir(const char* config, std::string& out) const // Check for a per-configuration output directory target property. std::string configUpper = cmSystemTools::UpperCase(config? config : ""); const char* configProp = 0; - std::string configPropStr = targetTypeName; + std::string configPropStr = kind; if(!configPropStr.empty()) { configPropStr += "_OUTPUT_DIRECTORY_"; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 599e85d88..768325385 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -710,7 +710,8 @@ private: OutputInfo const* GetOutputInfo(const char* config) const; bool ComputeOutputDir(const char* config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* config, std::string& out) const; + bool ComputePDBOutputDir(const char* kind, const char* config, + std::string& out) const; // Cache import information from properties for each configuration. struct ImportInfo; From 3737860a383b1020f44a31be9ac5536e9913fc71 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Feb 2014 14:09:30 -0500 Subject: [PATCH 029/278] cmTarget: Add per-config compilation info Add a cmTarget::CompileInfo struct to hold per-configuration information about the compilation settings in a target. This is different than cmTarget::OutputInfo because it applies to any targets that can compile sources even if they do not link or archive. --- Source/cmTarget.cxx | 46 +++++++++++++++++++++++++++++++++++++++++++++ Source/cmTarget.h | 4 ++++ 2 files changed, 50 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cf0926973..a50d6adfc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -71,6 +71,11 @@ struct cmTarget::ImportInfo cmTarget::LinkInterface LinkInterface; }; +//---------------------------------------------------------------------------- +struct cmTarget::CompileInfo +{ +}; + struct TargetConfigPair : public std::pair { TargetConfigPair(cmTarget const* tgt, const std::string &config) : std::pair(tgt, config) {} @@ -116,6 +121,9 @@ public: ImportInfoMapType; ImportInfoMapType ImportInfoMap; + typedef std::map CompileInfoMapType; + CompileInfoMapType CompileInfoMap; + // Cache link implementation computation from each configuration. typedef std::map LinkImplMapType; @@ -2477,6 +2485,44 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const return &i->second; } +//---------------------------------------------------------------------------- +cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const +{ + // There is no compile information for imported targets. + if(this->IsImported()) + { + return 0; + } + + if(this->GetType() > cmTarget::OBJECT_LIBRARY) + { + std::string msg = "cmTarget::GetCompileInfo called for "; + msg += this->GetName(); + msg += " which has type "; + msg += cmTarget::GetTargetTypeName(this->GetType()); + this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg); + abort(); + return 0; + } + + // Lookup/compute/cache the compile information for this configuration. + std::string config_upper; + if(config && *config) + { + config_upper = cmSystemTools::UpperCase(config); + } + typedef cmTargetInternals::CompileInfoMapType CompileInfoMapType; + CompileInfoMapType::const_iterator i = + this->Internal->CompileInfoMap.find(config_upper); + if(i == this->Internal->CompileInfoMap.end()) + { + CompileInfo info; + CompileInfoMapType::value_type entry(config_upper, info); + i = this->Internal->CompileInfoMap.insert(entry).first; + } + return &i->second; +} + //---------------------------------------------------------------------------- std::string cmTarget::GetDirectory(const char* config, bool implib) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 768325385..678770606 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -720,6 +720,10 @@ private: void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, cmTarget const* head) const; + // Cache target compile paths for each configuration. + struct CompileInfo; + CompileInfo const* GetCompileInfo(const char* config) const; + mutable cmTargetLinkInformationMap LinkInformation; void CheckPropertyCompatibility(cmComputeLinkInformation *info, const char* config) const; From cd8c797a8592cfae1894c5b81c70e011c1dd9490 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 25 Feb 2014 00:01:14 -0500 Subject: [PATCH 030/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e9a17213b..56e5b81d4 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140224) +set(CMake_VERSION_PATCH 20140225) #set(CMake_VERSION_RC 1) From 048be20536b6960e3a4a5001ba3d642e2e5cdad1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 11 Feb 2014 13:54:07 -0500 Subject: [PATCH 031/278] Help: Add release notes for the 'faster-parsers' topic --- Help/release/dev/faster-parsers.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/faster-parsers.rst diff --git a/Help/release/dev/faster-parsers.rst b/Help/release/dev/faster-parsers.rst new file mode 100644 index 000000000..c2a8bfb36 --- /dev/null +++ b/Help/release/dev/faster-parsers.rst @@ -0,0 +1,6 @@ +faster-parsers +-------------- + +* The :manual:`cmake-language(7)` internal implementation of generator + expression and list expansion parsers have been optimized and shows + non-trivial speedup on large projects. From 8993df6c3db7a105f146f07b7ff5585698b1c29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Sat, 22 Feb 2014 19:46:48 +0100 Subject: [PATCH 032/278] FindHg: Search for TortoiseHg Use the TortoiseHg registry entry as a search path. --- Modules/FindHg.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index a1fb33f3c..8dea65232 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -37,6 +37,8 @@ find_program(HG_EXECUTABLE NAMES hg + PATHS + [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG] PATH_SUFFIXES Mercurial DOC "hg command line client" ) From bcefbe737dee16c58bc578d4d483727ff859f8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Sat, 22 Feb 2014 19:46:48 +0100 Subject: [PATCH 033/278] FindHg: Add Hg_WC_INFO macro Add a macro to extract information from a Hg work tree much like the Subversion_WC_INFO macro does for Subversion work tree. --- Modules/FindHg.cmake | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake index 8dea65232..c418afdd2 100644 --- a/Modules/FindHg.cmake +++ b/Modules/FindHg.cmake @@ -2,7 +2,7 @@ # FindHg # ------ # -# +# Extract information from a mercurial working copy. # # The module defines the following variables: # @@ -12,6 +12,20 @@ # HG_FOUND - true if the command line client was found # HG_VERSION_STRING - the version of mercurial found # +# If the command line client executable is found the following macro is defined: +# +# :: +# +# HG_WC_INFO( ) +# +# Hg_WC_INFO extracts information of a mercurial working copy +# at a given location. This macro defines the following variables: +# +# :: +# +# _WC_CHANGESET - current changeset +# _WC_REVISION - current revision +# # Example usage: # # :: @@ -19,11 +33,15 @@ # find_package(Hg) # if(HG_FOUND) # message("hg found: ${HG_EXECUTABLE}") +# HG_WC_INFO(${PROJECT_SOURCE_DIR} Project) +# message("Current revision is ${Project_WC_REVISION}") +# message("Current changeset is ${Project_WC_CHANGESET}") # endif() #============================================================================= # Copyright 2010-2012 Kitware, Inc. # Copyright 2012 Rolf Eike Beer +# Copyright 2014 Matthaeus G. Chajdas # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -53,6 +71,21 @@ if(HG_EXECUTABLE) set(HG_VERSION_STRING "${CMAKE_MATCH_1}") endif() unset(hg_version) + + macro(HG_WC_INFO dir prefix) + execute_process(COMMAND ${HG_EXECUTABLE} id -i -n + WORKING_DIRECTORY ${dir} + RESULT_VARIABLE hg_id_result + ERROR_VARIABLE hg_id_error + OUTPUT_VARIABLE ${prefix}_WC_DATA + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT ${hg_id_result} EQUAL 0) + message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}") + endif() + + string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA}) + string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA}) + endmacro(HG_WC_INFO) endif() # Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if From 4c0f8dfb0aecd1eb7b567d627f4c312b2d0d5f68 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 25 Feb 2014 11:48:00 -0500 Subject: [PATCH 034/278] Utilities/Release: Update default binary distribution dir to v3.0 --- Utilities/Release/upload_release.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 9bf35236d..0d928ba63 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -3,7 +3,7 @@ if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-) endif() if(NOT VERSION) - set(VERSION 2.8) + set(VERSION 3.0) endif() set(dir "v${VERSION}") if("${VERSION}" MATCHES "master") From b3d85113a63e360e7552ec5332ef7b6c3162abcc Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 25 Feb 2014 13:11:04 -0500 Subject: [PATCH 035/278] Utilities/Release: Copy pre-built docs tarball to unique name Name the pre-built docs tarball on the remote machine according to the release script name so that multiple tarballs going to a single remote machine do not clobber one another. --- Utilities/Release/release_cmake.cmake | 9 +++++---- Utilities/Release/release_cmake.sh.in | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 630f54fe3..a8772ee91 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -67,14 +67,15 @@ macro(remote_command comment command) endmacro() if(CMAKE_DOC_TARBALL) - message("scp '${CMAKE_DOC_TARBALL}' '${HOST}:'") + get_filename_component(CMAKE_DOC_TARBALL_NAME "${CMAKE_DOC_TARBALL}" NAME) + string(REPLACE ".tar.gz" "-${SCRIPT_NAME}.tar.gz" CMAKE_DOC_TARBALL_STAGED "${CMAKE_DOC_TARBALL_NAME}") + message("scp '${CMAKE_DOC_TARBALL}' '${HOST}:${CMAKE_DOC_TARBALL_STAGED}'") execute_process(COMMAND - scp ${CMAKE_DOC_TARBALL} ${HOST}: + scp ${CMAKE_DOC_TARBALL} ${HOST}:${CMAKE_DOC_TARBALL_STAGED} RESULT_VARIABLE result) if(${result} GREATER 0) - message("error sending doc tarball with scp '${CMAKE_DOC_TARBALL}' '${HOST}:'") + message("error sending doc tarball with scp '${CMAKE_DOC_TARBALL}' '${HOST}:${CMAKE_DOC_TARBALL_STAGED}'") endif() - get_filename_component(CMAKE_DOC_TARBALL_NAME "${CMAKE_DOC_TARBALL}" NAME) endif() # set this so configure file will work from script mode diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index f41bda895..1f57c28e3 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -18,7 +18,7 @@ check_exit_value() CMAKE_DOC_TARBALL="" if [ ! -z "@CMAKE_DOC_TARBALL_NAME@" ] ; then CMAKE_DOC_TARBALL=@CMAKE_RELEASE_DIRECTORY@/@CMAKE_DOC_TARBALL_NAME@ - mv "$HOME/@CMAKE_DOC_TARBALL_NAME@" "$CMAKE_DOC_TARBALL" + mv "$HOME/@CMAKE_DOC_TARBALL_STAGED@" "$CMAKE_DOC_TARBALL" check_exit_value $? "mv doc tarball" || exit 1 fi From c859d176a15326cd1ef7b5c35908f28313d1be19 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 26 Feb 2014 00:01:06 -0500 Subject: [PATCH 036/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 56e5b81d4..a1ae3b327 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140225) +set(CMake_VERSION_PATCH 20140226) #set(CMake_VERSION_RC 1) From 6fcd835c0786182c4981f9f640849c5c91100845 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Mon, 24 Feb 2014 23:21:12 +0100 Subject: [PATCH 037/278] CPackWIX: refactor and cleanup Extract addtional classes and functions which are getting unsightly large. Use some of the coding conventions more consistently. --- Source/CMakeLists.txt | 4 + Source/CPack/WiX/cmCPackWIXGenerator.cxx | 581 ++++-------------- Source/CPack/WiX/cmCPackWIXGenerator.h | 103 ++-- .../WiX/cmWIXDirectoriesSourceWriter.cxx | 87 +++ .../CPack/WiX/cmWIXDirectoriesSourceWriter.h | 42 ++ .../CPack/WiX/cmWIXFeaturesSourceWriter.cxx | 102 +++ Source/CPack/WiX/cmWIXFeaturesSourceWriter.h | 39 ++ Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 149 +++++ Source/CPack/WiX/cmWIXFilesSourceWriter.h | 62 ++ Source/CPack/WiX/cmWIXPatch.cxx | 91 +++ Source/CPack/WiX/cmWIXPatch.h | 45 ++ Source/CPack/WiX/cmWIXPatchParser.cxx | 2 +- Source/CPack/WiX/cmWIXPatchParser.h | 2 +- .../CPack/WiX/cmWIXRichTextFormatWriter.cxx | 8 +- Source/CPack/WiX/cmWIXRichTextFormatWriter.h | 8 +- Source/CPack/WiX/cmWIXShortcut.h | 29 + Source/CPack/WiX/cmWIXSourceWriter.cxx | 14 +- Source/CPack/WiX/cmWIXSourceWriter.h | 16 +- 18 files changed, 848 insertions(+), 536 deletions(-) create mode 100644 Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx create mode 100644 Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h create mode 100644 Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx create mode 100644 Source/CPack/WiX/cmWIXFeaturesSourceWriter.h create mode 100644 Source/CPack/WiX/cmWIXFilesSourceWriter.cxx create mode 100644 Source/CPack/WiX/cmWIXFilesSourceWriter.h create mode 100644 Source/CPack/WiX/cmWIXPatch.cxx create mode 100644 Source/CPack/WiX/cmWIXPatch.h create mode 100644 Source/CPack/WiX/cmWIXShortcut.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 175a034ba..966e0f68c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -562,7 +562,11 @@ if(WIN32) set(CPACK_SRCS ${CPACK_SRCS} CPack/WiX/cmCPackWIXGenerator.cxx CPack/WiX/cmWIXSourceWriter.cxx + CPack/WiX/cmWIXDirectoriesSourceWriter.cxx + CPack/WiX/cmWIXFeaturesSourceWriter.cxx + CPack/WiX/cmWIXFilesSourceWriter.cxx CPack/WiX/cmWIXRichTextFormatWriter.cxx + CPack/WiX/cmWIXPatch.cxx CPack/WiX/cmWIXPatchParser.cxx ) endif() diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 43119d6a5..8e671ccaf 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -1,6 +1,6 @@ /*============================================================================ CMake - Cross Platform Makefile Generator - Copyright 2000-2013 Kitware, Inc., Insight Software Consortium + Copyright 2000-2014 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. @@ -19,6 +19,9 @@ #include #include "cmWIXSourceWriter.h" +#include "cmWIXDirectoriesSourceWriter.h" +#include "cmWIXFeaturesSourceWriter.h" +#include "cmWIXFilesSourceWriter.h" #include "cmWIXRichTextFormatWriter.h" #include @@ -28,11 +31,9 @@ #include // for GUID generation -#include -#include - cmCPackWIXGenerator::cmCPackWIXGenerator(): - HasDesktopShortcuts(false) + HasDesktopShortcuts(false), + Patch(Logger) { } @@ -44,15 +45,9 @@ int cmCPackWIXGenerator::InitializeInternal() return this->Superclass::InitializeInternal(); } -bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command) +bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command) { - std::string cpackTopLevel; - if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) - { - return false; - } - - std::string logFileName = cpackTopLevel + "/wix.log"; + std::string logFileName = this->CPackTopLevel + "/wix.log"; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Running WiX command: " << command << std::endl); @@ -81,7 +76,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command) } bool cmCPackWIXGenerator::RunCandleCommand( - const std::string& sourceFile, const std::string& objectFile) + std::string const& sourceFile, std::string const& objectFile) { std::string executable; if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable)) @@ -108,7 +103,7 @@ bool cmCPackWIXGenerator::RunCandleCommand( return RunWiXCommand(command.str()); } -bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles) +bool cmCPackWIXGenerator::RunLightCommand(std::string const& objectFiles) { std::string executable; if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable)) @@ -121,8 +116,8 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles) command << " -nologo"; command << " -out " << QuotePath(packageFileNames.at(0)); - for(extension_set_t::const_iterator i = LightExtensions.begin(); - i != LightExtensions.end(); ++i) + for(extension_set_t::const_iterator i = this->LightExtensions.begin(); + i != this->LightExtensions.end(); ++i) { command << " -ext " << QuotePath(*i); } @@ -182,15 +177,14 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() "you might want to set this explicitly." << std::endl); } - std::string cpackTopLevel; - if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", this->CPackTopLevel)) { return false; } if(GetOption("CPACK_WIX_LICENSE_RTF") == 0) { - std::string licenseFilename = cpackTopLevel + "/License.rtf"; + std::string licenseFilename = this->CPackTopLevel + "/License.rtf"; SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str()); if(!CreateLicenseFile()) @@ -213,7 +207,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() { std::string defaultRef = "WixUI_InstallDir"; - if(Components.size()) + if(this->Components.size()) { defaultRef = "WixUI_FeatureTree"; } @@ -221,17 +215,17 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() SetOption("CPACK_WIX_UI_REF", defaultRef.c_str()); } - CollectExtensions("CPACK_WIX_EXTENSIONS", CandleExtensions); - CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", CandleExtensions); + CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions); + CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions); - LightExtensions.insert("WixUIExtension"); - CollectExtensions("CPACK_WIX_EXTENSIONS", LightExtensions); - CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", LightExtensions); + this->LightExtensions.insert("WixUIExtension"); + CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions); + CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions); const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE"); if(patchFilePath) { - LoadPatchFragments(patchFilePath); + this->Patch.LoadFragments(patchFilePath); } return true; @@ -244,10 +238,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() return false; } - if(!CreateWiXVariablesIncludeFile()) - { - return false; - } + CreateWiXVariablesIncludeFile(); if(!CreateWiXSourceFiles()) { @@ -257,9 +248,9 @@ bool cmCPackWIXGenerator::PackageFilesImpl() AppendUserSuppliedExtraSources(); std::stringstream objectFiles; - for(size_t i = 0; i < WixSources.size(); ++i) + for(size_t i = 0; i < this->WixSources.size(); ++i) { - const std::string& sourceFilename = WixSources[i]; + std::string const& sourceFilename = this->WixSources[i]; std::string objectFilename = cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj"; @@ -282,7 +273,7 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraSources() const char *cpackWixExtraSources = GetOption("CPACK_WIX_EXTRA_SOURCES"); if(!cpackWixExtraSources) return; - cmSystemTools::ExpandListArgument(cpackWixExtraSources, WixSources); + cmSystemTools::ExpandListArgument(cpackWixExtraSources, this->WixSources); } void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream) @@ -297,22 +288,18 @@ void cmCPackWIXGenerator::AppendUserSuppliedExtraObjects(std::ostream& stream) for(size_t i = 0; i < expandedExtraObjects.size(); ++i) { - stream << " " << QuotePath(expandedExtraObjects[i]); + stream << " " << QuotePath(expandedExtraObjects[i]); } } -bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() +void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { - std::string cpackTopLevel; - if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) - { - return false; - } - std::string includeFilename = - cpackTopLevel + "/cpack_variables.wxi"; + this->CPackTopLevel + "/cpack_variables.wxi"; + + cmWIXSourceWriter includeFile( + this->Logger, includeFilename, true); - cmWIXSourceWriter includeFile(Logger, includeFilename, true); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR"); @@ -326,12 +313,10 @@ bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() GetOption("CPACK_PACKAGE_NAME")); CopyDefinition(includeFile, "CPACK_WIX_PROGRAM_MENU_FOLDER"); CopyDefinition(includeFile, "CPACK_WIX_UI_REF"); - - return true; } void cmCPackWIXGenerator::CopyDefinition( - cmWIXSourceWriter &source, const std::string &name) + cmWIXSourceWriter &source, std::string const& name) { const char* value = GetOption(name.c_str()); if(value) @@ -341,7 +326,7 @@ void cmCPackWIXGenerator::CopyDefinition( } void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, - const std::string& name, const std::string& value) + std::string const& name, std::string const& value) { std::stringstream tmp; tmp << name << "=\"" << value << '"'; @@ -352,81 +337,47 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, bool cmCPackWIXGenerator::CreateWiXSourceFiles() { - std::string cpackTopLevel; - if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel)) + std::string directoryDefinitionsFilename = + this->CPackTopLevel + "/directories.wxs"; + + this->WixSources.push_back(directoryDefinitionsFilename); + + cmWIXDirectoriesSourceWriter directoryDefinitions( + this->Logger, directoryDefinitionsFilename); + directoryDefinitions.BeginElement("Fragment"); + + std::string installRoot; + if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", installRoot)) { return false; } - std::string directoryDefinitionsFilename = - cpackTopLevel + "/directories.wxs"; - - WixSources.push_back(directoryDefinitionsFilename); - - cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename); - directoryDefinitions.BeginElement("Fragment"); - directoryDefinitions.BeginElement("Directory"); directoryDefinitions.AddAttribute("Id", "TARGETDIR"); directoryDefinitions.AddAttribute("Name", "SourceDir"); - directoryDefinitions.BeginElement("Directory"); - if(GetArchitecture() == "x86") - { - directoryDefinitions.AddAttribute("Id", "ProgramFilesFolder"); - } - else - { - directoryDefinitions.AddAttribute("Id", "ProgramFiles64Folder"); - } - - std::vector install_root; - - std::string tmp; - if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", tmp)) - { - return false; - } - - cmSystemTools::SplitPath(tmp.c_str(), install_root); - - if(!install_root.empty() && install_root.back().empty()) - { - install_root.pop_back(); - } - - for(size_t i = 1; i < install_root.size(); ++i) - { - directoryDefinitions.BeginElement("Directory"); - - if(i == install_root.size() - 1) - { - directoryDefinitions.AddAttribute("Id", "INSTALL_ROOT"); - } - else - { - std::stringstream ss; - ss << "INSTALL_PREFIX_" << i; - directoryDefinitions.AddAttribute("Id", ss.str()); - } - - directoryDefinitions.AddAttribute("Name", install_root[i]); - } + size_t installRootSize = + directoryDefinitions.BeginInstallationPrefixDirectory( + GetProgramFilesFolderId(), installRoot); std::string fileDefinitionsFilename = - cpackTopLevel + "/files.wxs"; + this->CPackTopLevel + "/files.wxs"; - WixSources.push_back(fileDefinitionsFilename); + this->WixSources.push_back(fileDefinitionsFilename); + + cmWIXFilesSourceWriter fileDefinitions( + this->Logger, fileDefinitionsFilename); - cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename); fileDefinitions.BeginElement("Fragment"); std::string featureDefinitionsFilename = - cpackTopLevel +"/features.wxs"; + this->CPackTopLevel +"/features.wxs"; - WixSources.push_back(featureDefinitionsFilename); + this->WixSources.push_back(featureDefinitionsFilename); + + cmWIXFeaturesSourceWriter featureDefinitions( + this->Logger, featureDefinitionsFilename); - cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename); featureDefinitions.BeginElement("Fragment"); featureDefinitions.BeginElement("Feature"); @@ -439,13 +390,15 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() { return false; } - featureDefinitions.AddAttribute("Title", cpackPackageName); + featureDefinitions.AddAttribute("Title", cpackPackageName); featureDefinitions.AddAttribute("Level", "1"); - if(!CreateCMakePackageRegistryEntry(featureDefinitions)) + const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); + if(package) { - return false; + featureDefinitions.CreateCMakePackageRegistryEntry( + package, GetOption("CPACK_WIX_UPGRADE_GUID")); } if(!CreateFeatureHierarchy(featureDefinitions)) @@ -471,7 +424,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() else { for(std::map::const_iterator - i = Components.begin(); i != Components.end(); ++i) + i = this->Components.begin(); i != this->Components.end(); ++i) { cmCPackComponent const& component = i->second; @@ -513,31 +466,51 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() featureDefinitions.EndElement("Fragment"); fileDefinitions.EndElement("Fragment"); - for(size_t i = 1; i < install_root.size(); ++i) - { - directoryDefinitions.EndElement("Directory"); - } - - directoryDefinitions.EndElement("Directory"); + directoryDefinitions.EndInstallationPrefixDirectory( + installRootSize); if(hasShortcuts) { - CreateStartMenuFolder(directoryDefinitions); + directoryDefinitions.EmitStartMenuFolder( + GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER")); } if(this->HasDesktopShortcuts) { - CreateDesktopFolder(directoryDefinitions); + directoryDefinitions.EmitDesktopFolder(); } directoryDefinitions.EndElement("Directory"); directoryDefinitions.EndElement("Fragment"); + if(!GenerateMainSourceFileFromTemplate()) + { + return false; + } + + return this->Patch.CheckForUnappliedFragments(); +} + +std::string cmCPackWIXGenerator::GetProgramFilesFolderId() const +{ + if(GetArchitecture() == "x86") + { + return "ProgramFilesFolder"; + } + else + { + return "ProgramFiles64Folder"; + } +} + +bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate() +{ std::string wixTemplate = FindTemplate("WIX.template.in"); if(GetOption("CPACK_WIX_TEMPLATE") != 0) { wixTemplate = GetOption("CPACK_WIX_TEMPLATE"); } + if(wixTemplate.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -545,7 +518,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() return false; } - std::string mainSourceFilePath = cpackTopLevel + "/main.wxs"; + std::string mainSourceFilePath = this->CPackTopLevel + "/main.wxs"; if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str())) { @@ -556,68 +529,13 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() return false; } - WixSources.push_back(mainSourceFilePath); - - std::string fragmentList; - for(cmWIXPatchParser::fragment_map_t::const_iterator - i = Fragments.begin(); i != Fragments.end(); ++i) - { - if(!fragmentList.empty()) - { - fragmentList += ", "; - } - - fragmentList += "'"; - fragmentList += i->first; - fragmentList += "'"; - } - - if(fragmentList.size()) - { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Some XML patch fragments did not have matching IDs: " << - fragmentList << std::endl); - return false; - } - - return true; -} - -bool cmCPackWIXGenerator::CreateCMakePackageRegistryEntry( - cmWIXSourceWriter& featureDefinitions) -{ - const char* package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); - if(!package) - { - return true; - } - - featureDefinitions.BeginElement("Component"); - featureDefinitions.AddAttribute("Id", "CM_PACKAGE_REGISTRY"); - featureDefinitions.AddAttribute("Directory", "TARGETDIR"); - featureDefinitions.AddAttribute("Guid", "*"); - - std::string registryKey = - std::string("Software\\Kitware\\CMake\\Packages\\") + package; - - std::string upgradeGuid = GetOption("CPACK_WIX_UPGRADE_GUID"); - - featureDefinitions.BeginElement("RegistryValue"); - featureDefinitions.AddAttribute("Root", "HKLM"); - featureDefinitions.AddAttribute("Key", registryKey); - featureDefinitions.AddAttribute("Name", upgradeGuid); - featureDefinitions.AddAttribute("Type", "string"); - featureDefinitions.AddAttribute("Value", "[INSTALL_ROOT]"); - featureDefinitions.AddAttribute("KeyPath", "yes"); - featureDefinitions.EndElement("RegistryValue"); - - featureDefinitions.EndElement("Component"); + this->WixSources.push_back(mainSourceFilePath); return true; } bool cmCPackWIXGenerator::CreateFeatureHierarchy( - cmWIXSourceWriter& featureDefinitions) + cmWIXFeaturesSourceWriter& featureDefinitions) { for(std::map::const_iterator i = ComponentGroups.begin(); i != ComponentGroups.end(); ++i) @@ -625,105 +543,30 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( cmCPackComponentGroup const& group = i->second; if(group.ParentGroup == 0) { - if(!EmitFeatureForComponentGroup(featureDefinitions, group)) - { - return false; - } + featureDefinitions.EmitFeatureForComponentGroup(group); } } for(std::map::const_iterator - i = Components.begin(); i != Components.end(); ++i) + i = this->Components.begin(); i != this->Components.end(); ++i) { cmCPackComponent const& component = i->second; if(!component.Group) { - if(!EmitFeatureForComponent(featureDefinitions, component)) - { - return false; - } + featureDefinitions.EmitFeatureForComponent(component); } } return true; } -bool cmCPackWIXGenerator::EmitFeatureForComponentGroup( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponentGroup const& group) -{ - featureDefinitions.BeginElement("Feature"); - featureDefinitions.AddAttribute("Id", "CM_G_" + group.Name); - - if(group.IsExpandedByDefault) - { - featureDefinitions.AddAttribute("Display", "expand"); - } - - featureDefinitions.AddAttributeUnlessEmpty( - "Title", group.DisplayName); - - featureDefinitions.AddAttributeUnlessEmpty( - "Description", group.Description); - - for(std::vector::const_iterator - i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) - { - if(!EmitFeatureForComponentGroup(featureDefinitions, **i)) - { - return false; - } - } - - for(std::vector::const_iterator - i = group.Components.begin(); i != group.Components.end(); ++i) - { - if(!EmitFeatureForComponent(featureDefinitions, **i)) - { - return false; - } - } - - featureDefinitions.EndElement("Feature"); - - return true; -} - -bool cmCPackWIXGenerator::EmitFeatureForComponent( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponent const& component) -{ - featureDefinitions.BeginElement("Feature"); - featureDefinitions.AddAttribute("Id", "CM_C_" + component.Name); - - featureDefinitions.AddAttributeUnlessEmpty( - "Title", component.DisplayName); - - featureDefinitions.AddAttributeUnlessEmpty( - "Description", component.Description); - - if(component.IsRequired) - { - featureDefinitions.AddAttribute("Absent", "disallow"); - } - - if(component.IsHidden) - { - featureDefinitions.AddAttribute("Display", "hidden"); - } - - featureDefinitions.EndElement("Feature"); - - return true; -} - bool cmCPackWIXGenerator::AddComponentsToFeature( std::string const& rootPath, std::string const& featureId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, shortcut_map_t& shortcutMap) { featureDefinitions.BeginElement("FeatureRef"); @@ -768,8 +611,8 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( std::string const& cpackComponentName, std::string const& featureId, shortcut_map_t& shortcutMap, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions) + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions) { bool thisHasDesktopShortcuts = false; @@ -799,6 +642,7 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( fileDefinitions.BeginElement("DirectoryRef"); fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER"); + fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Guid", "*"); @@ -809,63 +653,34 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( std::string const& id = i->first; cmWIXShortcut const& shortcut = i->second; - std::string shortcutId = std::string("CM_S") + id; - std::string fileId = std::string("CM_F") + id; + fileDefinitions.EmitShortcut(id, shortcut, false); - fileDefinitions.BeginElement("Shortcut"); - fileDefinitions.AddAttribute("Id", shortcutId); - fileDefinitions.AddAttribute("Name", shortcut.textLabel); - std::string target = "[#" + fileId + "]"; - fileDefinitions.AddAttribute("Target", target); - fileDefinitions.AddAttribute("WorkingDirectory", - shortcut.workingDirectoryId); - fileDefinitions.EndElement("Shortcut"); - - if (shortcut.desktop) + if(shortcut.desktop) { - thisHasDesktopShortcuts = true; + thisHasDesktopShortcuts = true; } } if(cpackComponentName.empty()) { - CreateUninstallShortcut(cpackPackageName, fileDefinitions); + fileDefinitions.EmitUninstallShortcut(cpackPackageName); } - fileDefinitions.BeginElement("RemoveFolder"); - fileDefinitions.AddAttribute("Id", + fileDefinitions.EmitRemoveFolder( "CM_REMOVE_PROGRAM_MENU_FOLDER" + idSuffix); - fileDefinitions.AddAttribute("On", "uninstall"); - fileDefinitions.EndElement("RemoveFolder"); std::string registryKey = std::string("Software\\") + cpackVendor + "\\" + cpackPackageName; - fileDefinitions.BeginElement("RegistryValue"); - fileDefinitions.AddAttribute("Root", "HKCU"); - fileDefinitions.AddAttribute("Key", registryKey); - - std::string valueName; - if(!cpackComponentName.empty()) - { - valueName = cpackComponentName + "_"; - } - valueName += "installed"; - - fileDefinitions.AddAttribute("Name", valueName); - fileDefinitions.AddAttribute("Type", "integer"); - fileDefinitions.AddAttribute("Value", "1"); - fileDefinitions.AddAttribute("KeyPath", "yes"); - fileDefinitions.EndElement("RegistryValue"); + fileDefinitions.EmitStartMenuShortcutRegistryValue( + registryKey, cpackComponentName); fileDefinitions.EndElement("Component"); fileDefinitions.EndElement("DirectoryRef"); - featureDefinitions.BeginElement("ComponentRef"); - featureDefinitions.AddAttribute("Id", componentId); - featureDefinitions.EndElement("ComponentRef"); + featureDefinitions.EmitComponentRef(componentId); - if (thisHasDesktopShortcuts) + if(thisHasDesktopShortcuts) { this->HasDesktopShortcuts = true; componentId = "CM_DESKTOP_SHORTCUT" + idSuffix; @@ -876,7 +691,7 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( fileDefinitions.AddAttribute("Id", componentId); fileDefinitions.AddAttribute("Guid", "*"); - for (shortcut_map_t::const_iterator + for(shortcut_map_t::const_iterator i = shortcutMap.begin(); i != shortcutMap.end(); ++i) { std::string const& id = i->first; @@ -885,34 +700,16 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( if (!shortcut.desktop) continue; - std::string shortcutId = std::string("CM_DS") + id; - std::string fileId = std::string("CM_F") + id; - - fileDefinitions.BeginElement("Shortcut"); - fileDefinitions.AddAttribute("Id", shortcutId); - fileDefinitions.AddAttribute("Name", shortcut.textLabel); - std::string target = "[#" + fileId + "]"; - fileDefinitions.AddAttribute("Target", target); - fileDefinitions.AddAttribute("WorkingDirectory", - shortcut.workingDirectoryId); - fileDefinitions.EndElement("Shortcut"); + fileDefinitions.EmitShortcut(id, shortcut, true); } - fileDefinitions.BeginElement("RegistryValue"); - fileDefinitions.AddAttribute("Root", "HKCU"); - fileDefinitions.AddAttribute("Key", registryKey); - fileDefinitions.AddAttribute("Name", valueName + "_desktop"); - fileDefinitions.AddAttribute("Type", "integer"); - fileDefinitions.AddAttribute("Value", "1"); - fileDefinitions.AddAttribute("KeyPath", "yes"); - fileDefinitions.EndElement("RegistryValue"); + fileDefinitions.EmitDesktopShortcutRegistryValue( + registryKey, cpackComponentName); fileDefinitions.EndElement("Component"); fileDefinitions.EndElement("DirectoryRef"); - featureDefinitions.BeginElement("ComponentRef"); - featureDefinitions.AddAttribute("Id", componentId); - featureDefinitions.EndElement("ComponentRef"); + featureDefinitions.EmitComponentRef(componentId); } featureDefinitions.EndElement("FeatureRef"); @@ -920,19 +717,6 @@ bool cmCPackWIXGenerator::CreateStartMenuShortcuts( return true; } -void cmCPackWIXGenerator::CreateUninstallShortcut( - std::string const& packageName, - cmWIXSourceWriter& fileDefinitions) -{ - fileDefinitions.BeginElement("Shortcut"); - fileDefinitions.AddAttribute("Id", "UNINSTALL"); - fileDefinitions.AddAttribute("Name", "Uninstall " + packageName); - fileDefinitions.AddAttribute("Description", "Uninstalls " + packageName); - fileDefinitions.AddAttribute("Target", "[SystemFolder]msiexec.exe"); - fileDefinitions.AddAttribute("Arguments", "/x [ProductCode]"); - fileDefinitions.EndElement("Shortcut"); -} - bool cmCPackWIXGenerator::CreateLicenseFile() { std::string licenseSourceFilename; @@ -981,11 +765,11 @@ bool cmCPackWIXGenerator::CreateLicenseFile() } void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( - const std::string& topdir, - const std::string& directoryId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + std::string const& topdir, + std::string const& directoryId, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, const std::vector& packageExecutables, const std::vector& desktopExecutables, shortcut_map_t& shortcutMap) @@ -1026,44 +810,15 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( desktopExecutables, shortcutMap); - ApplyPatchFragment(subDirectoryId, directoryDefinitions); + this->Patch.ApplyFragment(subDirectoryId, directoryDefinitions); directoryDefinitions.EndElement("Directory"); } else { - std::string componentId = std::string("CM_C") + id; - std::string fileId = std::string("CM_F") + id; + std::string componentId = fileDefinitions.EmitComponentFile( + directoryId, id, fullPath, this->Patch); - fileDefinitions.BeginElement("DirectoryRef"); - fileDefinitions.AddAttribute("Id", directoryId); - - fileDefinitions.BeginElement("Component"); - fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); - - fileDefinitions.BeginElement("File"); - fileDefinitions.AddAttribute("Id", fileId); - fileDefinitions.AddAttribute("Source", fullPath); - fileDefinitions.AddAttribute("KeyPath", "yes"); - - mode_t fileMode = 0; - cmSystemTools::GetPermissions(fullPath.c_str(), fileMode); - - if(!(fileMode & S_IWRITE)) - { - fileDefinitions.AddAttribute("ReadOnly", "yes"); - } - - ApplyPatchFragment(fileId, fileDefinitions); - fileDefinitions.EndElement("File"); - - ApplyPatchFragment(componentId, fileDefinitions); - fileDefinitions.EndElement("Component"); - fileDefinitions.EndElement("DirectoryRef"); - - featureDefinitions.BeginElement("ComponentRef"); - featureDefinitions.AddAttribute("Id", componentId); - featureDefinitions.EndElement("ComponentRef"); + featureDefinitions.EmitComponentRef(componentId); for(size_t j = 0; j < packageExecutables.size(); ++j) { @@ -1092,7 +847,7 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( } bool cmCPackWIXGenerator::RequireOption( - const std::string& name, std::string &value) const + std::string const& name, std::string &value) const { const char* tmp = GetOption(name.c_str()); if(tmp) @@ -1140,13 +895,13 @@ std::string cmCPackWIXGenerator::GenerateGUID() return cmSystemTools::UpperCase(result); } -std::string cmCPackWIXGenerator::QuotePath(const std::string& path) +std::string cmCPackWIXGenerator::QuotePath(std::string const& path) { return std::string("\"") + path + '"'; } std::string cmCPackWIXGenerator::GetRightmostExtension( - const std::string& filename) + std::string const& filename) { std::string extension; @@ -1159,7 +914,7 @@ std::string cmCPackWIXGenerator::GetRightmostExtension( return cmSystemTools::LowerCase(extension); } -std::string cmCPackWIXGenerator::PathToId(const std::string& path) +std::string cmCPackWIXGenerator::PathToId(std::string const& path) { id_map_t::const_iterator i = PathToIdMap.find(path); if(i != PathToIdMap.end()) return i->second; @@ -1168,7 +923,7 @@ std::string cmCPackWIXGenerator::PathToId(const std::string& path) return id; } -std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path) +std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path) { std::vector components; cmSystemTools::SplitPath(path.c_str(), components, false); @@ -1222,7 +977,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(const std::string& path) } std::string cmCPackWIXGenerator::CreateHashedId( - const std::string& path, const std::string& normalizedFilename) + std::string const& path, std::string const& normalizedFilename) { cmsys::auto_ptr sha1 = cmCryptoHash::New("SHA1"); std::string hash = sha1->HashString(path.c_str()); @@ -1245,7 +1000,7 @@ std::string cmCPackWIXGenerator::CreateHashedId( } std::string cmCPackWIXGenerator::NormalizeComponentForId( - const std::string& component, size_t& replacementCount) + std::string const& component, size_t& replacementCount) { std::string result; result.resize(component.size()); @@ -1276,7 +1031,7 @@ bool cmCPackWIXGenerator::IsLegalIdCharacter(char c) } void cmCPackWIXGenerator::CollectExtensions( - const std::string& variableName, extension_set_t& extensions) + std::string const& variableName, extension_set_t& extensions) { const char *variableContent = GetOption(variableName.c_str()); if(!variableContent) return; @@ -1292,7 +1047,7 @@ void cmCPackWIXGenerator::CollectExtensions( } void cmCPackWIXGenerator::AddCustomFlags( - const std::string& variableName, std::ostream& stream) + std::string const& variableName, std::ostream& stream) { const char *variableContent = GetOption(variableName.c_str()); if(!variableContent) return; @@ -1306,69 +1061,3 @@ void cmCPackWIXGenerator::AddCustomFlags( stream << " " << QuotePath(*i); } } - -void cmCPackWIXGenerator::CreateStartMenuFolder( - cmWIXSourceWriter& directoryDefinitions) -{ - directoryDefinitions.BeginElement("Directory"); - directoryDefinitions.AddAttribute("Id", "ProgramMenuFolder"); - - directoryDefinitions.BeginElement("Directory"); - directoryDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER"); - const char *startMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER"); - directoryDefinitions.AddAttribute("Name", startMenuFolder); - directoryDefinitions.EndElement("Directory"); - - directoryDefinitions.EndElement("Directory"); -} - -void cmCPackWIXGenerator::CreateDesktopFolder( - cmWIXSourceWriter& directoryDefinitions) -{ - directoryDefinitions.BeginElement("Directory"); - directoryDefinitions.AddAttribute("Id", "DesktopFolder"); - directoryDefinitions.AddAttribute("Name", "Desktop"); - directoryDefinitions.EndElement("Directory"); -} - -void cmCPackWIXGenerator::LoadPatchFragments(const std::string& patchFilePath) -{ - cmWIXPatchParser parser(Fragments, Logger); - parser.ParseFile(patchFilePath.c_str()); -} - -void cmCPackWIXGenerator::ApplyPatchFragment( - const std::string& id, cmWIXSourceWriter& writer) -{ - cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id); - if(i == Fragments.end()) return; - - const cmWIXPatchElement& fragment = i->second; - for(cmWIXPatchElement::child_list_t::const_iterator - j = fragment.children.begin(); j != fragment.children.end(); ++j) - { - ApplyPatchElement(**j, writer); - } - - Fragments.erase(i); -} - -void cmCPackWIXGenerator::ApplyPatchElement( - const cmWIXPatchElement& element, cmWIXSourceWriter& writer) -{ - writer.BeginElement(element.name); - - for(cmWIXPatchElement::attributes_t::const_iterator - i = element.attributes.begin(); i != element.attributes.end(); ++i) - { - writer.AddAttribute(i->first, i->second); - } - - for(cmWIXPatchElement::child_list_t::const_iterator - i = element.children.begin(); i != element.children.end(); ++i) - { - ApplyPatchElement(**i, writer); - } - - writer.EndElement(element.name); -} diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 1de4810ba..ee66c05d0 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -13,25 +13,18 @@ #ifndef cmCPackWIXGenerator_h #define cmCPackWIXGenerator_h -#include "cmWIXPatchParser.h" +#include "cmWIXPatch.h" +#include "cmWIXShortcut.h" #include #include #include -struct cmWIXShortcut -{ - cmWIXShortcut() - :desktop(false) - {} - - std::string textLabel; - std::string workingDirectoryId; - bool desktop; -}; - class cmWIXSourceWriter; +class cmWIXDirectoriesSourceWriter; +class cmWIXFilesSourceWriter; +class cmWIXFeaturesSourceWriter; /** \class cmCPackWIXGenerator * \brief A generator for WIX files @@ -78,48 +71,37 @@ private: bool PackageFilesImpl(); - bool CreateWiXVariablesIncludeFile(); + void CreateWiXVariablesIncludeFile(); void CopyDefinition( - cmWIXSourceWriter &source, const std::string &name); + cmWIXSourceWriter &source, std::string const& name); void AddDefinition(cmWIXSourceWriter& source, - const std::string& name, const std::string& value); + std::string const& name, std::string const& value); bool CreateWiXSourceFiles(); - bool CreateCMakePackageRegistryEntry( - cmWIXSourceWriter& featureDefinitions); + std::string GetProgramFilesFolderId() const; + + bool GenerateMainSourceFileFromTemplate(); bool CreateFeatureHierarchy( - cmWIXSourceWriter& featureDefinitions); - - bool EmitFeatureForComponentGroup( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponentGroup const& group); - - bool EmitFeatureForComponent( - cmWIXSourceWriter& featureDefinitions, - cmCPackComponent const& component); + cmWIXFeaturesSourceWriter& featureDefinitions); bool AddComponentsToFeature( std::string const& rootPath, std::string const& featureId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, shortcut_map_t& shortcutMap); bool CreateStartMenuShortcuts( std::string const& cpackComponentName, std::string const& featureId, shortcut_map_t& shortcutMap, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions); - - void CreateUninstallShortcut( - std::string const& packageName, - cmWIXSourceWriter& fileDefinitions); + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions); void AppendUserSuppliedExtraSources(); @@ -127,60 +109,49 @@ private: bool CreateLicenseFile(); - bool RunWiXCommand(const std::string& command); + bool RunWiXCommand(std::string const& command); bool RunCandleCommand( - const std::string& sourceFile, const std::string& objectFile); + std::string const& sourceFile, std::string const& objectFile); - bool RunLightCommand(const std::string& objectFiles); + bool RunLightCommand(std::string const& objectFiles); - void AddDirectoryAndFileDefinitons(const std::string& topdir, - const std::string& directoryId, - cmWIXSourceWriter& directoryDefinitions, - cmWIXSourceWriter& fileDefinitions, - cmWIXSourceWriter& featureDefinitions, + void AddDirectoryAndFileDefinitons(std::string const& topdir, + std::string const& directoryId, + cmWIXDirectoriesSourceWriter& directoryDefinitions, + cmWIXFilesSourceWriter& fileDefinitions, + cmWIXFeaturesSourceWriter& featureDefinitions, const std::vector& pkgExecutables, const std::vector& desktopExecutables, shortcut_map_t& shortcutMap); - bool RequireOption(const std::string& name, std::string& value) const; + bool RequireOption(std::string const& name, std::string& value) const; std::string GetArchitecture() const; static std::string GenerateGUID(); - static std::string QuotePath(const std::string& path); + static std::string QuotePath(std::string const& path); - static std::string GetRightmostExtension(const std::string& filename); + static std::string GetRightmostExtension(std::string const& filename); - std::string PathToId(const std::string& path); + std::string PathToId(std::string const& path); - std::string CreateNewIdForPath(const std::string& path); + std::string CreateNewIdForPath(std::string const& path); static std::string CreateHashedId( - const std::string& path, const std::string& normalizedFilename); + std::string const& path, std::string const& normalizedFilename); std::string NormalizeComponentForId( - const std::string& component, size_t& replacementCount); + std::string const& component, size_t& replacementCount); static bool IsLegalIdCharacter(char c); void CollectExtensions( - const std::string& variableName, extension_set_t& extensions); + std::string const& variableName, extension_set_t& extensions); void AddCustomFlags( - const std::string& variableName, std::ostream& stream); - - void CreateStartMenuFolder(cmWIXSourceWriter& directoryDefinitions); - - void CreateDesktopFolder(cmWIXSourceWriter& directoryDefinitions); - - void LoadPatchFragments(const std::string& patchFilePath); - - void ApplyPatchFragment(const std::string& id, cmWIXSourceWriter& writer); - - void ApplyPatchElement(const cmWIXPatchElement& element, - cmWIXSourceWriter& writer); + std::string const& variableName, std::ostream& stream); std::vector WixSources; id_map_t PathToIdMap; @@ -189,9 +160,11 @@ private: extension_set_t CandleExtensions; extension_set_t LightExtensions; - cmWIXPatchParser::fragment_map_t Fragments; - bool HasDesktopShortcuts; + + std::string CPackTopLevel; + + cmWIXPatch Patch; }; #endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx new file mode 100644 index 000000000..a93f89bae --- /dev/null +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -0,0 +1,87 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#include "cmWIXDirectoriesSourceWriter.h" + +cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter(cmCPackLog* logger, + std::string const& filename): + cmWIXSourceWriter(logger, filename) +{ + +} + +void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder( + std::string const& startMenuFolder) +{ + BeginElement("Directory"); + AddAttribute("Id", "ProgramMenuFolder"); + + BeginElement("Directory"); + AddAttribute("Id", "PROGRAM_MENU_FOLDER"); + AddAttribute("Name", startMenuFolder); + EndElement("Directory"); + + EndElement("Directory"); +} + +void cmWIXDirectoriesSourceWriter::EmitDesktopFolder() +{ + BeginElement("Directory"); + AddAttribute("Id", "DesktopFolder"); + AddAttribute("Name", "Desktop"); + EndElement("Directory"); +} + +size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory( + std::string const& programFilesFolderId, + std::string const& installRootString) +{ + BeginElement("Directory"); + AddAttribute("Id", programFilesFolderId); + + std::vector installRoot; + + cmSystemTools::SplitPath(installRootString.c_str(), installRoot); + + if(!installRoot.empty() && installRoot.back().empty()) + { + installRoot.pop_back(); + } + + for(size_t i = 1; i < installRoot.size(); ++i) + { + BeginElement("Directory"); + + if(i == installRoot.size() - 1) + { + AddAttribute("Id", "INSTALL_ROOT"); + } + else + { + std::stringstream tmp; + tmp << "INSTALL_PREFIX_" << i; + AddAttribute("Id", tmp.str()); + } + + AddAttribute("Name", installRoot[i]); + } + + return installRoot.size(); +} + +void cmWIXDirectoriesSourceWriter::EndInstallationPrefixDirectory(size_t size) +{ + for(size_t i = 0; i < size; ++i) + { + EndElement("Directory"); + } +} diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h new file mode 100644 index 000000000..f51fdb4bb --- /dev/null +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -0,0 +1,42 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#ifndef cmWIXDirectoriesSourceWriter_h +#define cmWIXDirectoriesSourceWriter_h + +#include "cmWIXSourceWriter.h" + +#include + +#include + +/** \class cmWIXDirectoriesSourceWriter + * \brief Helper class to generate directories.wxs + */ +class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter +{ +public: + cmWIXDirectoriesSourceWriter(cmCPackLog* logger, + std::string const& filename); + + void EmitStartMenuFolder(std::string const& startMenuFolder); + + void EmitDesktopFolder(); + + size_t BeginInstallationPrefixDirectory( + std::string const& programFilesFolderId, + std::string const& installRootString); + + void EndInstallationPrefixDirectory(size_t size); +}; + +#endif diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx new file mode 100644 index 000000000..0bcfc389f --- /dev/null +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -0,0 +1,102 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#include "cmWIXFeaturesSourceWriter.h" + +cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter(cmCPackLog* logger, + std::string const& filename): + cmWIXSourceWriter(logger, filename) +{ + +} + +void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( + std::string const& package, + std::string const& upgradeGuid) +{ + BeginElement("Component"); + AddAttribute("Id", "CM_PACKAGE_REGISTRY"); + AddAttribute("Directory", "TARGETDIR"); + AddAttribute("Guid", "*"); + + std::string registryKey = + std::string("Software\\Kitware\\CMake\\Packages\\") + package; + + BeginElement("RegistryValue"); + AddAttribute("Root", "HKLM"); + AddAttribute("Key", registryKey); + AddAttribute("Name", upgradeGuid); + AddAttribute("Type", "string"); + AddAttribute("Value", "[INSTALL_ROOT]"); + AddAttribute("KeyPath", "yes"); + EndElement("RegistryValue"); + + EndElement("Component"); +} + +void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( + cmCPackComponentGroup const& group) +{ + BeginElement("Feature"); + AddAttribute("Id", "CM_G_" + group.Name); + + if(group.IsExpandedByDefault) + { + AddAttribute("Display", "expand"); + } + + AddAttributeUnlessEmpty("Title", group.DisplayName); + AddAttributeUnlessEmpty("Description", group.Description); + + for(std::vector::const_iterator + i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) + { + EmitFeatureForComponentGroup(**i); + } + + for(std::vector::const_iterator + i = group.Components.begin(); i != group.Components.end(); ++i) + { + EmitFeatureForComponent(**i); + } + + EndElement("Feature"); +} + +void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( + cmCPackComponent const& component) +{ + BeginElement("Feature"); + AddAttribute("Id", "CM_C_" + component.Name); + + AddAttributeUnlessEmpty("Title", component.DisplayName); + AddAttributeUnlessEmpty("Description", component.Description); + + if(component.IsRequired) + { + AddAttribute("Absent", "disallow"); + } + + if(component.IsHidden) + { + AddAttribute("Display", "hidden"); + } + + EndElement("Feature"); +} + +void cmWIXFeaturesSourceWriter::EmitComponentRef(std::string const& id) +{ + BeginElement("ComponentRef"); + AddAttribute("Id", id); + EndElement("ComponentRef"); +} diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h new file mode 100644 index 000000000..767041755 --- /dev/null +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -0,0 +1,39 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#ifndef cmWIXFeaturesSourceWriter_h +#define cmWIXFeaturesSourceWriter_h + +#include "cmWIXSourceWriter.h" +#include + +/** \class cmWIXFeaturesSourceWriter + * \brief Helper class to generate features.wxs + */ +class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter +{ +public: + cmWIXFeaturesSourceWriter(cmCPackLog* logger, + std::string const& filename); + + void CreateCMakePackageRegistryEntry( + std::string const& package, + std::string const& upgradeGuid); + + void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group); + + void EmitFeatureForComponent(const cmCPackComponent& component); + + void EmitComponentRef(std::string const& id); +}; + +#endif diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx new file mode 100644 index 000000000..0835f3ade --- /dev/null +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -0,0 +1,149 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#include "cmWIXFilesSourceWriter.h" + +#include +#include + +cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, + std::string const& filename): + cmWIXSourceWriter(logger, filename) +{ + +} + +void cmWIXFilesSourceWriter::EmitShortcut( + std::string const& id, + cmWIXShortcut const& shortcut, + bool desktop) +{ + std::string shortcutId; + + if(desktop) + { + shortcutId = "CM_DS"; + } + else + { + shortcutId = "CM_S"; + } + + shortcutId += id; + + std::string fileId = std::string("CM_F") + id; + + BeginElement("Shortcut"); + AddAttribute("Id", shortcutId); + AddAttribute("Name", shortcut.textLabel); + std::string target = "[#" + fileId + "]"; + AddAttribute("Target", target); + AddAttribute("WorkingDirectory", shortcut.workingDirectoryId); + EndElement("Shortcut"); +} + +void cmWIXFilesSourceWriter::EmitRemoveFolder(std::string const& id) +{ + BeginElement("RemoveFolder"); + AddAttribute("Id", id); + AddAttribute("On", "uninstall"); + EndElement("RemoveFolder"); +} + +void cmWIXFilesSourceWriter::EmitStartMenuShortcutRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName) +{ + EmitInstallRegistryValue(registryKey, cpackComponentName, std::string()); +} + +void cmWIXFilesSourceWriter::EmitDesktopShortcutRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName) +{ + EmitInstallRegistryValue(registryKey, cpackComponentName, "_desktop"); +} + +void cmWIXFilesSourceWriter::EmitInstallRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName, + std::string const& suffix) +{ + std::string valueName; + if(!cpackComponentName.empty()) + { + valueName = cpackComponentName + "_"; + } + + valueName += "installed"; + valueName += suffix; + + BeginElement("RegistryValue"); + AddAttribute("Root", "HKCU"); + AddAttribute("Key", registryKey); + AddAttribute("Name", valueName); + AddAttribute("Type", "integer"); + AddAttribute("Value", "1"); + AddAttribute("KeyPath", "yes"); + EndElement("RegistryValue"); +} + +void cmWIXFilesSourceWriter::EmitUninstallShortcut( + std::string const& packageName) +{ + BeginElement("Shortcut"); + AddAttribute("Id", "UNINSTALL"); + AddAttribute("Name", "Uninstall " + packageName); + AddAttribute("Description", "Uninstalls " + packageName); + AddAttribute("Target", "[SystemFolder]msiexec.exe"); + AddAttribute("Arguments", "/x [ProductCode]"); + EndElement("Shortcut"); +} + +std::string cmWIXFilesSourceWriter::EmitComponentFile( + std::string const& directoryId, + std::string const& id, + std::string const& filePath, + cmWIXPatch &patch) +{ + std::string componentId = std::string("CM_C") + id; + std::string fileId = std::string("CM_F") + id; + + BeginElement("DirectoryRef"); + AddAttribute("Id", directoryId); + + BeginElement("Component"); + AddAttribute("Id", componentId); + AddAttribute("Guid", "*"); + + BeginElement("File"); + AddAttribute("Id", fileId); + AddAttribute("Source", filePath); + AddAttribute("KeyPath", "yes"); + + mode_t fileMode = 0; + cmSystemTools::GetPermissions(filePath.c_str(), fileMode); + + if(!(fileMode & S_IWRITE)) + { + AddAttribute("ReadOnly", "yes"); + } + + patch.ApplyFragment(fileId, *this); + EndElement("File"); + + patch.ApplyFragment(componentId, *this); + EndElement("Component"); + EndElement("DirectoryRef"); + + return componentId; +} diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h new file mode 100644 index 000000000..d22d27006 --- /dev/null +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -0,0 +1,62 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#ifndef cmWIXFilesSourceWriter_h +#define cmWIXFilesSourceWriter_h + +#include "cmWIXSourceWriter.h" +#include "cmWIXShortcut.h" +#include "cmWIXPatch.h" + +#include + +/** \class cmWIXFilesSourceWriter + * \brief Helper class to generate files.wxs + */ +class cmWIXFilesSourceWriter : public cmWIXSourceWriter +{ +public: + cmWIXFilesSourceWriter(cmCPackLog* logger, + std::string const& filename); + + void EmitShortcut( + std::string const& id, + cmWIXShortcut const& shortcut, + bool desktop); + + void EmitRemoveFolder(std::string const& id); + + void EmitStartMenuShortcutRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName); + + void EmitDesktopShortcutRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName); + + void EmitUninstallShortcut(std::string const& packageName); + + std::string EmitComponentFile( + std::string const& directoryId, + std::string const& id, + std::string const& filePath, + cmWIXPatch &patch); + +private: + void EmitInstallRegistryValue( + std::string const& registryKey, + std::string const& cpackComponentName, + std::string const& suffix); +}; + + +#endif diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx new file mode 100644 index 000000000..b5202e0c0 --- /dev/null +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -0,0 +1,91 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ + +#include "cmWIXPatch.h" + +#include + +cmWIXPatch::cmWIXPatch(cmCPackLog* logger): + Logger(logger) +{ + +} + +void cmWIXPatch::LoadFragments(std::string const& patchFilePath) +{ + cmWIXPatchParser parser(Fragments, Logger); + parser.ParseFile(patchFilePath.c_str()); +} + +void cmWIXPatch::ApplyFragment( + std::string const& id, cmWIXSourceWriter& writer) +{ + cmWIXPatchParser::fragment_map_t::iterator i = Fragments.find(id); + if(i == Fragments.end()) return; + + const cmWIXPatchElement& fragment = i->second; + for(cmWIXPatchElement::child_list_t::const_iterator + j = fragment.children.begin(); j != fragment.children.end(); ++j) + { + ApplyElement(**j, writer); + } + + Fragments.erase(i); +} + +void cmWIXPatch::ApplyElement( + const cmWIXPatchElement& element, cmWIXSourceWriter& writer) +{ + writer.BeginElement(element.name); + + for(cmWIXPatchElement::attributes_t::const_iterator + i = element.attributes.begin(); i != element.attributes.end(); ++i) + { + writer.AddAttribute(i->first, i->second); + } + + for(cmWIXPatchElement::child_list_t::const_iterator + i = element.children.begin(); i != element.children.end(); ++i) + { + ApplyElement(**i, writer); + } + + writer.EndElement(element.name); +} + + +bool cmWIXPatch::CheckForUnappliedFragments() +{ + std::string fragmentList; + for(cmWIXPatchParser::fragment_map_t::const_iterator + i = Fragments.begin(); i != Fragments.end(); ++i) + { + if(!fragmentList.empty()) + { + fragmentList += ", "; + } + + fragmentList += "'"; + fragmentList += i->first; + fragmentList += "'"; + } + + if(fragmentList.size()) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Some XML patch fragments did not have matching IDs: " << + fragmentList << std::endl); + return false; + } + + return true; +} diff --git a/Source/CPack/WiX/cmWIXPatch.h b/Source/CPack/WiX/cmWIXPatch.h new file mode 100644 index 000000000..7b7b2f170 --- /dev/null +++ b/Source/CPack/WiX/cmWIXPatch.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#ifndef cmWIXPatch_h +#define cmWIXPatch_h + +#include "cmWIXSourceWriter.h" +#include "cmWIXPatchParser.h" + +#include + +/** \class cmWIXPatch + * \brief Class that maintains and applies patch fragments + */ +class cmWIXPatch +{ +public: + cmWIXPatch(cmCPackLog* logger); + + void LoadFragments(std::string const& patchFilePath); + + void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer); + + bool CheckForUnappliedFragments(); + +private: + void ApplyElement(const cmWIXPatchElement& element, + cmWIXSourceWriter& writer); + + cmCPackLog* Logger; + + cmWIXPatchParser::fragment_map_t Fragments; +}; + + +#endif diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 7ceaf1f86..10af1f6af 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -132,7 +132,7 @@ void cmWIXPatchParser::ReportError(int line, int column, const char* msg) Valid = false; } -void cmWIXPatchParser::ReportValidationError(const std::string& message) +void cmWIXPatchParser::ReportValidationError(std::string const& message) { ReportError(XML_GetCurrentLineNumber(Parser), XML_GetCurrentColumnNumber(Parser), diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index 91b3b6616..da3adf509 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -50,7 +50,7 @@ private: virtual void EndElement(const char *name); virtual void ReportError(int line, int column, const char* msg); - void ReportValidationError(const std::string& message); + void ReportValidationError(std::string const& message); bool IsValid() const; diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index ddc1d7138..f27caa941 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -15,7 +15,7 @@ #include cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter( - const std::string& filename): + std::string const& filename): File(filename.c_str(), std::ios::binary) { StartGroup(); @@ -33,7 +33,7 @@ cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter() File.put(0); } -void cmWIXRichTextFormatWriter::AddText(const std::string& text) +void cmWIXRichTextFormatWriter::AddText(std::string const& text) { typedef unsigned char rtf_byte_t; @@ -167,12 +167,12 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix() ControlWord("fs20"); } -void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword) +void cmWIXRichTextFormatWriter::ControlWord(std::string const& keyword) { File << "\\" << keyword; } -void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword) +void cmWIXRichTextFormatWriter::NewControlWord(std::string const& keyword) { File << "\\*\\" << keyword; } diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h index 2b665d47e..f6327fbd5 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h @@ -22,10 +22,10 @@ class cmWIXRichTextFormatWriter { public: - cmWIXRichTextFormatWriter(const std::string& filename); + cmWIXRichTextFormatWriter(std::string const& filename); ~cmWIXRichTextFormatWriter(); - void AddText(const std::string& text); + void AddText(std::string const& text); private: void WriteHeader(); @@ -35,8 +35,8 @@ private: void WriteDocumentPrefix(); - void ControlWord(const std::string& keyword); - void NewControlWord(const std::string& keyword); + void ControlWord(std::string const& keyword); + void NewControlWord(std::string const& keyword); void StartGroup(); void EndGroup(); diff --git a/Source/CPack/WiX/cmWIXShortcut.h b/Source/CPack/WiX/cmWIXShortcut.h new file mode 100644 index 000000000..93095e03f --- /dev/null +++ b/Source/CPack/WiX/cmWIXShortcut.h @@ -0,0 +1,29 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2014 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. +============================================================================*/ + +#ifndef cmWIXFilesShortcut_h +#define cmWIXFilesShortcut_h + +#include + +struct cmWIXShortcut +{ + cmWIXShortcut() + :desktop(false) + {} + + std::string textLabel; + std::string workingDirectoryId; + bool desktop; +}; + +#endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index e83c22618..aad19daf1 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -17,7 +17,7 @@ #include cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, - const std::string& filename, + std::string const& filename, bool isIncludeFile): Logger(logger), File(filename.c_str()), @@ -51,7 +51,7 @@ cmWIXSourceWriter::~cmWIXSourceWriter() EndElement(Elements.back()); } -void cmWIXSourceWriter::BeginElement(const std::string& name) +void cmWIXSourceWriter::BeginElement(std::string const& name) { if(State == BEGIN) { @@ -101,7 +101,7 @@ void cmWIXSourceWriter::EndElement(std::string const& name) } void cmWIXSourceWriter::AddProcessingInstruction( - const std::string& target, const std::string& content) + std::string const& target, std::string const& content) { if(State == BEGIN) { @@ -116,7 +116,7 @@ void cmWIXSourceWriter::AddProcessingInstruction( } void cmWIXSourceWriter::AddAttribute( - const std::string& key, const std::string& value) + std::string const& key, std::string const& value) { std::string utf8 = WindowsCodepageToUtf8(value); @@ -124,7 +124,7 @@ void cmWIXSourceWriter::AddAttribute( } void cmWIXSourceWriter::AddAttributeUnlessEmpty( - const std::string& key, const std::string& value) + std::string const& key, std::string const& value) { if(value.size()) { @@ -132,7 +132,7 @@ void cmWIXSourceWriter::AddAttributeUnlessEmpty( } } -std::string cmWIXSourceWriter::WindowsCodepageToUtf8(const std::string& value) +std::string cmWIXSourceWriter::WindowsCodepageToUtf8(std::string const& value) { if(value.empty()) { @@ -184,7 +184,7 @@ void cmWIXSourceWriter::Indent(size_t count) } std::string cmWIXSourceWriter::EscapeAttributeValue( - const std::string& value) + std::string const& value) { std::string result; result.reserve(value.size()); diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 894ad78a0..65b724056 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -26,24 +26,24 @@ class cmWIXSourceWriter { public: cmWIXSourceWriter(cmCPackLog* logger, - const std::string& filename, bool isIncludeFile = false); + std::string const& filename, bool isIncludeFile = false); ~cmWIXSourceWriter(); - void BeginElement(const std::string& name); + void BeginElement(std::string const& name); - void EndElement(const std::string& name); + void EndElement(std::string const& name); void AddProcessingInstruction( - const std::string& target, const std::string& content); + std::string const& target, std::string const& content); void AddAttribute( - const std::string& key, const std::string& value); + std::string const& key, std::string const& value); void AddAttributeUnlessEmpty( - const std::string& key, const std::string& value); + std::string const& key, std::string const& value); - static std::string WindowsCodepageToUtf8(const std::string& value); + static std::string WindowsCodepageToUtf8(std::string const& value); private: enum State @@ -56,7 +56,7 @@ private: void Indent(size_t count); - static std::string EscapeAttributeValue(const std::string& value); + static std::string EscapeAttributeValue(std::string const& value); cmCPackLog* Logger; From 041485bc163c69e5eb2829bc78857a958cad7e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= Date: Sat, 22 Feb 2014 19:57:17 +0100 Subject: [PATCH 038/278] Add FindOpenCL module --- Help/manual/cmake-modules.7.rst | 1 + Help/module/FindOpenCL.rst | 1 + Modules/FindOpenCL.cmake | 134 ++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 Help/module/FindOpenCL.rst create mode 100644 Modules/FindOpenCL.cmake diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 7a06be6ca..2bbe62212 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -138,6 +138,7 @@ All Modules /module/FindMPEG /module/FindMPI /module/FindOpenAL + /module/FindOpenCL /module/FindOpenGL /module/FindOpenMP /module/FindOpenSceneGraph diff --git a/Help/module/FindOpenCL.rst b/Help/module/FindOpenCL.rst new file mode 100644 index 000000000..e87e289bd --- /dev/null +++ b/Help/module/FindOpenCL.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindOpenCL.cmake diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake new file mode 100644 index 000000000..eee06bf44 --- /dev/null +++ b/Modules/FindOpenCL.cmake @@ -0,0 +1,134 @@ +#.rst: +# FindOpenCL +# ---------- +# +# Try to find OpenCL +# +# Once done this will define:: +# +# OpenCL_FOUND - True if OpenCL was found +# OpenCL_INCLUDE_DIRS - include directories for OpenCL +# OpenCL_LIBRARIES - link against this library to use OpenCL +# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2) +# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation +# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation +# +# The module will also define two cache variables:: +# +# OpenCL_INCLUDE_DIR - the OpenCL include directory +# OpenCL_LIBRARY - the path to the OpenCL library +# + +#============================================================================= +# Copyright 2014 Matthaeus G. Chajdas +# +# 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.) + +function(_FIND_OPENCL_VERSION) + include(CheckSymbolExists) + include(CMakePushCheckState) + + CMAKE_PUSH_CHECK_STATE() + foreach(VERSION "2_0" "1_2" "1_1" "1_0") + set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}") + + if(APPLE) + CHECK_SYMBOL_EXISTS( + CL_VERSION_${VERSION} + "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h" + OPENCL_VERSION_${VERSION}) + else() + CHECK_SYMBOL_EXISTS( + CL_VERSION_${VERSION} + "${OpenCL_INCLUDE_DIR}/CL/cl.h" + OPENCL_VERSION_${VERSION}) + endif() + + if(OPENCL_VERSION_${VERSION}) + string(REPLACE "_" "." VERSION "${VERSION}") + set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE) + string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}") + list(GET version_components 0 major_version) + list(GET version_components 1 minor_version) + set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE) + set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE) + break() + endif() + endforeach() + CMAKE_POP_CHECK_STATE() +endfunction() + +find_path(OpenCL_INCLUDE_DIR + NAMES + CL/cl.h OpenCL/cl.h + PATHS ENV + "PROGRAMFILES(X86)" + AMDAPPSDKROOT + INTELOCLSDKROOT + NVSDKCOMPUTE_ROOT + CUDA_PATH + ATISTREAMSDKROOT + PATH_SUFFIXES + OpenCL/common/inc + "AMD APP/include") + +_FIND_OPENCL_VERSION() + +if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS ENV + "PROGRAMFILES(X86)" + AMDAPPSDKROOT + INTELOCLSDKROOT + CUDA_PATH + NVSDKCOMPUTE_ROOT + ATISTREAMSDKROOT + PATH_SUFFIXES + "AMD APP/lib/x86" + lib/x86 + lib/Win32 + OpenCL/common/lib/Win32) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + find_library(OpenCL_LIBRARY + NAMES OpenCL + PATHS ENV + "PROGRAMFILES(X86)" + AMDAPPSDKROOT + INTELOCLSDKROOT + CUDA_PATH + NVSDKCOMPUTE_ROOT + ATISTREAMSDKROOT + PATH_SUFFIXES + "AMD APP/lib/x86_64" + lib/x86_64 + lib/x64 + OpenCL/common/lib/x64) + endif() +else() + find_library(OpenCL_LIBRARY + NAMES OpenCL) +endif() + +set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) +set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args( + OpenCL + FOUND_VAR OpenCL_FOUND + REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR + VERSION_VAR OpenCL_VERSION_STRING) + +mark_as_advanced( + OpenCL_INCLUDE_DIR + OpenCL_LIBRARY) From fba51b096e2d8ec281653aa05720c11dc9b9bfe6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Feb 2014 14:15:21 -0500 Subject: [PATCH 039/278] MSVC: Add properties to configure compiler PDB files (#14762) Since commit v2.8.12~437^2~2 (VS: Separate compiler and linker PDB files 2013-04-05) we no longer set /Fd with the PDB_NAME or PDB_OUTPUT_DIRECTORY properties. Those properties now exclusively handle linker PDB files. Since STATIC libraries do not link their compiler PDB file becomes more important. Add new target properties "COMPILE_PDB_NAME[_]" and "COMPILE_PDB_OUTPUT_DIRECTORY[_]" to specify the compiler PDB file location and pass the value to the MSVC /Fd option. --- Help/manual/cmake-properties.7.rst | 4 ++ Help/manual/cmake-variables.7.rst | 2 + Help/prop_tgt/COMPILE_PDB_NAME.rst | 11 ++++ Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst | 10 ++++ Help/prop_tgt/COMPILE_PDB_NOTE.txt | 8 +++ .../prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst | 13 +++++ .../COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 16 ++++++ Help/prop_tgt/PDB_NAME.rst | 1 + Help/prop_tgt/PDB_NAME_CONFIG.rst | 1 + Help/prop_tgt/PDB_NOTE.txt | 2 +- Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst | 1 + Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst | 1 + Help/release/dev/msvc-compiler-pdb-files.rst | 10 ++++ .../CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst | 8 +++ ...KE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 11 ++++ Modules/Platform/Windows-MSVC.cmake | 2 +- Source/cmLocalGenerator.cxx | 7 +++ Source/cmLocalGenerator.h | 1 + Source/cmLocalVisualStudio7Generator.cxx | 13 ++++- .../cmMakefileExecutableTargetGenerator.cxx | 4 ++ Source/cmMakefileLibraryTargetGenerator.cxx | 4 ++ Source/cmMakefileTargetGenerator.cxx | 17 ++++++ Source/cmNinjaTargetGenerator.cxx | 16 ++++++ Source/cmTarget.cxx | 57 +++++++++++++++++++ Source/cmTarget.h | 12 ++++ Source/cmVisualStudio10TargetGenerator.cxx | 11 ++++ Tests/PDBDirectoryAndName/CMakeLists.txt | 30 +++++++--- 27 files changed, 262 insertions(+), 11 deletions(-) create mode 100644 Help/prop_tgt/COMPILE_PDB_NAME.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_NOTE.txt create mode 100644 Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst create mode 100644 Help/release/dev/msvc-compiler-pdb-files.rst create mode 100644 Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst create mode 100644 Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d315fcbb6..6ea5839c8 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -100,6 +100,10 @@ Properties on Targets /prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_FLAGS /prop_tgt/COMPILE_OPTIONS + /prop_tgt/COMPILE_PDB_NAME + /prop_tgt/COMPILE_PDB_NAME_CONFIG + /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY + /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_POSTFIX /prop_tgt/DEBUG_POSTFIX diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c4ae193d0..5f2ba28f7 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -198,6 +198,8 @@ Variables that Control the Build /variable/CMAKE_AUTOUIC /variable/CMAKE_AUTOUIC_OPTIONS /variable/CMAKE_BUILD_WITH_INSTALL_RPATH + /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY + /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_CONFIG_POSTFIX /variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG diff --git a/Help/prop_tgt/COMPILE_PDB_NAME.rst b/Help/prop_tgt/COMPILE_PDB_NAME.rst new file mode 100644 index 000000000..24a9f62d6 --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NAME.rst @@ -0,0 +1,11 @@ +COMPILE_PDB_NAME +---------------- + +Output name for the MS debug symbol ``.pdb`` file generated by the +compiler while building source files. + +This property specifies the base name for the debug symbols file. +If not set, the default is unspecified. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst b/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst new file mode 100644 index 000000000..e4077f559 --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst @@ -0,0 +1,10 @@ +COMPILE_PDB_NAME_ +------------------------- + +Per-configuration output name for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This is the configuration-specific version of :prop_tgt:`COMPILE_PDB_NAME`. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME_` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_NOTE.txt b/Help/prop_tgt/COMPILE_PDB_NOTE.txt new file mode 100644 index 000000000..5941d72ef --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NOTE.txt @@ -0,0 +1,8 @@ +.. note:: + The compiler-generated program database files are specified by the + ``/Fd`` compiler flag and are not the same as linker-generated + program database files specified by the ``/pdb`` linker flag. + Use the |PDB_XXX| property to specify the latter. + + This property is not implemented by the :generator:`Visual Studio 6` + generator. diff --git a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst new file mode 100644 index 000000000..34f49bebe --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst @@ -0,0 +1,13 @@ +COMPILE_PDB_OUTPUT_DIRECTORY +---------------------------- + +Output directory for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This property specifies the directory into which the MS debug symbols +will be placed by the compiler. This property is initialized by the +value of the :variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY` variable +if it is set when a target is created. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 000000000..52ef013da --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,16 @@ +COMPILE_PDB_OUTPUT_DIRECTORY_ +------------------------------------- + +Per-configuration output directory for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This is a per-configuration version of +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`, +but multi-configuration generators (VS, Xcode) do NOT append a +per-configuration subdirectory to the specified directory. This +property is initialized by the value of the +:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_` variable +if it is set when a target is created. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY_` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NAME.rst b/Help/prop_tgt/PDB_NAME.rst index 333c8656b..479dec3f9 100644 --- a/Help/prop_tgt/PDB_NAME.rst +++ b/Help/prop_tgt/PDB_NAME.rst @@ -7,4 +7,5 @@ linker for an executable or shared library target. This property specifies the base name for the debug symbols file. If not set, the logical target name is used by default. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NAME_CONFIG.rst b/Help/prop_tgt/PDB_NAME_CONFIG.rst index 7bf9e43dc..cb3121c2f 100644 --- a/Help/prop_tgt/PDB_NAME_CONFIG.rst +++ b/Help/prop_tgt/PDB_NAME_CONFIG.rst @@ -6,4 +6,5 @@ generated by the linker for an executable or shared library target. This is the configuration-specific version of :prop_tgt:`PDB_NAME`. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME_` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NOTE.txt b/Help/prop_tgt/PDB_NOTE.txt index c03bd3a56..f90ea8117 100644 --- a/Help/prop_tgt/PDB_NOTE.txt +++ b/Help/prop_tgt/PDB_NOTE.txt @@ -6,7 +6,7 @@ The linker-generated program database files are specified by the ``/pdb`` linker flag and are not the same as compiler-generated program database files specified by the ``/Fd`` compiler flag. - This property does not influence the latter. + Use the |COMPILE_PDB_XXX| property to specify the latter. This property is not implemented by the :generator:`Visual Studio 6` generator. diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst index 48773685f..730cf5776 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst @@ -9,4 +9,5 @@ will be placed by the linker. This property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is set when a target is created. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst index 7bbc23706..6037fa0c7 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,4 +11,5 @@ property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_` variable if it is set when a target is created. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_` .. include:: PDB_NOTE.txt diff --git a/Help/release/dev/msvc-compiler-pdb-files.rst b/Help/release/dev/msvc-compiler-pdb-files.rst new file mode 100644 index 000000000..d06d20275 --- /dev/null +++ b/Help/release/dev/msvc-compiler-pdb-files.rst @@ -0,0 +1,10 @@ +msvc-compiler-pdb-files +----------------------- + +* New :prop_tgt:`COMPILE_PDB_NAME` and + :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties + were introduced to specify the MSVC compiler program database + file location (``cl /Fd``). This complements the existing + :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties that specify the linker program database + file location (``link /pdb``). diff --git a/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst new file mode 100644 index 000000000..ea33c7d64 --- /dev/null +++ b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst @@ -0,0 +1,8 @@ +CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY +---------------------------------- + +Output directory for MS debug symbol ``.pdb`` files +generated by the compiler while building source files. + +This variable is used to initialize the +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` property on all the targets. diff --git a/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 000000000..fdeb9abdd --- /dev/null +++ b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,11 @@ +CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_ +------------------------------------------- + +Per-configuration output directory for MS debug symbol ``.pdb`` files +generated by the compiler while building source files. + +This is a per-configuration version of +:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY`. +This variable is used to initialize the +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_` +property on all the targets. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e29aaf41f..5732170fc 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -241,7 +241,7 @@ 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}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index aca195c57..4266dd061 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -901,6 +901,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, return replaceValues.TargetPDB; } } + if(replaceValues.TargetCompilePDB) + { + if(variable == "TARGET_COMPILE_PDB") + { + return replaceValues.TargetCompilePDB; + } + } if(replaceValues.DependencyFile ) { if(variable == "DEP_FILE") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 97648138a..0f7fd253b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -245,6 +245,7 @@ public: } cmTarget* CMTarget; const char* TargetPDB; + const char* TargetCompilePDB; const char* TargetVersionMajor; const char* TargetVersionMinor; const char* Language; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 212b06b3a..ce24d8d0c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -660,7 +660,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, switch(target.GetType()) { case cmTarget::OBJECT_LIBRARY: - targetBuilds = false; // TODO: PDB for object library? + targetBuilds = false; // no manifest tool for object library case cmTarget::STATIC_LIBRARY: projectType = "typeStaticLibrary"; configType = "4"; @@ -846,6 +846,17 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; + if(target.GetType() <= cmTarget::OBJECT_LIBRARY) + { + // Specify the compiler program database file if configured. + std::string pdb = target.GetCompilePDBPath(configName); + if(!pdb.empty()) + { + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << this->ConvertToXMLOutputPathSingle(pdb.c_str()) + << "\"\n"; + } + } fout << "/>\n"; // end of FortranProject) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 664d73e87..03fdda246 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -129,6 +129,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } } + std::string compilePdbOutputPath = + this->Target->GetCompilePDBDirectory(this->ConfigName); + cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b9af63815..807aca8f6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -321,6 +321,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } + std::string compilePdbOutputPath = + this->Target->GetCompilePDBDirectory(this->ConfigName); + cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c3ca85d5a..c6ade7f1d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -624,9 +624,11 @@ cmMakefileTargetGenerator std::string targetOutPathReal; std::string targetOutPathPDB; + std::string targetOutPathCompilePDB; { std::string targetFullPathReal; std::string targetFullPathPDB; + std::string targetFullPathCompilePDB; if(this->Target->GetType() == cmTarget::EXECUTABLE || this->Target->GetType() == cmTarget::STATIC_LIBRARY || this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -638,12 +640,26 @@ cmMakefileTargetGenerator targetFullPathPDB += "/"; targetFullPathPDB += this->Target->GetPDBName(this->ConfigName); } + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) + { + targetFullPathCompilePDB = + this->Target->GetCompilePDBPath(this->ConfigName); + if(targetFullPathCompilePDB.empty()) + { + targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/"; + } + } + targetOutPathReal = this->Convert(targetFullPathReal.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); targetOutPathPDB = this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, cmLocalGenerator::SHELL); + targetOutPathCompilePDB = + this->Convert(targetFullPathCompilePDB.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; @@ -651,6 +667,7 @@ cmMakefileTargetGenerator vars.Language = lang; vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); + vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); vars.Source = sourceFile.c_str(); std::string shellObj = this->Convert(obj.c_str(), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 900af8d6e..eaeddefed 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -320,6 +320,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { std::string pdbPath; + std::string compilePdbPath; if(this->Target->GetType() == cmTarget::EXECUTABLE || this->Target->GetType() == cmTarget::STATIC_LIBRARY || this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -329,11 +330,25 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const pdbPath += "/"; pdbPath += this->Target->GetPDBName(this->GetConfigName()); } + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) + { + compilePdbPath = this->Target->GetCompilePDBPath(this->GetConfigName()); + if(compilePdbPath.empty()) + { + compilePdbPath = this->Target->GetSupportDirectory() + "/"; + } + } vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(pdbPath.c_str()).c_str(), cmLocalGenerator::SHELL); + vars["TARGET_COMPILE_PDB"] = + this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(compilePdbPath.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(pdbPath); + EnsureParentDirectoryExists(compilePdbPath); return true; } return false; @@ -362,6 +377,7 @@ cmNinjaTargetGenerator vars.Object = "$out"; vars.Defines = "$DEFINES"; vars.TargetPDB = "$TARGET_PDB"; + vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; cmMakefile* mf = this->GetMakefile(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a50d6adfc..7a0df745c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -74,6 +74,7 @@ struct cmTarget::ImportInfo //---------------------------------------------------------------------------- struct cmTarget::CompileInfo { + std::string CompilePdbDir; }; struct TargetConfigPair : public std::pair { @@ -275,6 +276,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0); + this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("Fortran_FORMAT", 0); this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("GNUtoMS", 0); @@ -303,6 +305,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) "LIBRARY_OUTPUT_DIRECTORY_", "RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_", + "COMPILE_PDB_OUTPUT_DIRECTORY_", "MAP_IMPORTED_CONFIG_", 0}; for(std::vector::iterator ci = configNames.begin(); @@ -2517,6 +2520,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const if(i == this->Internal->CompileInfoMap.end()) { CompileInfo info; + this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir); CompileInfoMapType::value_type entry(config_upper, info); i = this->Internal->CompileInfoMap.insert(entry).first; } @@ -2552,6 +2556,16 @@ std::string cmTarget::GetPDBDirectory(const char* config) const return ""; } +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBDirectory(const char* config) const +{ + if(CompileInfo const* info = this->GetCompileInfo(config)) + { + return info->CompilePdbDir; + } + return ""; +} + //---------------------------------------------------------------------------- const char* cmTarget::GetLocation(const char* config) const { @@ -3212,6 +3226,49 @@ std::string cmTarget::GetPDBName(const char* config) const return prefix+base+".pdb"; } +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBName(const char* config) const +{ + std::string prefix; + std::string base; + std::string suffix; + this->GetFullNameInternal(config, false, prefix, base, suffix); + + // Check for a per-configuration output directory target property. + std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configProp = "COMPILE_PDB_NAME_"; + configProp += configUpper; + const char* config_name = this->GetProperty(configProp.c_str()); + if(config_name && *config_name) + { + return prefix + config_name + ".pdb"; + } + + const char* name = this->GetProperty("COMPILE_PDB_NAME"); + if(name && *name) + { + return prefix + name + ".pdb"; + } + + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBPath(const char* config) const +{ + std::string dir = this->GetCompilePDBDirectory(config); + std::string name = this->GetCompilePDBName(config); + if(dir.empty() && !name.empty()) + { + dir = this->GetPDBDirectory(config); + } + if(!dir.empty()) + { + dir += "/"; + } + return dir + name; +} + //---------------------------------------------------------------------------- bool cmTarget::HasSOName(const char* config) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 678770606..a3f544c69 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -342,6 +342,12 @@ public: pdb output directory is given. */ std::string GetPDBDirectory(const char* config) const; + /** Get the directory in which to place the target compiler .pdb file. + If the configuration name is given then the generator will add its + subdirectory for that configuration. Otherwise just the canonical + compiler pdb output directory is given. */ + std::string GetCompilePDBDirectory(const char* config = 0) const; + /** Get the location of the target in the build tree for the given configuration. This location is suitable for use as the LOCATION target property. */ @@ -377,6 +383,12 @@ public: /** Get the name of the pdb file for the target. */ std::string GetPDBName(const char* config) const; + /** Get the name of the compiler pdb file for the target. */ + std::string GetCompilePDBName(const char* config=0) const; + + /** Get the path for the MSVC /Fd option for this target. */ + std::string GetCompilePDBPath(const char* config=0) const; + /** Whether this library has soname enabled and platform supports it. */ bool HasSOName(const char* config) const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ed7e243e8..b1f09741d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1427,6 +1427,17 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); this->WriteString("$(IntDir)\n", 3); + + // Specify the compiler program database file if configured. + std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); + if(!pdb.empty()) + { + this->ConvertToWindowsSlash(pdb); + this->WriteString("", 3); + *this->BuildFileStream << cmVS10EscapeXML(pdb) + << "\n"; + } + this->WriteString("\n", 2); } diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 28e46b1f5..90af600fc 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -6,6 +6,13 @@ if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel") endif() +# Intel 11.1 does not support /Fd but Intel 14.0 does. +# TODO: Did a version in between these add it? +if(CMAKE_C_COMPILER_ID STREQUAL Intel AND + CMAKE_C_COMPILER_VERSION VERSION_LESS 14.0) + set(NO_COMPILE_PDB 1) +endif() + set(my_targets "") add_library(mylibA SHARED mylibA.c) @@ -17,12 +24,12 @@ list(APPEND my_targets mylibA) add_library(mylibB STATIC mylibB.c) set_target_properties(mylibB PROPERTIES - PDB_NAME "mylibB_Special" - PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" + COMPILE_PDB_NAME "mylibB_Special" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" ) -# TODO: The only .pdb available for a static library is that generated -# by the compiler /Fd option which is not the same as the linker /pdb. -# list(APPEND my_targets mylibB) +if(NOT NO_COMPILE_PDB) + list(APPEND my_targets mylibB) +endif() add_library(mylibC SHARED mylibC.c) set_target_properties(mylibC PROPERTIES @@ -32,10 +39,11 @@ list(APPEND my_targets mylibC) add_library(mylibD STATIC mylibD.c) set_target_properties(mylibD PROPERTIES - PDB_NAME "mylibD_Special" + COMPILE_PDB_NAME "mylibD_Special" ) -# TODO: See comment for mylibB. -# list(APPEND my_targets mylibD) +if(NOT NO_COMPILE_PDB) + list(APPEND my_targets mylibD) +endif() add_executable(myexe myexe.c) set_target_properties(myexe PROPERTIES @@ -66,6 +74,12 @@ set(pdbs "") foreach(t ${my_targets}) get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME) get_property(pdb_dir TARGET ${t} PROPERTY PDB_OUTPUT_DIRECTORY) + if(NOT pdb_name) + get_property(pdb_name TARGET ${t} PROPERTY COMPILE_PDB_NAME) + endif() + if(NOT pdb_dir) + get_property(pdb_dir TARGET ${t} PROPERTY COMPILE_PDB_OUTPUT_DIRECTORY) + endif() if(NOT pdb_dir) set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR}) endif() From 0ea3aee825dc45e56bcdffce407fa4decd29cd8a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 24 Feb 2014 14:15:21 -0500 Subject: [PATCH 040/278] MSVC: Add properties to configure compiler PDB files (#14763) Since commit v2.8.12~437^2~2 (VS: Separate compiler and linker PDB files 2013-04-05) we no longer set /Fd with the PDB_NAME or PDB_OUTPUT_DIRECTORY properties. Those properties now exclusively handle linker PDB files. Since STATIC libraries do not link their compiler PDB file becomes more important. Add new target properties "COMPILE_PDB_NAME[_]" and "COMPILE_PDB_OUTPUT_DIRECTORY[_]" to specify the compiler PDB file location and pass the value to the MSVC /Fd option. --- Help/manual/cmake-properties.7.rst | 4 ++ Help/manual/cmake-variables.7.rst | 2 + Help/prop_tgt/COMPILE_PDB_NAME.rst | 11 ++++ Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst | 10 ++++ Help/prop_tgt/COMPILE_PDB_NOTE.txt | 8 +++ .../prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst | 13 +++++ .../COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 16 ++++++ Help/prop_tgt/PDB_NAME.rst | 1 + Help/prop_tgt/PDB_NAME_CONFIG.rst | 1 + Help/prop_tgt/PDB_NOTE.txt | 2 +- Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst | 1 + Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst | 1 + Help/release/dev/msvc-compiler-pdb-files.rst | 10 ++++ .../CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst | 8 +++ ...KE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst | 11 ++++ Modules/Platform/Windows-MSVC.cmake | 2 +- Source/cmLocalGenerator.cxx | 7 +++ Source/cmLocalGenerator.h | 1 + Source/cmLocalVisualStudio7Generator.cxx | 13 ++++- .../cmMakefileExecutableTargetGenerator.cxx | 4 ++ Source/cmMakefileLibraryTargetGenerator.cxx | 4 ++ Source/cmMakefileTargetGenerator.cxx | 17 ++++++ Source/cmNinjaTargetGenerator.cxx | 16 ++++++ Source/cmTarget.cxx | 57 +++++++++++++++++++ Source/cmTarget.h | 12 ++++ Source/cmVisualStudio10TargetGenerator.cxx | 11 ++++ Tests/PDBDirectoryAndName/CMakeLists.txt | 30 +++++++--- 27 files changed, 262 insertions(+), 11 deletions(-) create mode 100644 Help/prop_tgt/COMPILE_PDB_NAME.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_NOTE.txt create mode 100644 Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst create mode 100644 Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst create mode 100644 Help/release/dev/msvc-compiler-pdb-files.rst create mode 100644 Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst create mode 100644 Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d315fcbb6..6ea5839c8 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -100,6 +100,10 @@ Properties on Targets /prop_tgt/COMPILE_DEFINITIONS /prop_tgt/COMPILE_FLAGS /prop_tgt/COMPILE_OPTIONS + /prop_tgt/COMPILE_PDB_NAME + /prop_tgt/COMPILE_PDB_NAME_CONFIG + /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY + /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /prop_tgt/CONFIG_OUTPUT_NAME /prop_tgt/CONFIG_POSTFIX /prop_tgt/DEBUG_POSTFIX diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index c4ae193d0..5f2ba28f7 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -198,6 +198,8 @@ Variables that Control the Build /variable/CMAKE_AUTOUIC /variable/CMAKE_AUTOUIC_OPTIONS /variable/CMAKE_BUILD_WITH_INSTALL_RPATH + /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY + /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_CONFIG_POSTFIX /variable/CMAKE_DEBUG_POSTFIX /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG diff --git a/Help/prop_tgt/COMPILE_PDB_NAME.rst b/Help/prop_tgt/COMPILE_PDB_NAME.rst new file mode 100644 index 000000000..24a9f62d6 --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NAME.rst @@ -0,0 +1,11 @@ +COMPILE_PDB_NAME +---------------- + +Output name for the MS debug symbol ``.pdb`` file generated by the +compiler while building source files. + +This property specifies the base name for the debug symbols file. +If not set, the default is unspecified. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst b/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst new file mode 100644 index 000000000..e4077f559 --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst @@ -0,0 +1,10 @@ +COMPILE_PDB_NAME_ +------------------------- + +Per-configuration output name for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This is the configuration-specific version of :prop_tgt:`COMPILE_PDB_NAME`. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME_` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_NOTE.txt b/Help/prop_tgt/COMPILE_PDB_NOTE.txt new file mode 100644 index 000000000..5941d72ef --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_NOTE.txt @@ -0,0 +1,8 @@ +.. note:: + The compiler-generated program database files are specified by the + ``/Fd`` compiler flag and are not the same as linker-generated + program database files specified by the ``/pdb`` linker flag. + Use the |PDB_XXX| property to specify the latter. + + This property is not implemented by the :generator:`Visual Studio 6` + generator. diff --git a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst new file mode 100644 index 000000000..34f49bebe --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst @@ -0,0 +1,13 @@ +COMPILE_PDB_OUTPUT_DIRECTORY +---------------------------- + +Output directory for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This property specifies the directory into which the MS debug symbols +will be placed by the compiler. This property is initialized by the +value of the :variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY` variable +if it is set when a target is created. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 000000000..52ef013da --- /dev/null +++ b/Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,16 @@ +COMPILE_PDB_OUTPUT_DIRECTORY_ +------------------------------------- + +Per-configuration output directory for the MS debug symbol ``.pdb`` file +generated by the compiler while building source files. + +This is a per-configuration version of +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`, +but multi-configuration generators (VS, Xcode) do NOT append a +per-configuration subdirectory to the specified directory. This +property is initialized by the value of the +:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_` variable +if it is set when a target is created. + +.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY_` +.. include:: COMPILE_PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NAME.rst b/Help/prop_tgt/PDB_NAME.rst index 333c8656b..479dec3f9 100644 --- a/Help/prop_tgt/PDB_NAME.rst +++ b/Help/prop_tgt/PDB_NAME.rst @@ -7,4 +7,5 @@ linker for an executable or shared library target. This property specifies the base name for the debug symbols file. If not set, the logical target name is used by default. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NAME_CONFIG.rst b/Help/prop_tgt/PDB_NAME_CONFIG.rst index 7bf9e43dc..cb3121c2f 100644 --- a/Help/prop_tgt/PDB_NAME_CONFIG.rst +++ b/Help/prop_tgt/PDB_NAME_CONFIG.rst @@ -6,4 +6,5 @@ generated by the linker for an executable or shared library target. This is the configuration-specific version of :prop_tgt:`PDB_NAME`. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME_` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_NOTE.txt b/Help/prop_tgt/PDB_NOTE.txt index c03bd3a56..f90ea8117 100644 --- a/Help/prop_tgt/PDB_NOTE.txt +++ b/Help/prop_tgt/PDB_NOTE.txt @@ -6,7 +6,7 @@ The linker-generated program database files are specified by the ``/pdb`` linker flag and are not the same as compiler-generated program database files specified by the ``/Fd`` compiler flag. - This property does not influence the latter. + Use the |COMPILE_PDB_XXX| property to specify the latter. This property is not implemented by the :generator:`Visual Studio 6` generator. diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst index 48773685f..730cf5776 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst @@ -9,4 +9,5 @@ will be placed by the linker. This property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is set when a target is created. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` .. include:: PDB_NOTE.txt diff --git a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst index 7bbc23706..6037fa0c7 100644 --- a/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst +++ b/Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -11,4 +11,5 @@ property is initialized by the value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_` variable if it is set when a target is created. +.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_` .. include:: PDB_NOTE.txt diff --git a/Help/release/dev/msvc-compiler-pdb-files.rst b/Help/release/dev/msvc-compiler-pdb-files.rst new file mode 100644 index 000000000..d06d20275 --- /dev/null +++ b/Help/release/dev/msvc-compiler-pdb-files.rst @@ -0,0 +1,10 @@ +msvc-compiler-pdb-files +----------------------- + +* New :prop_tgt:`COMPILE_PDB_NAME` and + :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties + were introduced to specify the MSVC compiler program database + file location (``cl /Fd``). This complements the existing + :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties that specify the linker program database + file location (``link /pdb``). diff --git a/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst new file mode 100644 index 000000000..ea33c7d64 --- /dev/null +++ b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst @@ -0,0 +1,8 @@ +CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY +---------------------------------- + +Output directory for MS debug symbol ``.pdb`` files +generated by the compiler while building source files. + +This variable is used to initialize the +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` property on all the targets. diff --git a/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst new file mode 100644 index 000000000..fdeb9abdd --- /dev/null +++ b/Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst @@ -0,0 +1,11 @@ +CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_ +------------------------------------------- + +Per-configuration output directory for MS debug symbol ``.pdb`` files +generated by the compiler while building source files. + +This is a per-configuration version of +:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY`. +This variable is used to initialize the +:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_` +property on all the targets. diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e29aaf41f..5732170fc 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -241,7 +241,7 @@ 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}") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index aca195c57..4266dd061 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -901,6 +901,13 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, return replaceValues.TargetPDB; } } + if(replaceValues.TargetCompilePDB) + { + if(variable == "TARGET_COMPILE_PDB") + { + return replaceValues.TargetCompilePDB; + } + } if(replaceValues.DependencyFile ) { if(variable == "DEP_FILE") diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 97648138a..0f7fd253b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -245,6 +245,7 @@ public: } cmTarget* CMTarget; const char* TargetPDB; + const char* TargetCompilePDB; const char* TargetVersionMajor; const char* TargetVersionMinor; const char* Language; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 212b06b3a..ce24d8d0c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -660,7 +660,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, switch(target.GetType()) { case cmTarget::OBJECT_LIBRARY: - targetBuilds = false; // TODO: PDB for object library? + targetBuilds = false; // no manifest tool for object library case cmTarget::STATIC_LIBRARY: projectType = "typeStaticLibrary"; configType = "4"; @@ -846,6 +846,17 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; + if(target.GetType() <= cmTarget::OBJECT_LIBRARY) + { + // Specify the compiler program database file if configured. + std::string pdb = target.GetCompilePDBPath(configName); + if(!pdb.empty()) + { + fout << "\t\t\t\tProgramDataBaseFileName=\"" + << this->ConvertToXMLOutputPathSingle(pdb.c_str()) + << "\"\n"; + } + } fout << "/>\n"; // end of FortranProject) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 664d73e87..03fdda246 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -129,6 +129,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } } + std::string compilePdbOutputPath = + this->Target->GetCompilePDBDirectory(this->ConfigName); + cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index b9af63815..807aca8f6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -321,6 +321,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } + std::string compilePdbOutputPath = + this->Target->GetCompilePDBDirectory(this->ConfigName); + cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str()); + std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName); cmSystemTools::MakeDirectory(pdbOutputPath.c_str()); pdbOutputPath += "/"; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c3ca85d5a..c6ade7f1d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -624,9 +624,11 @@ cmMakefileTargetGenerator std::string targetOutPathReal; std::string targetOutPathPDB; + std::string targetOutPathCompilePDB; { std::string targetFullPathReal; std::string targetFullPathPDB; + std::string targetFullPathCompilePDB; if(this->Target->GetType() == cmTarget::EXECUTABLE || this->Target->GetType() == cmTarget::STATIC_LIBRARY || this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -638,12 +640,26 @@ cmMakefileTargetGenerator targetFullPathPDB += "/"; targetFullPathPDB += this->Target->GetPDBName(this->ConfigName); } + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) + { + targetFullPathCompilePDB = + this->Target->GetCompilePDBPath(this->ConfigName); + if(targetFullPathCompilePDB.empty()) + { + targetFullPathCompilePDB = this->Target->GetSupportDirectory() + "/"; + } + } + targetOutPathReal = this->Convert(targetFullPathReal.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); targetOutPathPDB = this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, cmLocalGenerator::SHELL); + targetOutPathCompilePDB = + this->Convert(targetFullPathCompilePDB.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; @@ -651,6 +667,7 @@ cmMakefileTargetGenerator vars.Language = lang; vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); + vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); vars.Source = sourceFile.c_str(); std::string shellObj = this->Convert(obj.c_str(), diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 900af8d6e..eaeddefed 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -320,6 +320,7 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { std::string pdbPath; + std::string compilePdbPath; if(this->Target->GetType() == cmTarget::EXECUTABLE || this->Target->GetType() == cmTarget::STATIC_LIBRARY || this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -329,11 +330,25 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const pdbPath += "/"; pdbPath += this->Target->GetPDBName(this->GetConfigName()); } + if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY) + { + compilePdbPath = this->Target->GetCompilePDBPath(this->GetConfigName()); + if(compilePdbPath.empty()) + { + compilePdbPath = this->Target->GetSupportDirectory() + "/"; + } + } vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(pdbPath.c_str()).c_str(), cmLocalGenerator::SHELL); + vars["TARGET_COMPILE_PDB"] = + this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(compilePdbPath.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(pdbPath); + EnsureParentDirectoryExists(compilePdbPath); return true; } return false; @@ -362,6 +377,7 @@ cmNinjaTargetGenerator vars.Object = "$out"; vars.Defines = "$DEFINES"; vars.TargetPDB = "$TARGET_PDB"; + vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; cmMakefile* mf = this->GetMakefile(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a50d6adfc..7a0df745c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -74,6 +74,7 @@ struct cmTarget::ImportInfo //---------------------------------------------------------------------------- struct cmTarget::CompileInfo { + std::string CompilePdbDir; }; struct TargetConfigPair : public std::pair { @@ -275,6 +276,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0); + this->SetPropertyDefault("COMPILE_PDB_OUTPUT_DIRECTORY", 0); this->SetPropertyDefault("Fortran_FORMAT", 0); this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("GNUtoMS", 0); @@ -303,6 +305,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) "LIBRARY_OUTPUT_DIRECTORY_", "RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_", + "COMPILE_PDB_OUTPUT_DIRECTORY_", "MAP_IMPORTED_CONFIG_", 0}; for(std::vector::iterator ci = configNames.begin(); @@ -2517,6 +2520,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const if(i == this->Internal->CompileInfoMap.end()) { CompileInfo info; + this->ComputePDBOutputDir("COMPILE_PDB", config, info.CompilePdbDir); CompileInfoMapType::value_type entry(config_upper, info); i = this->Internal->CompileInfoMap.insert(entry).first; } @@ -2552,6 +2556,16 @@ std::string cmTarget::GetPDBDirectory(const char* config) const return ""; } +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBDirectory(const char* config) const +{ + if(CompileInfo const* info = this->GetCompileInfo(config)) + { + return info->CompilePdbDir; + } + return ""; +} + //---------------------------------------------------------------------------- const char* cmTarget::GetLocation(const char* config) const { @@ -3212,6 +3226,49 @@ std::string cmTarget::GetPDBName(const char* config) const return prefix+base+".pdb"; } +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBName(const char* config) const +{ + std::string prefix; + std::string base; + std::string suffix; + this->GetFullNameInternal(config, false, prefix, base, suffix); + + // Check for a per-configuration output directory target property. + std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configProp = "COMPILE_PDB_NAME_"; + configProp += configUpper; + const char* config_name = this->GetProperty(configProp.c_str()); + if(config_name && *config_name) + { + return prefix + config_name + ".pdb"; + } + + const char* name = this->GetProperty("COMPILE_PDB_NAME"); + if(name && *name) + { + return prefix + name + ".pdb"; + } + + return ""; +} + +//---------------------------------------------------------------------------- +std::string cmTarget::GetCompilePDBPath(const char* config) const +{ + std::string dir = this->GetCompilePDBDirectory(config); + std::string name = this->GetCompilePDBName(config); + if(dir.empty() && !name.empty()) + { + dir = this->GetPDBDirectory(config); + } + if(!dir.empty()) + { + dir += "/"; + } + return dir + name; +} + //---------------------------------------------------------------------------- bool cmTarget::HasSOName(const char* config) const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 678770606..a3f544c69 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -342,6 +342,12 @@ public: pdb output directory is given. */ std::string GetPDBDirectory(const char* config) const; + /** Get the directory in which to place the target compiler .pdb file. + If the configuration name is given then the generator will add its + subdirectory for that configuration. Otherwise just the canonical + compiler pdb output directory is given. */ + std::string GetCompilePDBDirectory(const char* config = 0) const; + /** Get the location of the target in the build tree for the given configuration. This location is suitable for use as the LOCATION target property. */ @@ -377,6 +383,12 @@ public: /** Get the name of the pdb file for the target. */ std::string GetPDBName(const char* config) const; + /** Get the name of the compiler pdb file for the target. */ + std::string GetCompilePDBName(const char* config=0) const; + + /** Get the path for the MSVC /Fd option for this target. */ + std::string GetCompilePDBPath(const char* config=0) const; + /** Whether this library has soname enabled and platform supports it. */ bool HasSOName(const char* config) const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ed7e243e8..b1f09741d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1427,6 +1427,17 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", "\n", "CXX"); this->WriteString("$(IntDir)\n", 3); + + // Specify the compiler program database file if configured. + std::string pdb = this->Target->GetCompilePDBPath(configName.c_str()); + if(!pdb.empty()) + { + this->ConvertToWindowsSlash(pdb); + this->WriteString("", 3); + *this->BuildFileStream << cmVS10EscapeXML(pdb) + << "\n"; + } + this->WriteString("\n", 2); } diff --git a/Tests/PDBDirectoryAndName/CMakeLists.txt b/Tests/PDBDirectoryAndName/CMakeLists.txt index 28e46b1f5..90af600fc 100644 --- a/Tests/PDBDirectoryAndName/CMakeLists.txt +++ b/Tests/PDBDirectoryAndName/CMakeLists.txt @@ -6,6 +6,13 @@ if(NOT MSVC AND NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") message(FATAL_ERROR "The PDBDirectoryAndName test works only with MSVC or Intel") endif() +# Intel 11.1 does not support /Fd but Intel 14.0 does. +# TODO: Did a version in between these add it? +if(CMAKE_C_COMPILER_ID STREQUAL Intel AND + CMAKE_C_COMPILER_VERSION VERSION_LESS 14.0) + set(NO_COMPILE_PDB 1) +endif() + set(my_targets "") add_library(mylibA SHARED mylibA.c) @@ -17,12 +24,12 @@ list(APPEND my_targets mylibA) add_library(mylibB STATIC mylibB.c) set_target_properties(mylibB PROPERTIES - PDB_NAME "mylibB_Special" - PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" + COMPILE_PDB_NAME "mylibB_Special" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mylibB_PDB" ) -# TODO: The only .pdb available for a static library is that generated -# by the compiler /Fd option which is not the same as the linker /pdb. -# list(APPEND my_targets mylibB) +if(NOT NO_COMPILE_PDB) + list(APPEND my_targets mylibB) +endif() add_library(mylibC SHARED mylibC.c) set_target_properties(mylibC PROPERTIES @@ -32,10 +39,11 @@ list(APPEND my_targets mylibC) add_library(mylibD STATIC mylibD.c) set_target_properties(mylibD PROPERTIES - PDB_NAME "mylibD_Special" + COMPILE_PDB_NAME "mylibD_Special" ) -# TODO: See comment for mylibB. -# list(APPEND my_targets mylibD) +if(NOT NO_COMPILE_PDB) + list(APPEND my_targets mylibD) +endif() add_executable(myexe myexe.c) set_target_properties(myexe PROPERTIES @@ -66,6 +74,12 @@ set(pdbs "") foreach(t ${my_targets}) get_property(pdb_name TARGET ${t} PROPERTY PDB_NAME) get_property(pdb_dir TARGET ${t} PROPERTY PDB_OUTPUT_DIRECTORY) + if(NOT pdb_name) + get_property(pdb_name TARGET ${t} PROPERTY COMPILE_PDB_NAME) + endif() + if(NOT pdb_dir) + get_property(pdb_dir TARGET ${t} PROPERTY COMPILE_PDB_OUTPUT_DIRECTORY) + endif() if(NOT pdb_dir) set(pdb_dir ${CMAKE_CURRENT_BINARY_DIR}) endif() From b94ecab6d6540512df5e7c11deb9d168566d346f Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 26 Feb 2014 10:53:53 -0700 Subject: [PATCH 041/278] FindQt4: prevent overlinking when using UseQt4.cmake. Now it only links with the Qt libraries specified by the user, instead of automatically including all dependencies. Fixes #14750 and thanks to Orion Poplawski. --- Modules/UseQt4.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake index 747831087..cba22af8c 100644 --- a/Modules/UseQt4.cmake +++ b/Modules/UseQt4.cmake @@ -98,7 +98,9 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR}) endif(QT_INCLUDE_DIRS_NO_SYSTEM) endif() - set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) + if(QT_USE_${module} OR QT_IS_STATIC) + set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY}) + endif() set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS}) if(QT_IS_STATIC) set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES}) From 71b14dcb0ad52a65331268bf72808841786bc1d2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 26 Feb 2014 13:18:38 -0500 Subject: [PATCH 042/278] Utilities/Release: Do not upload doc staging tarball Restrict the release upload globbing pattern to match the CMake version so that "cmake-*" files go but "cmake--docs.tar.gz" does not. --- Utilities/Release/upload_release.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 0d928ba63..613d73dc8 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,10 +1,10 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) -if(NOT DEFINED PROJECT_PREFIX) - set(PROJECT_PREFIX cmake-) -endif() if(NOT VERSION) set(VERSION 3.0) endif() +if(NOT DEFINED PROJECT_PREFIX) + set(PROJECT_PREFIX cmake-${VERSION}) +endif() set(dir "v${VERSION}") if("${VERSION}" MATCHES "master") set(dir "dev") From 0bba365ff5423fc51d574d17b7934e3a0148ac2e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 26 Feb 2014 21:30:18 +0100 Subject: [PATCH 043/278] Add test for find_dependency macro. --- Tests/CMakeLists.txt | 1 + Tests/Module/FindDependency/CMakeLists.txt | 10 ++++++++++ Tests/Module/FindDependency/main.cpp | 17 +++++++++++++++++ .../packages/Pack1/Pack1Config.cmake | 9 +++++++++ .../packages/Pack1/Pack1ConfigVersion.cmake | 11 +++++++++++ .../packages/Pack2/Pack2Config.cmake | 5 +++++ .../packages/Pack2/Pack2ConfigVersion.cmake | 11 +++++++++++ .../packages/Pack3/Pack3Config.cmake | 5 +++++ .../packages/Pack3/Pack3ConfigVersion.cmake | 11 +++++++++++ 9 files changed, 80 insertions(+) create mode 100644 Tests/Module/FindDependency/CMakeLists.txt create mode 100644 Tests/Module/FindDependency/main.cpp create mode 100644 Tests/Module/FindDependency/packages/Pack1/Pack1Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack1/Pack1ConfigVersion.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack2/Pack2Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack2/Pack2ConfigVersion.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack3/Pack3Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack3/Pack3ConfigVersion.cmake diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8074a01d8..c414850f3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -381,6 +381,7 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Module/ExternalData") ADD_TEST_MACRO(Module.GenerateExportHeader GenerateExportHeader) + ADD_TEST_MACRO(Module.FindDependency FindDependency) if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") include(CheckCXXCompilerFlag) diff --git a/Tests/Module/FindDependency/CMakeLists.txt b/Tests/Module/FindDependency/CMakeLists.txt new file mode 100644 index 000000000..b13f48ac8 --- /dev/null +++ b/Tests/Module/FindDependency/CMakeLists.txt @@ -0,0 +1,10 @@ + +cmake_minimum_required(VERSION 3.0) +project(FindDependency) + +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages") + +find_package(Pack1 REQUIRED) + +add_executable(FindDependency main.cpp) +target_link_libraries(FindDependency Pack1::Lib) diff --git a/Tests/Module/FindDependency/main.cpp b/Tests/Module/FindDependency/main.cpp new file mode 100644 index 000000000..d635b3131 --- /dev/null +++ b/Tests/Module/FindDependency/main.cpp @@ -0,0 +1,17 @@ + +#ifndef HAVE_PACK1 +#error Expected HAVE_PACK1 +#endif + +#ifndef HAVE_PACK2 +#error Expected HAVE_PACK2 +#endif + +#ifndef HAVE_PACK3 +#error Expected HAVE_PACK3 +#endif + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/Module/FindDependency/packages/Pack1/Pack1Config.cmake b/Tests/Module/FindDependency/packages/Pack1/Pack1Config.cmake new file mode 100644 index 000000000..ff533c2a0 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack1/Pack1Config.cmake @@ -0,0 +1,9 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack2 2.3) +find_dependency(Pack3) + +add_library(Pack1::Lib INTERFACE IMPORTED) +set_property(TARGET Pack1::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK1) +set_property(TARGET Pack1::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack2::Lib Pack3::Lib) diff --git a/Tests/Module/FindDependency/packages/Pack1/Pack1ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack1/Pack1ConfigVersion.cmake new file mode 100644 index 000000000..dfb7b6c84 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack1/Pack1ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "1.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack2/Pack2Config.cmake b/Tests/Module/FindDependency/packages/Pack2/Pack2Config.cmake new file mode 100644 index 000000000..672288ec8 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack2/Pack2Config.cmake @@ -0,0 +1,5 @@ + +set(PACK2_VAR ON) + +add_library(Pack2::Lib INTERFACE IMPORTED) +set_property(TARGET Pack2::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK2) diff --git a/Tests/Module/FindDependency/packages/Pack2/Pack2ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack2/Pack2ConfigVersion.cmake new file mode 100644 index 000000000..42f58c05b --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack2/Pack2ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "2.4") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack3/Pack3Config.cmake b/Tests/Module/FindDependency/packages/Pack3/Pack3Config.cmake new file mode 100644 index 000000000..25c32f326 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack3/Pack3Config.cmake @@ -0,0 +1,5 @@ + +set(PACK3_VAR ON) + +add_library(Pack3::Lib INTERFACE IMPORTED) +set_property(TARGET Pack3::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK3) diff --git a/Tests/Module/FindDependency/packages/Pack3/Pack3ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack3/Pack3ConfigVersion.cmake new file mode 100644 index 000000000..870f7478d --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack3/Pack3ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "1.4") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() From 0f9dbc1608969c3b2dd7e4842e338fa5f90f0b43 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 27 Feb 2014 00:01:08 -0500 Subject: [PATCH 044/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a1ae3b327..1146f8955 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140226) +set(CMake_VERSION_PATCH 20140227) #set(CMake_VERSION_RC 1) From c50325b8e55e55306fbf8bca38128303b82a51a9 Mon Sep 17 00:00:00 2001 From: Nikolay Orliuk Date: Wed, 26 Feb 2014 14:47:38 +0200 Subject: [PATCH 045/278] FindGTest: Optionally detect sources automatically (#14775) Teach GTEST_ADD_TESTS an "AUTO" option to read the source files from the SOURCES target property of an executable. --- Modules/FindGTest.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index c00a750f1..aa3c235d1 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -79,7 +79,7 @@ # extra_args = Pass a list of extra arguments to be passed to # executable enclosed in quotes (or "" for none) # ARGN = A list of source files to search for tests & test -# fixtures. +# fixtures. Or AUTO to find them from executable target. # # # @@ -88,7 +88,7 @@ # Example: # set(FooTestArgs --foo 1 --bar 2) # add_executable(FooTest FooUnitTest.cc) -# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc) +# GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO) #============================================================================= # Copyright 2009 Kitware, Inc. @@ -111,6 +111,10 @@ function(GTEST_ADD_TESTS executable extra_args) if(NOT ARGN) message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") endif() + if(ARGN STREQUAL "AUTO") + # obtain sources used for building that executable + get_property(ARGN TARGET ${executable} PROPERTY SOURCES) + endif() foreach(source ${ARGN}) file(READ "${source}" contents) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) From ac42bca8330e0501d2fbf80dbe6d4d93234ba0c0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 08:54:13 -0500 Subject: [PATCH 046/278] Help: Add FindGTest-AUTO-SOURCES topic release notes --- Help/release/dev/FindGTest-AUTO-SOURCES.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Help/release/dev/FindGTest-AUTO-SOURCES.rst diff --git a/Help/release/dev/FindGTest-AUTO-SOURCES.rst b/Help/release/dev/FindGTest-AUTO-SOURCES.rst new file mode 100644 index 000000000..17b2a1b17 --- /dev/null +++ b/Help/release/dev/FindGTest-AUTO-SOURCES.rst @@ -0,0 +1,7 @@ +FindGTest-AUTO-SOURCES +---------------------- + +* The :module:`FindGTest` module ``gtest_add_tests`` macro learned + a new ``AUTO`` option to automatically read the :prop_tgt:`SOURCES` + target property of the test executable and scan the source files + for tests to be added. From 02a74a7d9f7bd7f8abc789c980a2ecca16471b51 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 09:03:32 -0500 Subject: [PATCH 047/278] Help: Add FindHg-WC_INFO topic release notes --- Help/release/dev/FindHg-WC_INFO.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/FindHg-WC_INFO.rst diff --git a/Help/release/dev/FindHg-WC_INFO.rst b/Help/release/dev/FindHg-WC_INFO.rst new file mode 100644 index 000000000..0caf2b35e --- /dev/null +++ b/Help/release/dev/FindHg-WC_INFO.rst @@ -0,0 +1,5 @@ +FindHg-WC_INFO +-------------- + +* The :module:`FindHg` module gained a new ``Hg_WC_INFO`` macro to + help run ``hg`` to extract information about a Mercurial work copy. From 755b378e57cf859b3dc28db004b8596e44d07175 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 09:08:25 -0500 Subject: [PATCH 048/278] Help: Add ExternalProject-BUILD_ALWAYS topic release notes --- Help/release/dev/ExternalProject-BUILD_ALWAYS.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/ExternalProject-BUILD_ALWAYS.rst diff --git a/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst b/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst new file mode 100644 index 000000000..538467110 --- /dev/null +++ b/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst @@ -0,0 +1,6 @@ +ExternalProject-BUILD_ALWAYS +---------------------------- + +* The :module:`ExternalProject` module ``ExternalProject_Add`` command + learned a new ``BUILD_ALWAYS`` option to cause the external project + build step to run every time the host project is built. From 0f55f2547f45090d093a6f0871b107bf1fac4458 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 09:53:16 -0500 Subject: [PATCH 049/278] VS: For Intel Fortran .vfproj put OBJECT libs in link line (#14777) The Intel Fortran .vfproj format accepts the $(Configuration) placeholder in the path to an input file but appears to consider it always out of date. Therefore adding OBJECT library objects as external object source files causes the referencing binary to re-link on every build. Work around this problem by putting OBJECT library objects on the link line as is done for VS < 8 already. --- Source/cmLocalVisualStudio7Generator.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index ce24d8d0c..d11bf55a4 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1044,7 +1044,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, fout << "\t\t\tGetVersion() < VS8) + if(this->GetVersion() < VS8 || this->FortranProject) { cmOStringStream libdeps; this->Internal->OutputObjects(libdeps, &target); @@ -1104,7 +1104,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); - if(this->GetVersion() < VS8) + if(this->GetVersion() < VS8 || this->FortranProject) { this->Internal->OutputObjects(fout, &target, " "); } @@ -1202,7 +1202,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, // libraries which may be set by the user to something bad. fout << "\t\t\t\tAdditionalDependencies=\"$(NOINHERIT) " << this->Makefile->GetSafeDefinition(standardLibsVar.c_str()); - if(this->GetVersion() < VS8) + if(this->GetVersion() < VS8 || this->FortranProject) { this->Internal->OutputObjects(fout, &target, " "); } @@ -1423,7 +1423,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, this->WriteGroup(&sg, target, fout, libName, configs); } - if(this->GetVersion() >= VS8) + if(this->GetVersion() >= VS8 && !this->FortranProject) { // VS >= 8 support per-config source locations so we // list object library content as external objects. From c53b5cd2215a25e0661cbaf88b22664d1ec09412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Wed, 26 Feb 2014 20:48:18 +0100 Subject: [PATCH 050/278] FindPkgConfig: Prefer PKG_CONFIG to find pkg-config (#13175) If the environment variable PKG_CONFIG is set, use this as the default pkg-config executable. --- Modules/FindPkgConfig.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index e6fdefe8c..7179d17d8 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -6,6 +6,11 @@ # # # +# To find the pkg-config executable, it uses the variable +# PKG_CONFIG_EXECUTABLE or the environment variable PKG_CONFIG first. +# +# +# # Usage: # # :: @@ -134,8 +139,9 @@ # pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) #============================================================================= -# Copyright 2006-2009 Kitware, Inc. -# Copyright 2006 Enrico Scholz +# Copyright 2006-2014 Kitware, Inc. +# Copyright 2014 Christoph Grüninger +# Copyright 2006 Enrico Scholz # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -150,6 +156,10 @@ ### Common stuff #### set(PKG_CONFIG_VERSION 1) +# find pkg-config, use PKG_CONFIG if set +if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL "")) + set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable") +endif() find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) From f0f2b21d52a0c3f1799c7747f0e7f5b52410054f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 13:03:29 -0500 Subject: [PATCH 051/278] Utilities/Release: Update IBM AIX build machine access --- Utilities/Release/create-cmake-release.cmake | 2 +- ...n250_aix_release.cmake => ibm_aix_release.cmake} | 13 +++---------- Utilities/Release/release_cmake.cmake | 11 ++++------- Utilities/Release/release_cmake.sh.in | 5 ----- 4 files changed, 8 insertions(+), 23 deletions(-) rename Utilities/Release/{v20n250_aix_release.cmake => ibm_aix_release.cmake} (62%) diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 95428b6f1..841aba527 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -10,7 +10,7 @@ set(RELEASE_SCRIPTS_BATCH_1 dashmacmini2_release.cmake # Mac Darwin universal ppc;i386 dashmacmini5_release.cmake # Mac Darwin64 universal x86_64;i386 magrathea_release.cmake # Linux - v20n250_aix_release.cmake # AIX 5.3 + ibm_aix_release.cmake # AIX ferrari_sgi64_release.cmake # IRIX 64 ferrari_sgi_release.cmake # IRIX ) diff --git a/Utilities/Release/v20n250_aix_release.cmake b/Utilities/Release/ibm_aix_release.cmake similarity index 62% rename from Utilities/Release/v20n250_aix_release.cmake rename to Utilities/Release/ibm_aix_release.cmake index cc8cd058b..5a6efe612 100644 --- a/Utilities/Release/v20n250_aix_release.cmake +++ b/Utilities/Release/ibm_aix_release.cmake @@ -1,8 +1,7 @@ set(CMAKE_RELEASE_DIRECTORY "/bench1/noibm34/CMakeReleaseDirectory") -set(FINAL_PATH /u/noibm34/cmake-release) -set(PROCESSORS 2) -set(HOST "sshserv.centers.ihost.com") -set(EXTRA_HOP "rsh p90n03") +set(PROCESSORS 64) +set(HOST "ibm-backend") +set(SCRIPT_NAME aix) set(MAKE_PROGRAM "make") set(CC "xlc_r") set(CXX "xlC_r") @@ -12,11 +11,5 @@ set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE ") -set(EXTRA_COPY " -rm -rf ~/cmake-release -mkdir ~/cmake-release -mv *.sh ~/cmake-release -mv *.Z ~/cmake-release -mv *.gz ~/cmake-release") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index a8772ee91..7a1652d78 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -4,9 +4,6 @@ get_filename_component(SCRIPT_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH) if(NOT DEFINED CPACK_BINARY_GENERATORS) set(CPACK_BINARY_GENERATORS "STGZ TGZ TZ") endif() -if(DEFINED EXTRA_COPY) - set(HAS_EXTRA_COPY 1) -endif() if(NOT DEFINED CMAKE_RELEASE_DIRECTORY) set(CMAKE_RELEASE_DIRECTORY "~/CMakeReleaseDirectory") endif() @@ -55,11 +52,11 @@ message("Creating CMake release ${CMAKE_CREATE_VERSION} on ${HOST} with parallel macro(remote_command comment command) message("${comment}") if(${ARGC} GREATER 2) - message("ssh ${HOST} ${EXTRA_HOP} ${command}") - execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) + message("ssh ${HOST} ${command}") + execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result INPUT_FILE ${ARGV2}) else() - message("ssh ${HOST} ${EXTRA_HOP} ${command}") - execute_process(COMMAND ssh ${HOST} ${EXTRA_HOP} ${command} RESULT_VARIABLE result) + message("ssh ${HOST} ${command}") + execute_process(COMMAND ssh ${HOST} ${command} RESULT_VARIABLE result) endif() if(${result} GREATER 0) message(FATAL_ERROR "Error running command: ${command}, return value = ${result}") diff --git a/Utilities/Release/release_cmake.sh.in b/Utilities/Release/release_cmake.sh.in index 1f57c28e3..76fdb3a7f 100755 --- a/Utilities/Release/release_cmake.sh.in +++ b/Utilities/Release/release_cmake.sh.in @@ -155,11 +155,6 @@ done -# need to add an extra copy thing here -if [ ! -z "@EXTRA_COPY@" ]; then - @EXTRA_COPY@ - check_exit_value $? "Extra copy step @EXTRA_COPY@" || exit 1 -fi echo "End release" date echo "" From 7cd239ed38b2951e7fdd506d24a3f8e723e95b5f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 13:22:58 -0500 Subject: [PATCH 052/278] Tests/RunCMake: Tell cmake not to report unused command-line options On OS X we pass -DCMAKE_POLICY_DEFAULT_CMP0025=NEW to all tests. Once tests start using cmake_minimum_required(VERSION 3.0) then CMake will warn that CMAKE_POLICY_DEFAULT_CMP0025 is unused. These warnings are not part of the expected test output and can cause such tests to fail. Pass --no-warn-unused-cli to each test cmake invocation to tell it not to produce these warnings. --- Tests/RunCMake/RunCMake.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 1d1c523ae..ed3afc5c5 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -53,6 +53,7 @@ function(run_cmake test) -G "${RunCMake_GENERATOR}" -T "${RunCMake_GENERATOR_TOOLSET}" -DRunCMake_TEST=${test} + --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" OUTPUT_VARIABLE actual_stdout From 00503d387e60cd4ecda07c05bd501f5bb8df4f07 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Feb 2014 16:22:28 -0500 Subject: [PATCH 053/278] Watcom: Fix creation of DLLs without any exported symbols Create each DLL import library by passing "option implib=..." to the linker for its SHARED library. This works even when there are no symbols to be exported. Leave the option out for MODULE libraries because we do not need an import library for them. For executables, retain the separate invocation of wlib because we want an import library only when the ENABLE_EXPORTS property is set, and in that case the project should provide symbols. Suggested-by: J Decker --- Modules/Platform/Windows-wcl386.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 8a03b2972..d61ea4779 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -65,11 +65,10 @@ set(CMAKE_C_CREATE_PREPROCESSED_SOURCE set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} -dWIN32 -d+ -fo -pl -cc++ ${CMAKE_END_TEMP_FILE}") -set(CMAKE_CXX_CREATE_SHARED_MODULE - "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option caseexact file {} ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY - ${CMAKE_CXX_CREATE_SHARED_MODULE} - ${CMAKE_CXX_CREATE_IMPORT_LIBRARY}) + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '' option implib= option caseexact file {} ${CMAKE_END_TEMP_FILE}") +string(REPLACE " option implib=" "" + CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") # create a C shared library set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) From a3a178fcac3d141360da343e032ba6c40d2583ee Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 28 Feb 2014 00:01:06 -0500 Subject: [PATCH 054/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 1146f8955..ccc518310 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140227) +set(CMake_VERSION_PATCH 20140228) #set(CMake_VERSION_RC 1) From 4b67c4b94cc38814c4ff441b4a2f5cf792725485 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 28 Feb 2014 14:52:40 +0100 Subject: [PATCH 055/278] Remove compatibility CTest code. --- CMakeLists.txt | 2 -- CTestConfig.cmake | 5 ----- CTestCustom.ctest.in | 3 --- 3 files changed, 10 deletions(-) delete mode 100644 CTestCustom.ctest.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 761ad208e..9e1e7c344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,8 +164,6 @@ macro(CMAKE_SETUP_TESTING) ${CMake_BINARY_DIR}/Modules/.NoDartCoverage) configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY) - configure_file(${CMake_SOURCE_DIR}/CTestCustom.ctest.in - ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY) if(BUILD_TESTING AND DART_ROOT) configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 92eacd8e3..819f9ba91 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -18,8 +18,3 @@ set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_CDASH_VERSION "1.6") set(CTEST_CDASH_QUERY_VERSION TRUE) - -# use old trigger stuff so that cmake 2.4 and below will not -# get errors on trigger -set (TRIGGER_SITE - "http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi") diff --git a/CTestCustom.ctest.in b/CTestCustom.ctest.in deleted file mode 100644 index 6127843f6..000000000 --- a/CTestCustom.ctest.in +++ /dev/null @@ -1,3 +0,0 @@ -# This file is provided for compatibility with CMake 2.2 and lower. -# Just include the custom file by its new name. -INCLUDE("CTestCustom.cmake") From 1b08e6095b71aff5cf16edda125fa28191264ec7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 Feb 2014 09:18:06 -0500 Subject: [PATCH 056/278] Help: Add release notes for topic 'add-FindOpenCL' --- Help/release/dev/add-FindOpenCL.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Help/release/dev/add-FindOpenCL.rst diff --git a/Help/release/dev/add-FindOpenCL.rst b/Help/release/dev/add-FindOpenCL.rst new file mode 100644 index 000000000..e1e30d1ec --- /dev/null +++ b/Help/release/dev/add-FindOpenCL.rst @@ -0,0 +1,4 @@ +add-FindOpenCL +-------------- + +* The :module:`FindOpenCL` module was introduced. From 0a6f0280672f3b1a638cae4cf5144c1adccef754 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 26 Feb 2014 10:01:34 -0500 Subject: [PATCH 057/278] CTest: notify user if gcov cannot be found Emit an error message when we're performing coverage using gcov and the gcov executable cannot be found. --- Source/CTest/cmCTestCoverageHandler.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3c65c5563..0503d941a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -871,6 +871,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage( { std::string gcovCommand = this->CTest->GetCTestConfiguration("CoverageCommand"); + if (gcovCommand.empty()) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Could not find gcov." << std::endl); + return 0; + } std::string gcovExtraFlags = this->CTest->GetCTestConfiguration("CoverageExtraFlags"); From 80aa18b4a88d83e630acf5655025b14af0c76475 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 28 Feb 2014 09:48:20 -0500 Subject: [PATCH 058/278] Help: Add release notes for topic 'FindPkgConfig-PKG_CONFIG' --- Help/release/dev/FindPkgConfig-PKG_CONFIG.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/FindPkgConfig-PKG_CONFIG.rst diff --git a/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst b/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst new file mode 100644 index 000000000..c0f64711a --- /dev/null +++ b/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst @@ -0,0 +1,5 @@ +FindPkgConfig-PKG_CONFIG +------------------------ + +* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG`` + environment variable value as the ``pkg-config`` executable, if set. From 5c5be193cf86f86fb6e9c0c0bd4f01eb1dfa8d08 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Fri, 28 Feb 2014 18:21:52 +0100 Subject: [PATCH 059/278] Watcom: Fix static library name quoting for wlib Use double-quotes instead of single-quotes around the static library target name in 'wlib' invocations. --- Modules/Platform/Windows-wcl386.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 8a03b2972..2d5050a9d 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -40,7 +40,7 @@ set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib l set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") set(CMAKE_C_CREATE_IMPORT_LIBRARY - "wlib -c -q -n -b +''") + "wlib -c -q -n -b +") set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) set(CMAKE_C_LINK_EXECUTABLE @@ -78,7 +78,7 @@ set(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE}) # create a C++ static library -set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b '' ") +set(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -c -n -b ") # create a C static library set(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) From c0afb8867518e7b7ef17d5ce90f1a99051d2fd14 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 1 Mar 2014 00:01:10 -0500 Subject: [PATCH 060/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ccc518310..3afaf5273 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140228) +set(CMake_VERSION_PATCH 20140301) #set(CMake_VERSION_RC 1) From 378eb5b712bb8f131e62aa343e3ec27d446dc098 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sat, 1 Mar 2014 23:13:35 +0100 Subject: [PATCH 061/278] CPackWIX: Allow Windows Installer property customization --- Modules/CPackWIX.cmake | 17 ++++++++++- Modules/WIX.template.in | 2 ++ Source/CPack/WiX/cmCPackWIXGenerator.cxx | 37 ++++++++++++++++++++++++ Source/CPack/WiX/cmCPackWIXGenerator.h | 2 ++ Source/CPack/cmCPackGenerator.cxx | 6 ++++ Source/CPack/cmCPackGenerator.h | 1 + Tests/CPackWiXGenerator/CMakeLists.txt | 3 ++ 7 files changed, 67 insertions(+), 1 deletion(-) diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 39183c6e1..0a47e196f 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -216,9 +216,24 @@ # allow other CMake projects to find your package with # the :command:`find_package` command. # +# .. variable:: CPACK_WIX_PROPERTY_ +# +# This variable can be used to provide a value for +# the Windows Installer property ```` +# +# The follwing list contains some example properties that can be used to +# customize information under +# "Programs and Features" (also known as "Add or Remove Programs") +# +# * ARPCOMMENTS - Comments +# * ARPHELPLINK - Help and support information URL +# * ARPURLINFOABOUT - General information URL +# * URLUPDATEINFO - Update information URL +# * ARPHELPTELEPHONE - Help and support telephone number +# * ARPSIZE - Size (in kilobytes) of the application #============================================================================= -# Copyright 2013 Kitware, Inc. +# Copyright 2014 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/WIX.template.in b/Modules/WIX.template.in index 59a75c75b..bbb7c8831 100644 --- a/Modules/WIX.template.in +++ b/Modules/WIX.template.in @@ -40,5 +40,7 @@ + + diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 8e671ccaf..1ba43b3dd 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -215,6 +215,13 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() SetOption("CPACK_WIX_UI_REF", defaultRef.c_str()); } + const char* packageContact = GetOption("CPACK_PACKAGE_CONTACT"); + if(packageContact != 0 && + GetOption("CPACK_WIX_PROPERTY_ARPCONTACT") == 0) + { + SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact); + } + CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions); CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions); @@ -239,6 +246,7 @@ bool cmCPackWIXGenerator::PackageFilesImpl() } CreateWiXVariablesIncludeFile(); + CreateWiXPropertiesIncludeFile(); if(!CreateWiXSourceFiles()) { @@ -315,6 +323,35 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() CopyDefinition(includeFile, "CPACK_WIX_UI_REF"); } +void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() +{ + std::string includeFilename = + this->CPackTopLevel + "/properties.wxi"; + + cmWIXSourceWriter includeFile( + this->Logger, includeFilename, true); + + std::string prefix = "CPACK_WIX_PROPERTY_"; + std::vector options = GetOptions(); + + for(size_t i = 0; i < options.size(); ++i) + { + std::string const& name = options[i]; + + if(name.length() > prefix.length() && + name.substr(0, prefix.length()) == prefix) + { + std::string id = name.substr(prefix.length()); + std::string value = GetOption(name.c_str()); + + includeFile.BeginElement("Property"); + includeFile.AddAttribute("Id", id); + includeFile.AddAttribute("Value", value); + includeFile.EndElement("Property"); + } + } +} + void cmCPackWIXGenerator::CopyDefinition( cmWIXSourceWriter &source, std::string const& name) { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index ee66c05d0..4c9f8c764 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -73,6 +73,8 @@ private: void CreateWiXVariablesIncludeFile(); + void CreateWiXPropertiesIncludeFile(); + void CopyDefinition( cmWIXSourceWriter &source, std::string const& name); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96491aac0..e1dd4e983 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1201,6 +1201,12 @@ const char* cmCPackGenerator::GetOption(const char* op) const return ret; } +//---------------------------------------------------------------------- +std::vector cmCPackGenerator::GetOptions() const +{ + return this->MakefileMap->GetDefinitions(); +} + //---------------------------------------------------------------------- int cmCPackGenerator::PackageFiles() { diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index bb33aa0f1..b1a7840a2 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -102,6 +102,7 @@ public: void SetOption(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value); const char* GetOption(const char* op) const; + std::vector GetOptions() const; bool IsSet(const char* name) const; bool IsOn(const char* name) const; diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index d673d145d..9957f6b50 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -58,6 +58,9 @@ set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") +set(CPACK_WIX_PROPERTY_ARPCOMMENTS "My Custom ARPCOMMENTS") +set(CPACK_WIX_PROPERTY_ARPHELPLINK "http://www.cmake.org") + include(CPack) cpack_add_install_type(Full DISPLAY_NAME "Everything") From 642fa25da095b346d559ad39624eda79b0bd2ff8 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Sun, 2 Mar 2014 00:51:42 +0100 Subject: [PATCH 062/278] CPackWIX: support installation of empty directories --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 10 ++++++++++ Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 22 +++++++++++++++++++++ Source/CPack/WiX/cmWIXFilesSourceWriter.h | 4 ++++ Tests/CPackWiXGenerator/CMakeLists.txt | 11 +++++++++++ 4 files changed, 47 insertions(+) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 1ba43b3dd..a385e40a9 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -814,6 +814,16 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( cmsys::Directory dir; dir.Load(topdir.c_str()); + if(dir.GetNumberOfFiles() == 2) + { + std::string componentId = fileDefinitions.EmitComponentCreateFolder( + directoryId, GenerateGUID()); + + featureDefinitions.EmitComponentRef(componentId); + + return; + } + for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i) { std::string fileName = dir.GetFile(static_cast(i)); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 0835f3ade..3fd959e39 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -109,6 +109,28 @@ void cmWIXFilesSourceWriter::EmitUninstallShortcut( EndElement("Shortcut"); } +std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder( + std::string const& directoryId, std::string const& guid) +{ + std::string componentId = + std::string("CM_C_EMPTY_") + directoryId; + + BeginElement("DirectoryRef"); + AddAttribute("Id", directoryId); + + BeginElement("Component"); + AddAttribute("Id", componentId); + AddAttribute("Guid", guid); + + BeginElement("CreateFolder"); + + EndElement("CreateFolder"); + EndElement("Component"); + EndElement("DirectoryRef"); + + return componentId; +} + std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string const& directoryId, std::string const& id, diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index d22d27006..13122c269 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -45,6 +45,10 @@ public: void EmitUninstallShortcut(std::string const& packageName); + std::string EmitComponentCreateFolder( + std::string const& directoryId, + std::string const& guid); + std::string EmitComponentFile( std::string const& directoryId, std::string const& id, diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt index 9957f6b50..638e788a9 100644 --- a/Tests/CPackWiXGenerator/CMakeLists.txt +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -9,6 +9,11 @@ target_link_libraries(my-libapp mylib) add_executable(my-other-app myotherapp.cpp) +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty + DESTINATION extras + COMPONENT extras) + install(TARGETS mylib ARCHIVE DESTINATION lib @@ -72,6 +77,12 @@ cpack_add_component_group(Development EXPANDED DESCRIPTION "All of the tools you'll ever need to develop software") +cpack_add_component(extras + DISPLAY_NAME "Extras" + DESCRIPTION "Extras" + GROUP Runtime + INSTALL_TYPES Full) + cpack_add_component(applications REQUIRED DISPLAY_NAME "MyLib Application" From 115ffb0e4da65becff69e99436468a8c96cb7639 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 2 Mar 2014 00:01:09 -0500 Subject: [PATCH 063/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3afaf5273..64cc5c48e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140301) +set(CMake_VERSION_PATCH 20140302) #set(CMake_VERSION_RC 1) From ace6fa5a8b047c80cfd5c10f58446226616c1663 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 3 Mar 2014 00:01:05 -0500 Subject: [PATCH 064/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 64cc5c48e..3262d090a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140302) +set(CMake_VERSION_PATCH 20140303) #set(CMake_VERSION_RC 1) From 3816cd2dc7a7cc220e4f1b1e87fee986545b9cb3 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Feb 2014 21:47:20 -0500 Subject: [PATCH 065/278] FindPythonLibs: Find consistent Python interp, headers, libs (#13794) When possible, get consistent version of the Python interpreter, headers path, and library. Now find_package(PythonLibs) internally calls find_package(PythonInterp QUIET) and uses the resulting PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR to prefer these versions when looking for the header path and library. The Python_ADDITIONAL_VERSIONS variable has priority over the interpreter version. Co-Author: Adam Wolf Co-Author: Gert Wollny --- Modules/FindPythonLibs.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 0749efcfb..27d9e4503 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -80,10 +80,15 @@ endif() # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS - ${Python_ADDITIONAL_VERSIONS} - ${_PYTHON_FIND_OTHER_VERSIONS} - ) +# If FindPythonInterp has already found the major and minor version, +# insert that version between the user supplied versions and the stock +# version list. +find_package(PythonInterp QUIET) +set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS}) +if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR) + list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) +endif() +list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS}) unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON1_VERSIONS) From d348cd1bc50b74786d3e350a3b29aa92eeca1339 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 28 Feb 2014 17:36:38 +0100 Subject: [PATCH 066/278] FeatureSummary: Allow to combine and reorder values for the "WHAT" option For example it is now possible to do: feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) That produces an output like: -- -- The following features have been enabled: * Feature1 * Feature2 -- The following features have been disabled: * Feature2 Skipping the lists that are empty. Without this patch this would require to do: message(STATUS "") feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "The following features have been enabled:") feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:") And empty lists would not be skipped. The behaviour when WHAT has a single argument (ALL or any option) is unchanged. --- Modules/FeatureSummary.cmake | 54 +++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index c0e63d531..66965158b 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -71,6 +71,13 @@ # RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME # RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME # +# With the exception of the ``ALL`` value, these values can be combined +# in order to customize the output. For example: +# +# :: +# +# feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) +# # # # If a FILENAME is given, the information is printed into this file. If @@ -417,8 +424,8 @@ endfunction() function(FEATURE_SUMMARY) # CMAKE_PARSE_ARGUMENTS( args...) set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) - set(oneValueArgs FILENAME VAR DESCRIPTION WHAT) - set(multiValueArgs ) # none + set(oneValueArgs FILENAME VAR DESCRIPTION) + set(multiValueArgs WHAT) CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) @@ -451,20 +458,37 @@ function(FEATURE_SUMMARY) set(requiredPackagesNotFound TRUE) endif() - elseif("${_FS_WHAT}" STREQUAL "ALL") + else() + if("${_FS_WHAT}" STREQUAL "ALL") - set(allWhatParts "ENABLED_FEATURES" - "RUNTIME_PACKAGES_FOUND" - "OPTIONAL_PACKAGES_FOUND" - "RECOMMENDED_PACKAGES_FOUND" - "REQUIRED_PACKAGES_FOUND" + set(allWhatParts "ENABLED_FEATURES" + "RUNTIME_PACKAGES_FOUND" + "OPTIONAL_PACKAGES_FOUND" + "RECOMMENDED_PACKAGES_FOUND" + "REQUIRED_PACKAGES_FOUND" - "DISABLED_FEATURES" - "RUNTIME_PACKAGES_NOT_FOUND" - "OPTIONAL_PACKAGES_NOT_FOUND" - "RECOMMENDED_PACKAGES_NOT_FOUND" - "REQUIRED_PACKAGES_NOT_FOUND" - ) + "DISABLED_FEATURES" + "RUNTIME_PACKAGES_NOT_FOUND" + "OPTIONAL_PACKAGES_NOT_FOUND" + "RECOMMENDED_PACKAGES_NOT_FOUND" + "REQUIRED_PACKAGES_NOT_FOUND" + ) + + else() + set(allWhatParts) + foreach(part ${_FS_WHAT}) + list(FIND validWhatParts "${part}" indexInList) + if(NOT "${indexInList}" STREQUAL "-1") + list(APPEND allWhatParts "${part}") + else() + if("${part}" STREQUAL "ALL") + message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ALL, which cannot be combined with other values.") + else() + message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ${part}, which is not a valid value.") + endif() + endif() + endforeach() + endif() set(title_ENABLED_FEATURES "The following features have been enabled:") set(title_DISABLED_FEATURES "The following features have been disabled:") @@ -488,8 +512,6 @@ function(FEATURE_SUMMARY) endif() endif() endforeach() - else() - message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.") endif() if(_FS_FILENAME) From 8372b4553bc58c00ad3ef923919ff5547746b95e Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 3 Mar 2014 19:51:57 +0100 Subject: [PATCH 067/278] FeatureSummary: Add unit tests --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/FeatureSummary/CMakeLists.txt | 3 +++ .../FeatureSummary/FeatureSummaryWhatAll-stdout.txt | 7 +++++++ .../RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatList-stdout.txt | 7 +++++++ .../RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatListAll-result.txt | 1 + .../FeatureSummary/FeatureSummaryWhatListAll-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatListAll.cmake | 9 +++++++++ .../FeatureSummaryWhatListUnknown-result.txt | 1 + .../FeatureSummaryWhatListUnknown-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatListUnknown.cmake | 9 +++++++++ .../FeatureSummary/FeatureSummaryWhatSingle-stdout.txt | 1 + .../FeatureSummary/FeatureSummaryWhatSingle.cmake | 9 +++++++++ .../FeatureSummaryWhatSingleUnknown-result.txt | 1 + .../FeatureSummaryWhatSingleUnknown-stderr.txt | 6 ++++++ .../FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake | 9 +++++++++ Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake | 8 ++++++++ 18 files changed, 102 insertions(+) create mode 100644 Tests/RunCMake/FeatureSummary/CMakeLists.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt create mode 100644 Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake create mode 100644 Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bb097b15..c043e57fc 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -42,6 +42,7 @@ add_RunCMake_test(CompilerNotFound) add_RunCMake_test(Configure) add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) +add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) add_RunCMake_test(GeneratorExpression) add_RunCMake_test(GeneratorToolset) diff --git a/Tests/RunCMake/FeatureSummary/CMakeLists.txt b/Tests/RunCMake/FeatureSummary/CMakeLists.txt new file mode 100644 index 000000000..72abfc809 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt new file mode 100644 index 000000000..9a3f02387 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been enabled: + + \* Foo , Foo\. + +-- The following features have been disabled: + + \* Bar , Bar\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake new file mode 100644 index 000000000..ec5ebcb5f --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt new file mode 100644 index 000000000..4d8f25f5e --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList-stdout.txt @@ -0,0 +1,7 @@ +-- The following features have been disabled: + + \* Bar , Bar\. + +-- The following features have been enabled: + + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake new file mode 100644 index 000000000..d04ba885a --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatList.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT DISABLED_FEATURES ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt new file mode 100644 index 000000000..18d9ebdee --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains ALL, which cannot be + combined with other values\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListAll\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake new file mode 100644 index 000000000..1877ea5a2 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListAll.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES ALL) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt new file mode 100644 index 000000000..3ad375030 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatListUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake new file mode 100644 index 000000000..46088d417 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatListUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES FOO) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt new file mode 100644 index 000000000..240632dda --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle-stdout.txt @@ -0,0 +1 @@ + \* Foo , Foo\. diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake new file mode 100644 index 000000000..593dfb6a1 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingle.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT ENABLED_FEATURES) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt new file mode 100644 index 000000000..c78853c75 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\): + The WHAT argument of FEATURE_SUMMARY\(\) contains FOO, which is not a valid + value\. +Call Stack \(most recent call first\): + FeatureSummaryWhatSingleUnknown\.cmake:[0-9]+ \(feature_summary\) + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake new file mode 100644 index 000000000..c2d6d2ee4 --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryWhatSingleUnknown.cmake @@ -0,0 +1,9 @@ +include(FeatureSummary) + +set(WITH_FOO 1) +set(WITH_BAR 0) + +add_feature_info(Foo WITH_FOO "Foo.") +add_feature_info(Bar WITH_BAR "Bar.") + +feature_summary(WHAT FOO) diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake new file mode 100644 index 000000000..1417338ed --- /dev/null +++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(FeatureSummaryWhatAll) +run_cmake(FeatureSummaryWhatSingle) +run_cmake(FeatureSummaryWhatSingleUnknown) +run_cmake(FeatureSummaryWhatList) +run_cmake(FeatureSummaryWhatListUnknown) +run_cmake(FeatureSummaryWhatListAll) From e5096312378f97cca24f4190082b3b8991812608 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 15:25:01 -0500 Subject: [PATCH 068/278] Tests: Drop kwsys test KWSys now has its own dashboard and test clients that run on all the machines where we test CMake. We no longer need a test inside CMake to test KWSys independently. --- Tests/CMakeLists.txt | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index c414850f3..6cf5814cd 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1453,19 +1453,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ) endif() - if(NOT CMAKE_TEST_DIFFERENT_GENERATOR) - add_test(kwsys ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Source/kwsys" - "${CMake_BINARY_DIR}/Tests/kwsys" - ${build_generator_args} - --build-project kwsys - --build-options ${build_options} - --test-command kwsysTestsCxx testIOS - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys") - endif() - if(MAKE_SUPPORTS_SPACES) add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND} --build-and-test From daf0a5fedebb2dac66ac26516eeeff502ddcf432 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 12:39:10 -0500 Subject: [PATCH 069/278] Tests: Drop CMAKE_TEST_GENERATOR and CMAKE_TEST_MAKEPROGRAM options Drop the option to test with a different generator and make program than was used to build. This was used only to test support for the Open Watcom compiler which at one time could not build CMake. Instead we will allow CMake to be configured to skip building binaries and just run the test suite using an external CMake (in a future change). For now leave the two option variables hard-coded to the old option defaults until code can be updated to stop using them. --- CMakeLists.txt | 13 ++----------- Tests/CMakeLists.txt | 18 ++++++++---------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e1e7c344..4c2c20b73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,17 +114,8 @@ endif() #----------------------------------------------------------------------- macro(CMAKE_SETUP_TESTING) if(BUILD_TESTING) - set(CMAKE_TEST_GENERATOR "" CACHE STRING - "Generator used when running tests") - set(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH - "Generator used when running tests") - if(NOT CMAKE_TEST_GENERATOR) - set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") - set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") - else() - set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) - set(CMAKE_TEST_GENERATOR_TOOLSET "") - endif() + set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") + set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") # Are we testing with the MSVC compiler? set(CMAKE_TEST_MSVC 0) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6cf5814cd..fa98a2b59 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -46,16 +46,14 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing if(BUILD_TESTING) set(CMAKE_TEST_DEVENV "") - if(NOT CMAKE_TEST_DIFFERENT_GENERATOR) - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") - set(CMAKE_TEST_MAKEPROGRAM "") - else() - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") - endif() - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND - NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") - set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") - endif() + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") + set(CMAKE_TEST_MAKEPROGRAM "") + else() + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") + endif() + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND + NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") + set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) From 3c01ee5adceafb0febd9cedab9211f830f953c03 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 12:39:30 -0500 Subject: [PATCH 070/278] Tests: Drop CMAKE_TEST_MSVC and test MSVC directly Now that we no longer support running tests using a different generator we can trust the MSVC platform indicator directly. --- CMakeLists.txt | 11 ----------- Tests/CMakeLists.txt | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c2c20b73..b9f96e271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,17 +117,6 @@ macro(CMAKE_SETUP_TESTING) set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") - # Are we testing with the MSVC compiler? - set(CMAKE_TEST_MSVC 0) - if(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR) - set(CMAKE_TEST_MSVC 1) - else() - if("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio") - set(CMAKE_TEST_MSVC 1) - endif() - endif() - set(CMAKE_TEST_SYSTEM_LIBRARIES 0) foreach(util CURL EXPAT XMLRPC ZLIB) if(CMAKE_USE_SYSTEM_${util}) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fa98a2b59..9ca354dbb 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1497,12 +1497,12 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif () list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SubDir") - if(CMAKE_TEST_MSVC) + if(MSVC) ADD_TEST_MACRO(ForceInclude foo) ADD_TEST_MACRO(PDBDirectoryAndName myexe) ADD_TEST_MACRO(PrecompiledHeader foo) endif() - if(CMAKE_TEST_MSVC OR + if(MSVC OR "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") ADD_TEST_MACRO(ModuleDefinition example_exe) endif() From f99734b2da43af21b9c023d117eb3d0daba9b30e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 12:40:58 -0500 Subject: [PATCH 071/278] Tests: Rename CMAKE_TEST_DEVENV -> CMake_TEST_DEVENV Follow the convention of naming variables related to the CMake build itself as "CMake_" rather than "CMAKE_". While at it, consolidate the code computing CMake_TEST_DEVENV to be more localized. --- Tests/CMakeLists.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9ca354dbb..55e1fc4b2 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -45,16 +45,17 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing if(BUILD_TESTING) - set(CMAKE_TEST_DEVENV "") + set(CMake_TEST_DEVENV "") + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND + NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") + set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") + endif() + if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") set(CMAKE_TEST_MAKEPROGRAM "") else() set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") endif() - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND - NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") - set(CMAKE_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") - endif() if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) set(TEST_CompileCommandOutput 1) @@ -1660,7 +1661,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --test-command VSMidl) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl") - if(CMAKE_TEST_DEVENV) + if(CMake_TEST_DEVENV) # The test (and tested property) works with .sln files, so it's skipped when: # * Using VS6, which doesn't use .sln files # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file @@ -1673,7 +1674,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-config ${config} --build-two-config --build-generator ${CMAKE_TEST_GENERATOR} - --build-makeprogram ${CMAKE_TEST_DEVENV} + --build-makeprogram ${CMake_TEST_DEVENV} --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" --build-project VSExcludeFromDefaultBuild --test-command ${CMAKE_COMMAND} From 4047557379c34223f2e27a626e1a06e6702329f4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 12:46:41 -0500 Subject: [PATCH 072/278] Tests: Rename CMAKE_TEST_MAKEPROGRAM uses for nested test projects In the ExportImport, Fortran, and MacRuntimePath tests the CMAKE_TEST_MAKEPROGRAM variable is used to pass an explicit request for a CMAKE_MAKE_PROGRAM value to be used when building the inner projects. Rename these use cases to CMake_TEST_NESTED_MAKE_PROGRAM. --- Tests/CMakeLists.txt | 6 +++--- Tests/ExportImport/CMakeLists.txt | 4 ++-- Tests/ExportImport/InitialCache.cmake.in | 2 +- Tests/Fortran/CMakeLists.txt | 6 +++--- Tests/MacRuntimePath/CMakeLists.txt | 4 ++-- Tests/MacRuntimePath/InitialCache.cmake.in | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 55e1fc4b2..654b717f7 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -259,7 +259,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Assembler HelloAsm) ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(Preprocess Preprocess) - set(ExportImport_BUILD_OPTIONS -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) @@ -1405,7 +1405,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project MacRuntimePath --build-options ${build_options} - -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} + -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} ) endif() @@ -2567,7 +2567,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project testf --build-two-config --build-options ${build_options} - -DCMAKE_TEST_MAKEPROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} + -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} --test-command testf) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt index 02a0371f8..a6f892182 100644 --- a/Tests/ExportImport/CMakeLists.txt +++ b/Tests/ExportImport/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.7.20090711) project(ExportImport C CXX) -if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() # Wipe out the install tree to make sure the exporter works. diff --git a/Tests/ExportImport/InitialCache.cmake.in b/Tests/ExportImport/InitialCache.cmake.in index fba6ee236..f600d90e7 100644 --- a/Tests/ExportImport/InitialCache.cmake.in +++ b/Tests/ExportImport/InitialCache.cmake.in @@ -1,4 +1,4 @@ -set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program") +set(CMAKE_MAKE_PROGRAM "@CMake_TEST_NESTED_MAKE_PROGRAM@" CACHE FILEPATH "Make Program") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index adc4308c3..bf6d62971 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.6) project(testf C CXX Fortran) -if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() message("CTEST_FULL_OUTPUT ") @@ -208,7 +208,7 @@ if(TEST_MODULE_DEPENDS) -DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE} -DCMAKE_Fortran_FLAGS_MINSIZEREL:STRING=${CMAKE_Fortran_FLAGS_MINSIZEREL} -DCMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} - -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} + -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_NESTED_MAKE_PROGRAM} ${External_BUILD_TYPE} VERBATIM ) diff --git a/Tests/MacRuntimePath/CMakeLists.txt b/Tests/MacRuntimePath/CMakeLists.txt index 5c7b921b7..eeb3653b6 100644 --- a/Tests/MacRuntimePath/CMakeLists.txt +++ b/Tests/MacRuntimePath/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 2.8) project(MacRuntimePath) -if(NOT DEFINED CMAKE_TEST_MAKEPROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") +if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() # Wipe out the install tree to make sure the exporter works. diff --git a/Tests/MacRuntimePath/InitialCache.cmake.in b/Tests/MacRuntimePath/InitialCache.cmake.in index 3dc904126..a9f6a3c0d 100644 --- a/Tests/MacRuntimePath/InitialCache.cmake.in +++ b/Tests/MacRuntimePath/InitialCache.cmake.in @@ -1,4 +1,4 @@ -set(CMAKE_MAKE_PROGRAM "@CMAKE_TEST_MAKEPROGRAM@" CACHE FILEPATH "Make Program") +set(CMAKE_MAKE_PROGRAM "@CMake_TEST_NESTED_MAKE_PROGRAM@" CACHE FILEPATH "Make Program") set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE STRING "C Compiler") set(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" CACHE STRING "C Flags") set(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" CACHE STRING "C Flags") From a8a9fb7edd2e3631388c9e18e4700cbb12207be8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 13:58:19 -0500 Subject: [PATCH 073/278] Tests: Rename CMAKE_TEST_MAKEPROGRAM uses for explicit make program Rename uses of the variable for specifying the make program used to build test projects to CMake_TEST_EXPLICIT_MAKE_PROGRAM. --- Tests/CMakeLists.txt | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 654b717f7..b2ff3bbd5 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -51,10 +51,11 @@ if(BUILD_TESTING) set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() + set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") - set(CMAKE_TEST_MAKEPROGRAM "") + set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "") else() - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") + set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) @@ -91,8 +92,8 @@ if(BUILD_TESTING) endif() set(build_options) - if(CMAKE_TEST_MAKEPROGRAM) - list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + if(CMake_TEST_EXPLICIT_MAKE_PROGRAM) + list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) endif() add_subdirectory(CMakeLib) @@ -259,7 +260,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Assembler HelloAsm) ADD_TEST_MACRO(SourceGroups SourceGroups) ADD_TEST_MACRO(Preprocess Preprocess) - set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) ADD_TEST_MACRO(ExportImport ExportImport) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) @@ -536,9 +537,9 @@ if(BUILD_TESTING) # the bar library which should be referenced because # foo links to the static library bar, but bar is not # directly in the foo sub project - if(CMAKE_TEST_MAKEPROGRAM) + if(CMake_TEST_EXPLICIT_MAKE_PROGRAM) set(SubProject-Stage2_BUILD_MAKEPROGRAM - --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-makeprogram ${CMake_TEST_EXPLICIT_MAKE_PROGRAM} ) endif() add_test(SubProject-Stage2 ${CMAKE_CTEST_COMMAND} @@ -1405,7 +1406,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project MacRuntimePath --build-options ${build_options} - -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} + -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} ) endif() @@ -1866,8 +1867,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(CMAKE_TEST_GENERATOR_TOOLSET) list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET}) endif() - if(CMAKE_TEST_MAKEPROGRAM) - list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM}) + if(CMake_TEST_EXPLICIT_MAKE_PROGRAM) + list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) endif() configure_file("${CMake_SOURCE_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake" @ONLY) @@ -2567,7 +2568,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-project testf --build-two-config --build-options ${build_options} - -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMAKE_TEST_MAKEPROGRAM} + -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} --test-command testf) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Fortran") From 76477267bda58d10b8e00229bffd841f9e73d041 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 13:58:37 -0500 Subject: [PATCH 074/278] Tests: Drop CMAKE_TEST_MAKEPROGRAM variable Remaining uses of the variable simply test its value so use CMAKE_MAKE_PROGRAM directly instead. --- Tests/CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b2ff3bbd5..4c247fd5f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -51,7 +51,6 @@ if(BUILD_TESTING) set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() - set(CMAKE_TEST_MAKEPROGRAM "${CMAKE_MAKE_PROGRAM}") if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "") else() @@ -63,8 +62,8 @@ if(BUILD_TESTING) endif() set(MAKE_IS_GNU ) - if(CMAKE_TEST_MAKEPROGRAM MATCHES make) - execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version + if(CMAKE_MAKE_PROGRAM MATCHES make) + execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out) if("${res}" STREQUAL "0") if("${out}" MATCHES "GNU") @@ -75,7 +74,7 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR - CMAKE_TEST_MAKEPROGRAM MATCHES "nmake|gmake|wmake" OR + CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() @@ -1533,10 +1532,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # Look for evidence that this is a VCExpress build. If so, avoid # the MFC test by default. - string(TOLOWER "${CMAKE_MAKE_PROGRAM};${CMAKE_TEST_MAKEPROGRAM}" mkprog) + string(TOLOWER "${CMAKE_MAKE_PROGRAM}" mkprog) if(mkprog MATCHES "vcexpress") message(STATUS - "CMAKE_TEST_MAKEPROGRAM indicates vcexpress, avoiding MFC test") + "CMAKE_MAKE_PROGRAM indicates vcexpress, avoiding MFC test") set(CTEST_RUN_MFC OFF) endif() From 9f5bd180c8e0114ff153deeaa1690ce9eb250005 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 14:06:34 -0500 Subject: [PATCH 075/278] Tests: Drop CMAKE_TEST_GENERATOR(|_TOOLSET) variables s/CMAKE_TEST_GENERATOR/CMAKE_GENERATOR/g --- CMakeLists.txt | 5 +- Tests/CMakeBuildTest.cmake.in | 4 +- Tests/CMakeLists.txt | 84 +++++++++---------- Tests/CMakeOnly/Test.cmake.in | 4 +- .../CTestBuildCommandProjectInSubdir.cmake.in | 2 +- Tests/CTestConfig/dashboard.cmake.in | 4 +- Tests/CTestConfig/script.cmake.in | 4 +- Tests/CTestTestBadExe/test.cmake.in | 4 +- Tests/CTestTestChecksum/test.cmake.in | 4 +- .../test1.cmake.in | 4 +- .../test2.cmake.in | 4 +- Tests/CTestTestCostSerial/test.cmake.in | 4 +- Tests/CTestTestCrash/test.cmake.in | 4 +- Tests/CTestTestCycle/test.cmake.in | 4 +- Tests/CTestTestDepends/test.cmake.in | 4 +- Tests/CTestTestFailure/testNoBuild.cmake.in | 4 +- Tests/CTestTestFailure/testNoExe.cmake.in | 4 +- Tests/CTestTestFdSetSize/test.cmake.in | 4 +- Tests/CTestTestMemcheck/test.cmake.in | 4 +- Tests/CTestTestParallel/test.cmake.in | 4 +- Tests/CTestTestResourceLock/test.cmake.in | 4 +- Tests/CTestTestScheduler/test.cmake.in | 4 +- Tests/CTestTestSkipReturnCode/test.cmake.in | 4 +- Tests/CTestTestStopTime/test.cmake.in | 4 +- Tests/CTestTestSubdir/test.cmake.in | 4 +- Tests/CTestTestTimeout/test.cmake.in | 4 +- Tests/CTestTestUpload/test.cmake.in | 4 +- Tests/CTestTestZeroTimeout/test.cmake.in | 4 +- .../ExternalProjectUpdateTest.cmake | 2 +- Tests/FortranC/Flags.cmake.in | 4 +- Tests/RunCMake/CMakeLists.txt | 8 +- 31 files changed, 101 insertions(+), 104 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9f96e271..a04383885 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,9 +114,6 @@ endif() #----------------------------------------------------------------------- macro(CMAKE_SETUP_TESTING) if(BUILD_TESTING) - set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") - set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}") - set(CMAKE_TEST_SYSTEM_LIBRARIES 0) foreach(util CURL EXPAT XMLRPC ZLIB) if(CMAKE_USE_SYSTEM_${util}) @@ -547,7 +544,7 @@ endif() # add a test add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" - --system-information -G "${CMAKE_TEST_GENERATOR}" ) + --system-information -G "${CMAKE_GENERATOR}" ) # Install license file as it requires. install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) diff --git a/Tests/CMakeBuildTest.cmake.in b/Tests/CMakeBuildTest.cmake.in index 0f7074b2f..aaefe43ac 100644 --- a/Tests/CMakeBuildTest.cmake.in +++ b/Tests/CMakeBuildTest.cmake.in @@ -11,8 +11,8 @@ file(REMOVE "@CMAKE_BUILD_TEST_SOURCE_DIR@/CMakeCache.txt") message("running: ${CMAKE_COMMAND}") execute_process(COMMAND "${CMAKE_COMMAND}" "@CMAKE_BUILD_TEST_SOURCE_DIR@" - "-G@CMAKE_TEST_GENERATOR@" - -T "@CMAKE_TEST_GENERATOR_TOOLSET@" + "-G@CMAKE_GENERATOR@" + -T "@CMAKE_GENERATOR_TOOLSET@" WORKING_DIRECTORY "@CMAKE_BUILD_TEST_BINARY_DIR@" RESULT_VARIABLE RESULT) if(RESULT) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 4c247fd5f..1c7f29c07 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -46,18 +46,18 @@ configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in # Testing if(BUILD_TESTING) set(CMake_TEST_DEVENV "") - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio [7-9] " AND + if(CMAKE_GENERATOR MATCHES "Visual Studio [7-9] " AND NOT CMAKE_MAKE_PROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]") set(CMake_TEST_DEVENV "${CMAKE_MAKE_PROGRAM}") endif() - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio") + if(CMAKE_GENERATOR MATCHES "Visual Studio") set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "") else() set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() - if("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_TEST_GENERATOR}" MATCHES Ninja AND NOT WIN32)) + if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32)) set(TEST_CompileCommandOutput 1) endif() @@ -75,18 +75,18 @@ if(BUILD_TESTING) # some old versions of make simply cannot handle spaces in paths if (MAKE_IS_GNU OR CMAKE_MAKE_PROGRAM MATCHES "nmake|gmake|wmake" OR - CMAKE_TEST_GENERATOR MATCHES "Visual Studio|XCode|Borland") + CMAKE_GENERATOR MATCHES "Visual Studio|XCode|Borland") set(MAKE_SUPPORTS_SPACES 1) else() set(MAKE_SUPPORTS_SPACES 0) endif() set(build_generator_args - --build-generator ${CMAKE_TEST_GENERATOR} + --build-generator ${CMAKE_GENERATOR} ) - if(CMAKE_TEST_GENERATOR_TOOLSET) + if(CMAKE_GENERATOR_TOOLSET) list(APPEND build_generator_args - --build-generator-toolset ${CMAKE_TEST_GENERATOR_TOOLSET} + --build-generator-toolset ${CMAKE_GENERATOR_TOOLSET} ) endif() @@ -198,8 +198,8 @@ if(BUILD_TESTING) set(TEST_RESOURCES TRUE) endif() # for borland and watcom there is no resource support - if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake" OR - "${CMAKE_TEST_GENERATOR}" MATCHES "Borland") + if("${CMAKE_GENERATOR}" MATCHES "WMake" OR + "${CMAKE_GENERATOR}" MATCHES "Borland") set(TEST_RESOURCES FALSE) endif() if(TEST_RESOURCES) @@ -275,7 +275,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(CrossCompile CrossCompile) set_tests_properties(CrossCompile PROPERTIES PASS_REGULAR_EXPRESSION "TRY_RUN.. invoked in cross-compiling mode") - if("${CMAKE_TEST_GENERATOR}" MATCHES "Make") + if("${CMAKE_GENERATOR}" MATCHES "Make") ADD_TEST_MACRO(Policy0002 Policy0002) endif() if(CTEST_TEST_OSX_ARCH) @@ -314,7 +314,7 @@ if(BUILD_TESTING) MINGW OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin") - if(NOT "${CMAKE_TEST_GENERATOR}" STREQUAL "Watcom WMake") + if(NOT "${CMAKE_GENERATOR}" STREQUAL "Watcom WMake") add_test(BundleUtilities ${CMAKE_CTEST_COMMAND} --build-and-test @@ -465,7 +465,7 @@ if(BUILD_TESTING) # build the "Simple" test with the ExtraGenerators, if available # This doesn't test whether the generated project files work (unfortunately), # mainly it tests that cmake doesn't crash when generating these project files. - if(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop") + if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "KDevelop") # check which generators we have execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput) @@ -477,7 +477,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_EclipseGenerator" --build-two-config --build-generator "Eclipse CDT4 - Unix Makefiles" - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} --test-command Simple) @@ -492,7 +492,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_CodeBlocksGenerator" --build-two-config --build-generator "CodeBlocks - Unix Makefiles" - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} --test-command Simple) @@ -506,7 +506,7 @@ if(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Simple_KDevelop3Generator" --build-two-config --build-generator "KDevelop3 - Unix Makefiles" - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project Simple --build-options ${build_options} --test-command Simple) @@ -517,7 +517,7 @@ if(BUILD_TESTING) # test for correct sub-project generation # not implemented in VS 6, VS 7.0, Xcode, or Ninja - if(NOT CMAKE_TEST_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja") + if(NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]$|Xcode|Ninja") # run cmake and configure all of SubProject # but only build the independent executable car add_test(SubProject ${CMAKE_CTEST_COMMAND} @@ -545,8 +545,8 @@ if(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/SubProject/foo" "${CMake_BINARY_DIR}/Tests/SubProject/foo" - --build-generator ${CMAKE_TEST_GENERATOR} - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" ${SubProject-Stage2_BUILD_MAKEPROGRAM} --build-nocmake --build-project foo @@ -995,7 +995,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(CTEST_RUN_CMakeTestBadCommandLines) add_test(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines - -D gen=${CMAKE_TEST_GENERATOR} + -D gen=${CMAKE_GENERATOR} -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} -P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake ) @@ -1010,7 +1010,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(CTEST_RUN_CMakeTestMultipleConfigures) add_test(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND} -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures - -D gen=${CMAKE_TEST_GENERATOR} + -D gen=${CMAKE_GENERATOR} -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR} -P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake ) @@ -1233,8 +1233,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ COMMAND ${CMAKE_CMAKE_COMMAND} -DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate - -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR} - -DCMAKE_TEST_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} + -DCMAKE_GENERATOR=${CMAKE_GENERATOR} + -DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND} -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake ) @@ -1504,13 +1504,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ADD_TEST_MACRO(PrecompiledHeader foo) endif() if(MSVC OR - "${CMAKE_TEST_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") + "${CMAKE_GENERATOR}" MATCHES "(MSYS|MinGW) Makefiles") ADD_TEST_MACRO(ModuleDefinition example_exe) endif() ADD_TEST_MACRO(CheckCompilerRelatedVariables CheckCompilerRelatedVariables) - if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") + if("${CMAKE_GENERATOR}" MATCHES "Makefile") add_test(MakeClean ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/MakeClean" @@ -1556,7 +1556,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # For the Watcom WMake generator, avoid the MFC test by default. if(CTEST_RUN_MFC) - if("${CMAKE_TEST_GENERATOR}" MATCHES "WMake") + if("${CMAKE_GENERATOR}" MATCHES "WMake") message(STATUS "using the Watcom WMake generator, avoiding MFC test") set(CTEST_RUN_MFC OFF) @@ -1629,13 +1629,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/MFC") endif() - if(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") + if(${CMAKE_GENERATOR} MATCHES "Visual Studio") if(NOT MSVC60) ADD_TEST_MACRO(SBCS SBCS) endif() - if(NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [6789]( |$)" - AND NOT CMAKE_TEST_GENERATOR_TOOLSET) + if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio [6789]( |$)" + AND NOT CMAKE_GENERATOR_TOOLSET) ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx) endif() @@ -1673,9 +1673,9 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild" --build-config ${config} --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} + --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMake_TEST_DEVENV} - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project VSExcludeFromDefaultBuild --test-command ${CMAKE_COMMAND} -D "activeConfig=${config}" @@ -1691,15 +1691,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild") endif() - if(CMAKE_TEST_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])") + if(CMAKE_GENERATOR MATCHES "Visual Studio ([0-5]|[6-9][0-9])") # This is Visual Studio 10 or above, so the default build tool is MSBuild. add_test(NAME VSProjectInSubdir COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSProjectInSubdir" "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir" --build-two-config - --build-generator ${CMAKE_TEST_GENERATOR} - --build-generator-toolset "${CMAKE_TEST_GENERATOR_TOOLSET}" + --build-generator ${CMAKE_GENERATOR} + --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}" --build-project VSProjectInSubdir --build-target test) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSProjectInSubdir") @@ -1737,7 +1737,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --test-command ${CMAKE_CMAKE_COMMAND} -DCTEST_CONFIGURATION_TYPE=\${CTEST_CONFIGURATION_TYPE} -Ddir=${CMake_BINARY_DIR}/Tests/CFBundleTest - -Dgen=${CMAKE_TEST_GENERATOR} + -Dgen=${CMAKE_GENERATOR} -P ${CMake_SOURCE_DIR}/Tests/CFBundleTest/VerifyResult.cmake) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CFBundleTest") @@ -1790,7 +1790,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):") list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset") - if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile" AND NOT WIN32) + if("${CMAKE_GENERATOR}" MATCHES "Makefile" AND NOT WIN32) # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails # this test. (See #13371) # Apparently Visual Studio does not support it either. As the MakeClean @@ -1863,8 +1863,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ # A test for ctest_build() with targets in subdirectories set(ctest_configure_options) - if(CMAKE_TEST_GENERATOR_TOOLSET) - list(APPEND ctest_configure_options -T ${CMAKE_TEST_GENERATOR_TOOLSET}) + if(CMAKE_GENERATOR_TOOLSET) + list(APPEND ctest_configure_options -T ${CMAKE_GENERATOR_TOOLSET}) endif() if(CMake_TEST_EXPLICIT_MAKE_PROGRAM) list(APPEND ctest_configure_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) @@ -2206,7 +2206,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestCrash/testOutput.log" ) # with watcom the SEGFAULT is not found, it just fails - if(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake") + if(CMAKE_GENERATOR MATCHES "Watcom WMake") set_tests_properties(CTestTestCrash PROPERTIES PASS_REGULAR_EXPRESSION "Failed") else() @@ -2485,7 +2485,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log" ) - if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_TEST_GENERATOR}" MATCHES "Ninja") + if("${CMAKE_GENERATOR}" MATCHES "Makefiles" OR "${CMAKE_GENERATOR}" MATCHES "Ninja") configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES) add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND} @@ -2522,7 +2522,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif () endif () - if("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) + if("${CMAKE_GENERATOR}" MATCHES Xcode) set(CMAKE_SKIP_BOOTSTRAP_TEST 1) endif() if(EXISTS "${CMake_BINARY_DIR}/CMakeLists.txt") @@ -2594,7 +2594,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ find_package(Java COMPONENTS Development QUIET) if(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW - AND NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Xcode") + AND NOT "${CMAKE_GENERATOR}" MATCHES "Xcode") get_filename_component(JNIPATH ${JAVA_COMPILE} PATH) find_file(JNI_H jni.h "${JNIPATH}/../include" @@ -2618,7 +2618,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() # add some cross compiler tests, for now only with makefile based generators - if(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop") + if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "KDevelop") # if sdcc is found, build the SimpleCOnly project with sdcc find_program(SDCC_EXECUTABLE sdcc) diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in index a266415f7..285643ae9 100644 --- a/Tests/CMakeOnly/Test.cmake.in +++ b/Tests/CMakeOnly/Test.cmake.in @@ -8,8 +8,8 @@ file(REMOVE_RECURSE "${binary_dir}") file(MAKE_DIRECTORY "${binary_dir}") execute_process( COMMAND ${CMAKE_COMMAND} ${CMAKE_ARGS} - "${source_dir}" -G "@CMAKE_TEST_GENERATOR@" - -T "@CMAKE_TEST_GENERATOR_TOOLSET@" + "${source_dir}" -G "@CMAKE_GENERATOR@" + -T "@CMAKE_GENERATOR_TOOLSET@" WORKING_DIRECTORY "${binary_dir}" RESULT_VARIABLE result ) diff --git a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in index abf010b15..670a8745f 100644 --- a/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in +++ b/Tests/CTestBuildCommandProjectInSubdir/CTestBuildCommandProjectInSubdir.cmake.in @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.10) set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/VSProjectInSubdir") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestBuildCommandProjectInSubdir/Nested") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_PROJECT_NAME "VSProjectInSubdir") set(CTEST_BUILD_CONFIGURATION "@CTestTest_CONFIG@") diff --git a/Tests/CTestConfig/dashboard.cmake.in b/Tests/CTestConfig/dashboard.cmake.in index 0bba6d62d..608501ce8 100644 --- a/Tests/CTestConfig/dashboard.cmake.in +++ b/Tests/CTestConfig/dashboard.cmake.in @@ -18,8 +18,8 @@ endif() message("cmake initial configure") execute_process(COMMAND ${CMAKE_COMMAND} ${arg} - -G "@CMAKE_TEST_GENERATOR@" - -T "@CMAKE_TEST_GENERATOR_TOOLSET@" + -G "@CMAKE_GENERATOR@" + -T "@CMAKE_GENERATOR_TOOLSET@" ${CTEST_SOURCE_DIRECTORY} WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} RESULT_VARIABLE rv) diff --git a/Tests/CTestConfig/script.cmake.in b/Tests/CTestConfig/script.cmake.in index 83267a4d1..166de3bb2 100644 --- a/Tests/CTestConfig/script.cmake.in +++ b/Tests/CTestConfig/script.cmake.in @@ -1,5 +1,5 @@ -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_PROJECT_NAME "CTestConfig") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestConfig") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestConfig/@cfg@-script") diff --git a/Tests/CTestTestBadExe/test.cmake.in b/Tests/CTestTestBadExe/test.cmake.in index a7420fc25..601aab4d7 100644 --- a/Tests/CTestTestBadExe/test.cmake.in +++ b/Tests/CTestTestBadExe/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-BadExe") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadExe") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadExe") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestChecksum/test.cmake.in b/Tests/CTestTestChecksum/test.cmake.in index b18cdf397..84134430e 100644 --- a/Tests/CTestTestChecksum/test.cmake.in +++ b/Tests/CTestTestChecksum/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Checksum") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in index 42225d305..d3510bb96 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test1.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuild set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir1") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in index 010fe1caa..99b002caa 100644 --- a/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in +++ b/Tests/CTestTestConfigFileInBuildDir/test2.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ConfigFileInBuild set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestConfigFileInBuildDir") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestConfigFileInBuildDir2") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestCostSerial/test.cmake.in b/Tests/CTestTestCostSerial/test.cmake.in index e2dda95f3..ce8720c1c 100644 --- a/Tests/CTestTestCostSerial/test.cmake.in +++ b/Tests/CTestTestCostSerial/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-CostSerial") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCostSerial") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCostSerial") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestCrash/test.cmake.in b/Tests/CTestTestCrash/test.cmake.in index 7ac1bb9dd..5906d12f9 100644 --- a/Tests/CTestTestCrash/test.cmake.in +++ b/Tests/CTestTestCrash/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Crash") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCrash") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCrash") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestCycle/test.cmake.in b/Tests/CTestTestCycle/test.cmake.in index 94b9cac53..478badbf1 100644 --- a/Tests/CTestTestCycle/test.cmake.in +++ b/Tests/CTestTestCycle/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Cycle") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestCycle") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestCycle") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestDepends/test.cmake.in b/Tests/CTestTestDepends/test.cmake.in index 98b2a276e..a7de8ccb4 100644 --- a/Tests/CTestTestDepends/test.cmake.in +++ b/Tests/CTestTestDepends/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Depends") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestDepends") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestDepends") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestFailure/testNoBuild.cmake.in b/Tests/CTestTestFailure/testNoBuild.cmake.in index 1dee1ae53..143daf8ac 100644 --- a/Tests/CTestTestFailure/testNoBuild.cmake.in +++ b/Tests/CTestTestFailure/testNoBuild.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoBuild") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestFailure/testNoExe.cmake.in b/Tests/CTestTestFailure/testNoExe.cmake.in index 04e444da5..11a193015 100644 --- a/Tests/CTestTestFailure/testNoExe.cmake.in +++ b/Tests/CTestTestFailure/testNoExe.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-NoExe") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFailure") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFailure") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestFdSetSize/test.cmake.in b/Tests/CTestTestFdSetSize/test.cmake.in index c24f50590..fbe0e828d 100644 --- a/Tests/CTestTestFdSetSize/test.cmake.in +++ b/Tests/CTestTestFdSetSize/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-FdSetSize") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFdSetSize") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFdSetSize") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in index 6c388c52c..471e5a598 100644 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ b/Tests/CTestTestMemcheck/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_ set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestParallel/test.cmake.in b/Tests/CTestTestParallel/test.cmake.in index 5826342fa..48631caef 100644 --- a/Tests/CTestTestParallel/test.cmake.in +++ b/Tests/CTestTestParallel/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Parallel") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestParallel") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestParallel") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestResourceLock/test.cmake.in b/Tests/CTestTestResourceLock/test.cmake.in index f69b5191e..6ec6dfe42 100644 --- a/Tests/CTestTestResourceLock/test.cmake.in +++ b/Tests/CTestTestResourceLock/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ResourceLock") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestResourceLock") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestResourceLock") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in index 26d8058ce..06ba33e76 100644 --- a/Tests/CTestTestScheduler/test.cmake.in +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Scheduler") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestScheduler") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestScheduler") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestSkipReturnCode/test.cmake.in b/Tests/CTestTestSkipReturnCode/test.cmake.in index ebee01b1e..d3c44f5c6 100644 --- a/Tests/CTestTestSkipReturnCode/test.cmake.in +++ b/Tests/CTestTestSkipReturnCode/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-SkipReturnCode") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSkipReturnCode") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSkipReturnCode") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestStopTime/test.cmake.in b/Tests/CTestTestStopTime/test.cmake.in index d4e5a256f..8adf94198 100644 --- a/Tests/CTestTestStopTime/test.cmake.in +++ b/Tests/CTestTestStopTime/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-StopTime") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestStopTime") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestStopTime") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in index 2b4ef4f5c..5a6caf1c3 100644 --- a/Tests/CTestTestSubdir/test.cmake.in +++ b/Tests/CTestTestSubdir/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Subdir") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSubdir") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSubdir") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestTimeout/test.cmake.in b/Tests/CTestTestTimeout/test.cmake.in index d3d0888e9..4178849bb 100644 --- a/Tests/CTestTestTimeout/test.cmake.in +++ b/Tests/CTestTestTimeout/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Timeout") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestTimeout") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestTimeout") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/CTestTestUpload/test.cmake.in b/Tests/CTestTestUpload/test.cmake.in index 340877fea..bb6ba25a2 100644 --- a/Tests/CTestTestUpload/test.cmake.in +++ b/Tests/CTestTestUpload/test.cmake.in @@ -7,8 +7,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Upload") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestUpload") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestUpload") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") CTEST_START(Experimental) diff --git a/Tests/CTestTestZeroTimeout/test.cmake.in b/Tests/CTestTestZeroTimeout/test.cmake.in index 325275426..beb6d9085 100644 --- a/Tests/CTestTestZeroTimeout/test.cmake.in +++ b/Tests/CTestTestZeroTimeout/test.cmake.in @@ -8,8 +8,8 @@ set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout") set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout") set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout") set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index b6f848aa8..ea59a8ea8 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -12,7 +12,7 @@ macro(check_a_tag desired_tag resulting_sha fetch_expected) # Configure execute_process(COMMAND ${CMAKE_COMMAND} - -G ${CMAKE_TEST_GENERATOR} -T "${CMAKE_TEST_GENERATOR_TOOLSET}" + -G ${CMAKE_GENERATOR} -T "${CMAKE_GENERATOR_TOOLSET}" -DTEST_GIT_TAG:STRING=${desired_tag} ${ExternalProjectUpdate_SOURCE_DIR} WORKING_DIRECTORY ${ExternalProjectUpdate_BINARY_DIR} diff --git a/Tests/FortranC/Flags.cmake.in b/Tests/FortranC/Flags.cmake.in index 34363093b..28c38e400 100644 --- a/Tests/FortranC/Flags.cmake.in +++ b/Tests/FortranC/Flags.cmake.in @@ -14,8 +14,8 @@ set(COMMAND) execute_process( WORKING_DIRECTORY "${bld}" - COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_TEST_GENERATOR@" - -T "@CMAKE_TEST_GENERATOR_TOOLSET@" + COMMAND ${CMAKE_COMMAND} "${src}" -G "@CMAKE_GENERATOR@" + -T "@CMAKE_GENERATOR_TOOLSET@" "-DFortranC_TEST_FLAGS=1" "-DCMAKE_C_COMPILER=${bld}/cc.sh" "-DCMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@" diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 9bb097b15..cb44102b1 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -3,8 +3,8 @@ macro(add_RunCMake_test test) add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} - -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR} - -DRunCMake_GENERATOR_TOOLSET=${CMAKE_TEST_GENERATOR_TOOLSET} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} ${${test}_ARGS} @@ -35,7 +35,7 @@ add_RunCMake_test(CMP0046) add_RunCMake_test(CMP0049) add_RunCMake_test(CMP0050) add_RunCMake_test(CTest) -if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles") +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles") add_RunCMake_test(CompilerChange) endif() add_RunCMake_test(CompilerNotFound) @@ -105,7 +105,7 @@ if (QT4_FOUND) add_RunCMake_test(ObsoleteQtMacros) endif() -if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]") +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]") add_RunCMake_test(include_external_msproject) add_RunCMake_test(SolutionGlobalSections) endif() From 9608ef6f402bc5730dbf3276abf27b4e4b1abb2b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 15:24:03 -0500 Subject: [PATCH 076/278] Tests: Optionally configure tests exclusively, with an external CMake Add an undocumented CMake_TEST_EXTERNAL_CMAKE option to name an external CMake 'bin' directory. Skip all main CMake binary builds and instead configure the Tests directory to run using the external CMake provided. This will provide a means to exercise the CMake test suite generating for target platforms and compilers with which the CMake source does not build. That will allow us to raise the level of C++ features required of a compiler to build our source while retaining tests for generating projects with older compiler tools. --- CMakeLists.txt | 306 +++++++++++++++++++++++-------------------- Tests/CMakeLists.txt | 44 ++++--- 2 files changed, 195 insertions(+), 155 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a04383885..5f8301505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,9 @@ if(CMAKE_BOOTSTRAP) unset(CMAKE_BOOTSTRAP CACHE) endif() -set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) +endif() if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # Disallow architecture-specific try_run. It may not run on the host. @@ -102,9 +104,11 @@ endmacro() -set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) -if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) - set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) + if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) + set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) + endif() endif() @@ -126,9 +130,19 @@ macro(CMAKE_SETUP_TESTING) # the ctest from this cmake is used for testing # and not the ctest from the cmake building and testing # cmake. - set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") - set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") - set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") + if(CMake_TEST_EXTERNAL_CMAKE) + set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest") + set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake") + set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack") + foreach(exe cmake ctest cpack) + add_executable(${exe} IMPORTED) + set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe}) + endforeach() + else() + set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") + set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") + set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") + endif() endif() # configure some files for testing @@ -362,18 +376,20 @@ macro (CMAKE_BUILD_UTILITIES) endmacro () #----------------------------------------------------------------------- -if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} - ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _GXX_VERSION - ) - string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _GXX_VERSION_SHORT ${_GXX_VERSION}) - if(_GXX_VERSION_SHORT EQUAL 33) - message(FATAL_ERROR - "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" - "Please use GXX 4.2 or greater to build CMake on OpenBSD\n" - "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} + ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _GXX_VERSION + ) + string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + _GXX_VERSION_SHORT ${_GXX_VERSION}) + if(_GXX_VERSION_SHORT EQUAL 33) + message(FATAL_ERROR + "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" + "Please use GXX 4.2 or greater to build CMake on OpenBSD\n" + "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") + endif() endif() endif() @@ -392,31 +408,33 @@ include (${CMAKE_ROOT}/Modules/Dart.cmake) set_directory_properties(PROPERTIES TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") -# where to write the resulting executables and libraries -set(BUILD_SHARED_LIBS OFF) -set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") -set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL - "Where to put the libraries for CMake") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # where to write the resulting executables and libraries + set(BUILD_SHARED_LIBS OFF) + set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") + set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL + "Where to put the libraries for CMake") -# The CMake executables usually do not need any rpath to run in the build or -# install tree. -set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") + # The CMake executables usually do not need any rpath to run in the build or + # install tree. + set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") -# Load install destinations. -include(Source/CMakeInstallDestinations.cmake) + # Load install destinations. + include(Source/CMakeInstallDestinations.cmake) -if(BUILD_TESTING) - include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) + if(BUILD_TESTING) + include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) + endif() + + # include special compile flags for some compilers + include(CompileFlags.cmake) + + # no clue why we are testing for this here + include(CheckSymbolExists) + CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) + CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) endif() -# include special compile flags for some compilers -include(CompileFlags.cmake) - -# no clue why we are testing for this here -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) -CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) - # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # # If not defined or "", this variable defaults to the server at @@ -434,70 +452,73 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") endif() -# build the utilities (a macro defined in this file) -CMAKE_BUILD_UTILITIES() +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # build the utilities (a macro defined in this file) + CMAKE_BUILD_UTILITIES() -# On NetBSD ncurses is required, since curses doesn't have the wsyncup() -# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, -# which isn't in the default linker search path. So without RPATH ccmake -# doesn't run and the build doesn't succeed since ccmake is executed for -# generating the documentation. -if(BUILD_CursesDialog) - get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) - set(CURSES_NEED_RPATH FALSE) - if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") - set(CURSES_NEED_RPATH TRUE) - endif() -endif() - -if(BUILD_QtDialog) - if(APPLE) - set(CMAKE_BUNDLE_VERSION - "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") - set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") - # make sure CMAKE_INSTALL_PREFIX ends in / - string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) - math(EXPR LEN "${LEN} -1" ) - string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) - if(NOT "${ENDCH}" STREQUAL "/") - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + # On NetBSD ncurses is required, since curses doesn't have the wsyncup() + # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, + # which isn't in the default linker search path. So without RPATH ccmake + # doesn't run and the build doesn't succeed since ccmake is executed for + # generating the documentation. + if(BUILD_CursesDialog) + get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) + set(CURSES_NEED_RPATH FALSE) + if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") + set(CURSES_NEED_RPATH TRUE) endif() - set(CMAKE_INSTALL_PREFIX - "${CMAKE_INSTALL_PREFIX}CMake.app/Contents") endif() - set(QT_NEED_RPATH FALSE) - if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") - set(QT_NEED_RPATH TRUE) + if(BUILD_QtDialog) + if(APPLE) + set(CMAKE_BUNDLE_VERSION + "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") + set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") + # make sure CMAKE_INSTALL_PREFIX ends in / + string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) + math(EXPR LEN "${LEN} -1" ) + string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) + if(NOT "${ENDCH}" STREQUAL "/") + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + endif() + set(CMAKE_INSTALL_PREFIX + "${CMAKE_INSTALL_PREFIX}CMake.app/Contents") + endif() + + set(QT_NEED_RPATH FALSE) + if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") + set(QT_NEED_RPATH TRUE) + endif() endif() + + + # The same might be true on other systems for other libraries. + # Then only enable RPATH if we have are building at least with cmake 2.4, + # since this one has much better RPATH features than cmake 2.2. + # The executables are then built with the RPATH for the libraries outside + # the build tree, which is both the build and the install RPATH. + if (UNIX) + if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB + OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) + set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + endif() + endif () + + + # add the uninstall support + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + @ONLY) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + + include (CMakeCPack.cmake) + endif() - -# The same might be true on other systems for other libraries. -# Then only enable RPATH if we have are building at least with cmake 2.4, -# since this one has much better RPATH features than cmake 2.2. -# The executables are then built with the RPATH for the libraries outside -# the build tree, which is both the build and the install RPATH. -if (UNIX) - if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB - OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) - set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - endif() -endif () - - -# add the uninstall support -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - @ONLY) -add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") - -include (CMakeCPack.cmake) - # setup some Testing support (a macro defined in this file) CMAKE_SETUP_TESTING() configure_file( @@ -505,62 +526,69 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf" COPYONLY) -if(NOT CMake_VERSION_IS_RELEASE) - if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND - NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) - set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts - -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security - -Wmissing-format-attribute -fno-common -Wundef - ) - set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W - -Wshadow -Wpointer-arith -Wformat-security -Wundef - ) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(NOT CMake_VERSION_IS_RELEASE) + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND + NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) + set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts + -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security + -Wmissing-format-attribute -fno-common -Wundef + ) + set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W + -Wshadow -Wpointer-arith -Wformat-security -Wundef + ) - foreach(FLAG_LANG C CXX) - foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) - if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") - set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") - endif() + foreach(FLAG_LANG C CXX) + foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) + if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") + set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") + endif() + endforeach() endforeach() - endforeach() - unset(C_FLAGS_LIST) - unset(CXX_FLAGS_LIST) + unset(C_FLAGS_LIST) + unset(CXX_FLAGS_LIST) + endif() endif() + + # build the remaining subdirectories + add_subdirectory(Source) + add_subdirectory(Utilities) endif() -# build the remaining subdirectories -add_subdirectory(Source) -add_subdirectory(Utilities) add_subdirectory(Tests) -if(BUILD_TESTING) - CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") -endif() -CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") -if(TARGET documentation) - CMAKE_SET_TARGET_FOLDER(documentation "Documentation") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(BUILD_TESTING) + CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") + endif() + CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") + if(TARGET documentation) + CMAKE_SET_TARGET_FOLDER(documentation "Documentation") + endif() endif() # add a test add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" --system-information -G "${CMAKE_GENERATOR}" ) -# Install license file as it requires. -install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # Install license file as it requires. + install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) -# Install script directories. -install( - DIRECTORY Help Modules Templates - DESTINATION ${CMAKE_DATA_DIR} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - ) + # Install script directories. + install( + DIRECTORY Help Modules Templates + DESTINATION ${CMAKE_DATA_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + ) -# Install auxiliary files integrating with other tools. -add_subdirectory(Auxiliary) + # Install auxiliary files integrating with other tools. + add_subdirectory(Auxiliary) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1c7f29c07..854b239d6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -57,8 +57,10 @@ if(BUILD_TESTING) set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() - if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32)) - set(TEST_CompileCommandOutput 1) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32)) + set(TEST_CompileCommandOutput 1) + endif() endif() set(MAKE_IS_GNU ) @@ -95,13 +97,17 @@ if(BUILD_TESTING) list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) endif() - add_subdirectory(CMakeLib) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CMakeLib) + endif() add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) add_subdirectory(FindPackageModeMakefileTest) - add_subdirectory(CTestTestMemcheck) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CTestTestMemcheck) + endif() # Collect a list of all test build directories. set(TEST_BUILD_DIRS) @@ -248,7 +254,9 @@ if(BUILD_TESTING) ADD_TEST_MACRO(SetLang SetLang) ADD_TEST_MACRO(EmptyProperty EmptyProperty) ADD_TEST_MACRO(ExternalOBJ ExternalOBJ) - ADD_TEST_MACRO(LoadCommand LoadedCommand) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + ADD_TEST_MACRO(LoadCommand LoadedCommand) + endif() ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory) ADD_TEST_MACRO(LinkLanguage LinkLanguage) ADD_TEST_MACRO(LinkLine LinkLine) @@ -1018,16 +1026,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures") endif() - add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" - "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" - ${build_generator_args} - --build-project LoadCommand - --build-options ${build_options} - --test-command LoadedCommand - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" + "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" + ${build_generator_args} + --build-project LoadCommand + --build-options ${build_options} + --test-command LoadedCommand + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") + endif() add_test(complex ${CMAKE_CTEST_COMMAND} --build-and-test @@ -2771,5 +2781,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ WORKING_DIRECTORY ${CMake_BINARY_DIR}/Utilities/KWStyle) endif() - add_subdirectory(CMakeTests) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CMakeTests) + endif() endif() From 74b982ce734dd55a4155ba8ba0462fef894d6ec0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 4 Mar 2014 00:01:05 -0500 Subject: [PATCH 077/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3262d090a..505e7cb07 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140303) +set(CMake_VERSION_PATCH 20140304) #set(CMake_VERSION_RC 1) From 7e187eeacd609c18940aa7cd700b048f72fd5568 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 09:28:48 -0500 Subject: [PATCH 078/278] CMP0017: Fix check when including from CMake source tree When running CMake from the build tree the CMAKE_ROOT is the entire source tree. Fix the CMP0017 check to be specific to the Modules/ directory under CMAKE_ROOT so that Tests/ does not count. Fix the FindPackageTest modules to include FPHSA by full path from CMAKE_ROOT so that they do not include the local FPHSA which reports an error meant to test that CMP0017 works. --- Source/cmMakefile.cxx | 3 ++- Tests/FindPackageTest/FindLotsOfComponents.cmake | 2 +- Tests/FindPackageTest/FindSomePackage.cmake | 2 +- Tests/FindPackageTest/FindUpperCasePackage.cmake | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f248c57e7..556e7a444 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3337,7 +3337,8 @@ std::string cmMakefile::GetModulesFile(const char* filename) const if ((moduleInCMakeModulePath.size()>0) && (moduleInCMakeRoot.size()>0)) { const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE"); - if (currentFile && (strstr(currentFile, cmakeRoot) == currentFile)) + std::string mods = cmakeRoot + std::string("/Modules/"); + if (currentFile && strncmp(currentFile, mods.c_str(), mods.size()) == 0) { switch (this->GetPolicyStatus(cmPolicies::CMP0017)) { diff --git a/Tests/FindPackageTest/FindLotsOfComponents.cmake b/Tests/FindPackageTest/FindLotsOfComponents.cmake index 9076d86ed..5d959c594 100644 --- a/Tests/FindPackageTest/FindLotsOfComponents.cmake +++ b/Tests/FindPackageTest/FindLotsOfComponents.cmake @@ -4,7 +4,7 @@ set(LotsOfComponents_AComp_FOUND TRUE) set(LotsOfComponents_BComp_FOUND FALSE) set(LotsOfComponents_CComp_FOUND TRUE) -include(FindPackageHandleStandardArgs) +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(LotsOfComponents REQUIRED_VARS LOC_FOO HANDLE_COMPONENTS) diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake index 83d1d0e4d..7283d247e 100644 --- a/Tests/FindPackageTest/FindSomePackage.cmake +++ b/Tests/FindPackageTest/FindSomePackage.cmake @@ -1,6 +1,6 @@ set(SOP_FOO TRUE) -include(FindPackageHandleStandardArgs) +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO FOUND_VAR SomePackage_FOUND ) diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake index 66c2fea5b..425d41769 100644 --- a/Tests/FindPackageTest/FindUpperCasePackage.cmake +++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake @@ -1,6 +1,6 @@ set(UCP_FOO TRUE) -include(FindPackageHandleStandardArgs) +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO FOUND_VAR UPPERCASEPACKAGE_FOUND ) From 06986afc4b4708bd6ac74117474bc2738e4a20f7 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Tue, 4 Mar 2014 07:25:02 +0100 Subject: [PATCH 079/278] Help: Update CMAKE_SYSTEM* and CMAKE_HOST_SYSTEM* documentation Update to documentation for HOST/TARGET system related variables to be consistent with current functionality. --- Help/variable/CMAKE_HOST_SYSTEM.rst | 9 ++++++--- Help/variable/CMAKE_HOST_SYSTEM_NAME.rst | 5 +++-- Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst | 5 +++-- Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst | 7 ++++--- Help/variable/CMAKE_SYSTEM.rst | 11 ++++++----- Help/variable/CMAKE_SYSTEM_NAME.rst | 7 +++---- Help/variable/CMAKE_SYSTEM_PROCESSOR.rst | 6 +++--- Help/variable/CMAKE_SYSTEM_VERSION.rst | 8 ++++---- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Help/variable/CMAKE_HOST_SYSTEM.rst b/Help/variable/CMAKE_HOST_SYSTEM.rst index 4366ee36f..c2a8f1a5f 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM.rst @@ -1,7 +1,10 @@ CMAKE_HOST_SYSTEM ----------------- -Name of system cmake is being run on. +Composit Name of OS CMake is being run on. -The same as CMAKE_SYSTEM but for the host system instead of the target -system when cross compiling. +This variable is the composite of :variable:`CMAKE_HOST_SYSTEM_NAME` and +:variable:`CMAKE_HOST_SYSTEM_VERSION`, e.g. +``${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_VERSION}``. If +:variable:`CMAKE_HOST_SYSTEM_VERSION` is not set, then this variable is +the same as :variable:`CMAKE_HOST_SYSTEM_NAME`. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst index 718208aa2..a221de9c0 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_NAME.rst @@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_NAME Name of the OS CMake is running on. -The same as CMAKE_SYSTEM_NAME but for the host system instead of the -target system when cross compiling. +On systems that have the uname command, this variable is set to the +output of uname -s. ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X +are the values found on the big three operating systems. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst index 2700b66f5..790565a84 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst @@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_PROCESSOR The name of the CPU CMake is running on. -The same as CMAKE_SYSTEM_PROCESSOR but for the host system instead of -the target system when cross compiling. +On systems that support uname, this variable is set to the output of +uname -p, on windows it is set to the value of the environment variable +``PROCESSOR_ARCHITECTURE``. diff --git a/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst b/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst index a8451e835..e7e00529a 100644 --- a/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst +++ b/Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst @@ -1,7 +1,8 @@ CMAKE_HOST_SYSTEM_VERSION ------------------------- -OS version CMake is running on. +The OS version CMake is running on. -The same as CMAKE_SYSTEM_VERSION but for the host system instead of -the target system when cross compiling. +A numeric version string for the system. On systems that support +uname, this variable is set to the output of uname -r. On other +systems this is set to major-minor version numbers. diff --git a/Help/variable/CMAKE_SYSTEM.rst b/Help/variable/CMAKE_SYSTEM.rst index 283d0be14..23f598087 100644 --- a/Help/variable/CMAKE_SYSTEM.rst +++ b/Help/variable/CMAKE_SYSTEM.rst @@ -1,9 +1,10 @@ CMAKE_SYSTEM ------------ -Name of system cmake is compiling for. +Composit Name of OS CMake is compiling for. -This variable is the composite of CMAKE_SYSTEM_NAME and -CMAKE_SYSTEM_VERSION, like this -${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}. If CMAKE_SYSTEM_VERSION -is not set, then CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME. +This variable is the composite of :variable:`CMAKE_SYSTEM_NAME` and +:variable:`CMAKE_SYSTEM_VERSION`, e.g. +``${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}``. If +:variable:`CMAKE_SYSTEM_VERSION` is not set, then this variable is +the same as :variable:`CMAKE_SYSTEM_NAME`. diff --git a/Help/variable/CMAKE_SYSTEM_NAME.rst b/Help/variable/CMAKE_SYSTEM_NAME.rst index 9871dd9b1..189dc18fc 100644 --- a/Help/variable/CMAKE_SYSTEM_NAME.rst +++ b/Help/variable/CMAKE_SYSTEM_NAME.rst @@ -3,7 +3,6 @@ CMAKE_SYSTEM_NAME Name of the OS CMake is building for. -This is the name of the operating system on which CMake is targeting. -On systems that have the uname command, this variable is set to the -output of uname -s. Linux, Windows, and Darwin for Mac OS X are the -values found on the big three operating systems. +This is the name of the OS on which CMake is targeting. This variable +is the same as :variable:`CMAKE_HOST_SYSTEM_NAME` if you build for the +host system instead of the target system when cross compiling. diff --git a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst index 1655ada3c..8ad89f128 100644 --- a/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst +++ b/Help/variable/CMAKE_SYSTEM_PROCESSOR.rst @@ -3,6 +3,6 @@ CMAKE_SYSTEM_PROCESSOR The name of the CPU CMake is building for. -On systems that support uname, this variable is set to the output of -uname -p, on windows it is set to the value of the environment -variable PROCESSOR_ARCHITECTURE +This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if +you build for the host system instead of the target system when +cross compiling. diff --git a/Help/variable/CMAKE_SYSTEM_VERSION.rst b/Help/variable/CMAKE_SYSTEM_VERSION.rst index 61bb40e41..33510bbf9 100644 --- a/Help/variable/CMAKE_SYSTEM_VERSION.rst +++ b/Help/variable/CMAKE_SYSTEM_VERSION.rst @@ -1,8 +1,8 @@ CMAKE_SYSTEM_VERSION -------------------- -OS version CMake is building for. +The OS version CMake is building for. -A numeric version string for the system, on systems that support -uname, this variable is set to the output of uname -r. On other -systems this is set to major-minor version numbers. +This variable is the same as :variable:`CMAKE_HOST_SYSTEM_VERSION` if +you build for the host system instead of the target system when +cross compiling. From f096786d5428505f8313f6b01f4631f5a34b27a2 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Mon, 3 Mar 2014 08:32:13 -0500 Subject: [PATCH 080/278] KWSys 2014-03-03 (b1916e0a) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ b1916e0a | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 606d7d6f..b1916e0a Adrien Destugues (1): b1916e0a SystemInformation: Update CPU count code for Haiku Clinton Stimpson (3): 0d8ef429 Encoding: Help enforce the use of wide apis on Windows. cfbc1cc8 FStream: Remove unused basic_filebuf declaration. b3b20cc0 FStream: Add ability to detect BOM. Jiri Malak (1): e66d99b8 SystemTools: Fix compilation with Open Watcom Matt McCormick (1): b3db597b SystemInformation: Mark EXECINFO_LIB as advanced Change-Id: I154a92be7a3ec4c7c12bffbfcd7b50ec7de53c5f --- CMakeLists.txt | 6 ++ FStream.cxx | 76 ++++++++++++++++++++++ FStream.hxx.in | 21 ++++++- SharedForward.h.in | 8 +-- SystemInformation.cxx | 21 ++++++- SystemTools.cxx | 3 + testFStream.cxx | 142 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 268 insertions(+), 9 deletions(-) create mode 100644 FStream.cxx diff --git a/CMakeLists.txt b/CMakeLists.txt index 736e30afa..083d865e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -682,6 +682,7 @@ IF(KWSYS_USE_SystemInformation) # usually it's in libc but on FreeBSD # it's in libexecinfo FIND_LIBRARY(EXECINFO_LIB "execinfo") + MARK_AS_ADVANCED(EXECINFO_LIB) IF (NOT EXECINFO_LIB) SET(EXECINFO_LIB "") ENDIF() @@ -1073,6 +1074,11 @@ IF(MSVC OR (WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")) ) ENDIF() +IF(WIN32) + # Help enforce the use of wide Windows apis. + ADD_DEFINITIONS(-DUNICODE -D_UNICODE) +ENDIF() + IF(KWSYS_USE_String) # Activate code in "String.c". See the comment in the source. SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES diff --git a/FStream.cxx b/FStream.cxx new file mode 100644 index 000000000..018652c84 --- /dev/null +++ b/FStream.cxx @@ -0,0 +1,76 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#include "kwsysPrivate.h" +#include KWSYS_HEADER(FStream.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +#endif + +namespace KWSYS_NAMESPACE +{ +namespace FStream +{ + +BOM ReadBOM(std::istream& in) +{ + if(!in.good()) + { + return BOM_None; + } + unsigned long orig = in.tellg(); + unsigned char bom[4]; + in.read(reinterpret_cast(bom), 2); + if(!in.good()) + { + in.seekg(orig); + return BOM_None; + } + if(bom[0] == 0xEF && bom[1] == 0xBB) + { + in.read(reinterpret_cast(bom+2), 1); + if(in.good() && bom[2] == 0xBF) + { + return BOM_UTF8; + } + } + else if(bom[0] == 0xFE && bom[1] == 0xFF) + { + return BOM_UTF16BE; + } + else if(bom[0] == 0x00 && bom[1] == 0x00) + { + in.read(reinterpret_cast(bom+2), 2); + if(in.good() && bom[2] == 0xFE && bom[3] == 0xFF) + { + return BOM_UTF32BE; + } + } + else if(bom[0] == 0xFF && bom[1] == 0xFE) + { + unsigned long p = in.tellg(); + in.read(reinterpret_cast(bom+2), 2); + if(in.good() && bom[2] == 0x00 && bom[3] == 0x00) + { + return BOM_UTF32LE; + } + in.seekg(p); + return BOM_UTF16LE; + } + in.seekg(orig); + return BOM_None; +} + +} // FStream namespace +} //KWSYS_NAMESPACE diff --git a/FStream.hxx.in b/FStream.hxx.in index 916a93eba..45425ffd6 100644 --- a/FStream.hxx.in +++ b/FStream.hxx.in @@ -161,13 +161,28 @@ class basic_ofstream : public std::basic_ostream typedef basic_ofstream ofstream; #else - using @KWSYS_NAMESPACE@_ios_namespace::basic_filebuf; using @KWSYS_NAMESPACE@_ios_namespace::ofstream; using @KWSYS_NAMESPACE@_ios_namespace::ifstream; #endif + namespace FStream + { + enum BOM + { + BOM_None, + BOM_UTF8, + BOM_UTF16BE, + BOM_UTF16LE, + BOM_UTF32BE, + BOM_UTF32LE + }; + + // Read a BOM, if one exists. + // If a BOM exists, the stream is advanced to after the BOM. + // This function requires a seekable stream (but not a relative + // seekable stream). + BOM ReadBOM(std::istream& in); + } } - - #endif diff --git a/SharedForward.h.in b/SharedForward.h.in index 8bbc74ac2..dd4d462a5 100644 --- a/SharedForward.h.in +++ b/SharedForward.h.in @@ -415,7 +415,7 @@ static int kwsys_shared_forward_realpath(const char* in_path, char* out_path) { #if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ - DWORD n = GetFullPathName(in_path, KWSYS_SHARED_FORWARD_MAXPATH, + DWORD n = GetFullPathNameA(in_path, KWSYS_SHARED_FORWARD_MAXPATH, out_path, 0); return n > 0 && n <= KWSYS_SHARED_FORWARD_MAXPATH; #else @@ -429,9 +429,9 @@ static int kwsys_shared_forward_samepath(const char* file1, const char* file2) { #if defined(_WIN32) int result = 0; - HANDLE h1 = CreateFile(file1, GENERIC_READ, FILE_SHARE_READ, NULL, + HANDLE h1 = CreateFileA(file1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - HANDLE h2 = CreateFile(file2, GENERIC_READ, FILE_SHARE_READ, NULL, + HANDLE h2 = CreateFileA(file2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if(h1 != INVALID_HANDLE_VALUE && h2 != INVALID_HANDLE_VALUE) { @@ -462,7 +462,7 @@ static void kwsys_shared_forward_strerror(char* message) #if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ DWORD original = GetLastError(); - DWORD length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + DWORD length = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, original, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), message, KWSYS_SHARED_FORWARD_MAXPATH, 0); diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 5f20853fb..9c2638028 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -4698,11 +4698,28 @@ bool SystemInformationImplementation::QueryHaikuInfo() { #if defined(__HAIKU__) + // CPU count system_info info; get_system_info(&info); - this->NumberOfPhysicalCPU = info.cpu_count; - this->CPUSpeedInMHz = info.cpu_clock_speed / 1000000.0F; + + // CPU speed + uint32 topologyNodeCount = 0; + cpu_topology_node_info* topology = 0; + get_cpu_topology_info(0, &topologyNodeCount); + if (topologyNodeCount != 0) + topology = new cpu_topology_node_info[topologyNodeCount]; + get_cpu_topology_info(topology, &topologyNodeCount); + + for (uint32 i = 0; i < topologyNodeCount; i++) { + if (topology[i].type == B_TOPOLOGY_CORE) { + this->CPUSpeedInMHz = topology[i].data.core.default_frequency / + 1000000.0f; + break; + } + } + + delete[] topology; // Physical Memory this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ; diff --git a/SystemTools.cxx b/SystemTools.cxx index f4a443f98..b6a243706 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -188,6 +188,9 @@ static inline char *realpath(const char *path, char *resolved_path) #endif #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include + inline int Mkdir(const char* dir) { return _wmkdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); diff --git a/testFStream.cxx b/testFStream.cxx index 89425490b..9abfd4caa 100644 --- a/testFStream.cxx +++ b/testFStream.cxx @@ -16,11 +16,17 @@ #endif #include KWSYS_HEADER(FStream.hxx) +#include KWSYS_HEADER(ios/iostream) +#include +#ifdef __BORLANDC__ +# include /* memcmp */ +#endif // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "FStream.hxx.in" +# include "kwsys_ios_iostream.h.in" #endif @@ -36,6 +42,141 @@ static int testNoFile() return 0; } +static kwsys::FStream::BOM expected_bom[5] = +{ + kwsys::FStream::BOM_UTF8, + kwsys::FStream::BOM_UTF16LE, + kwsys::FStream::BOM_UTF16BE, + kwsys::FStream::BOM_UTF32LE, + kwsys::FStream::BOM_UTF32BE +}; + +static unsigned char expected_bom_data[5][5] = +{ + {3, 0xEF, 0xBB, 0xBF}, + {2, 0xFF, 0xFE}, + {2, 0xFE, 0xFF}, + {4, 0xFF, 0xFE, 0x00, 0x00}, + {4, 0x00, 0x00, 0xFE, 0xFF}, +}; + +static unsigned char file_data[5][45] = +{ + {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, + {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, + 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00}, + {22, 0x00, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, + 0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64}, + {44, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, + 0x6C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00}, + {44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C, + 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72, + 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x64}, +}; + +//---------------------------------------------------------------------------- +static int testBOM() +{ + // test various encodings in binary mode + for(int i=0; i<5; i++) + { + { + kwsys::ofstream out("bom.txt", kwsys::ofstream::binary); + out.write(reinterpret_cast(expected_bom_data[i]+1), + *expected_bom_data[i]); + out.write(reinterpret_cast(file_data[i]+1), + file_data[i][0]); + } + + kwsys::ifstream in("bom.txt", kwsys::ofstream::binary); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != expected_bom[i]) + { + kwsys_ios::cout << "Unexpected BOM " << i << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[i][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data " << i << std::endl; + return 1; + } + + if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data " << i << std::endl; + return 1; + } + + } + + // test text file without bom + { + { + kwsys::ofstream out("bom.txt"); + out << "Hello World"; + } + + kwsys::ifstream in("bom.txt"); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != kwsys::FStream::BOM_None) + { + kwsys_ios::cout << "Unexpected BOM for none case" << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[0][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data for none case" << std::endl; + return 1; + } + + if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data for none case" << std::endl; + return 1; + } + } + + // test text file with utf-8 bom + { + { + kwsys::ofstream out("bom.txt"); + out.write(reinterpret_cast(expected_bom_data[0]+1), + *expected_bom_data[0]); + out << "Hello World"; + } + + kwsys::ifstream in("bom.txt"); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != kwsys::FStream::BOM_UTF8) + { + kwsys_ios::cout << "Unexpected BOM for utf-8 case" << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[0][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data for utf-8 case" << std::endl; + return 1; + } + + if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data for utf-8 case" << std::endl; + return 1; + } + } + + return 0; +} + //---------------------------------------------------------------------------- int testFStream(int, char*[]) @@ -43,6 +184,7 @@ int testFStream(int, char*[]) int ret = 0; ret |= testNoFile(); + ret |= testBOM(); return ret; } From c87517099abbef70b9718a3920954e9097f36bbe Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 11:20:27 -0500 Subject: [PATCH 081/278] Makefile: Factor out some duplicate link libraries generation The generators for executable and library targets duplicate the logic to call the OutputLinkLibraries helper on the local generator. Factor it out into a cmMakefileTargetGenerator::CreateLinkLibs method to avoid dpulication. --- Source/cmMakefileExecutableTargetGenerator.cxx | 8 ++------ Source/cmMakefileLibraryTargetGenerator.cxx | 7 +------ Source/cmMakefileTargetGenerator.cxx | 14 ++++++++++++++ Source/cmMakefileTargetGenerator.h | 4 ++++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 03fdda246..696ce9414 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -325,12 +325,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Collect up flags to link in needed libraries. std::string linkLibs; - std::string frameworkPath; - std::string linkPath; - this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *this->GeneratorTarget, - relink); - linkLibs = frameworkPath + linkPath + linkLibs; + this->CreateLinkLibs(linkLibs, relink, depends); + // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 807aca8f6..28325156d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -546,12 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string linkLibs; if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { - std::string frameworkPath; - std::string linkPath; - this->LocalGenerator - ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *this->GeneratorTarget, relink); - linkLibs = frameworkPath + linkPath + linkLibs; + this->CreateLinkLibs(linkLibs, relink, depends); } // Construct object file lists that may be needed to expand the diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e8a9fd1c0..e5b163b41 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1830,6 +1830,20 @@ cmMakefileTargetGenerator return responseFileName; } +//---------------------------------------------------------------------------- +void +cmMakefileTargetGenerator +::CreateLinkLibs(std::string& linkLibs, bool relink, + std::vector& makefile_depends) +{ + std::string frameworkPath; + std::string linkPath; + this->LocalGenerator + ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, + *this->GeneratorTarget, relink); + linkLibs = frameworkPath + linkPath + linkLibs; +} + //---------------------------------------------------------------------------- void cmMakefileTargetGenerator diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 4f8fafacd..d47708d25 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -163,6 +163,10 @@ protected: std::string const& options, std::vector& makefile_depends); + /** Create list of flags for link libraries. */ + void CreateLinkLibs(std::string& linkLibs, bool relink, + std::vector& makefile_depends); + /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, From 02bebd60e9255b6e3eb4bbd6208b4c5cd8f5da40 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 12:57:44 -0500 Subject: [PATCH 082/278] cmLocalGenerator: Add format option to ConvertToOutputForExisting Replace the hard-coded SHELL output format with an optional argument. --- Source/cmLocalGenerator.cxx | 19 +++++++++++-------- Source/cmLocalGenerator.h | 9 ++++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4266dd061..87685d50a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1228,7 +1228,8 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, - std::string const& result) + std::string const& result, + OutputFormat format) { // If this is a windows shell, the result has a space, and the path // already exists, we can use a short-path to reference it without a @@ -1239,7 +1240,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, std::string tmp; if(cmSystemTools::GetShortPath(remote, tmp)) { - return this->Convert(tmp.c_str(), NONE, SHELL, true); + return this->Convert(tmp.c_str(), NONE, format, true); } } @@ -1250,26 +1251,28 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToOutputForExisting(const char* remote, - RelativeRoot local) + RelativeRoot local, + OutputFormat format) { // Perform standard conversion. - std::string result = this->Convert(remote, local, SHELL, true); + std::string result = this->Convert(remote, local, format, true); // Consider short-path. - return this->ConvertToOutputForExistingCommon(remote, result); + return this->ConvertToOutputForExistingCommon(remote, result, format); } //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, - const char* local) + const char* local, + OutputFormat format) { // Perform standard conversion. - std::string result = this->Convert(remote, local, SHELL, true); + std::string result = this->Convert(remote, local, format, true); // Consider short-path. const char* remotePath = this->GetRelativeRootPath(remote); - return this->ConvertToOutputForExistingCommon(remotePath, result); + return this->ConvertToOutputForExistingCommon(remotePath, result, format); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 0f7fd253b..9e47120bb 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -198,12 +198,14 @@ public: ///! for existing files convert to output path and short path if spaces std::string ConvertToOutputForExisting(const char* remote, - RelativeRoot local = START_OUTPUT); + RelativeRoot local = START_OUTPUT, + OutputFormat format = SHELL); /** For existing path identified by RelativeRoot convert to output path and short path if spaces. */ std::string ConvertToOutputForExisting(RelativeRoot remote, - const char* local = 0); + const char* local = 0, + OutputFormat format = SHELL); virtual std::string ConvertToIncludeReference(std::string const& path); @@ -465,7 +467,8 @@ protected: bool BackwardsCompatibilityFinal; private: std::string ConvertToOutputForExistingCommon(const char* remote, - std::string const& result); + std::string const& result, + OutputFormat format); void AddSharedFlags(std::string& flags, const char* lang, bool shared); bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; From 0c0ef9e7b7016f8ce6310c30660151b15e062a93 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:04:02 -0500 Subject: [PATCH 083/278] cmLocalGenerator: Add format option to ConvertToIncludeReference Replace the hard-coded SHELL output format with an optional argument. --- Source/cmLocalGenerator.cxx | 5 +++-- Source/cmLocalGenerator.h | 3 ++- Source/cmLocalNinjaGenerator.cxx | 5 +++-- Source/cmLocalNinjaGenerator.h | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 87685d50a..2090cc6a2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1277,9 +1277,10 @@ cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToIncludeReference(std::string const& path) +cmLocalGenerator::ConvertToIncludeReference(std::string const& path, + OutputFormat format) { - return this->ConvertToOutputForExisting(path.c_str()); + return this->ConvertToOutputForExisting(path.c_str(), START_OUTPUT, format); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9e47120bb..986f40556 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -207,7 +207,8 @@ public: const char* local = 0, OutputFormat format = SHELL); - virtual std::string ConvertToIncludeReference(std::string const& path); + virtual std::string ConvertToIncludeReference(std::string const& path, + OutputFormat format = SHELL); /** Called from command-line hook to clear dependencies. */ virtual void ClearDependencies(cmMakefile* /* mf */, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index cd12c9d13..c989cfb0e 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -149,9 +149,10 @@ cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib) } std::string -cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path) +cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path, + OutputFormat format) { - return this->Convert(path.c_str(), HOME_OUTPUT, SHELL); + return this->Convert(path.c_str(), HOME_OUTPUT, format); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index ea854c61e..b3d3b6b49 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -101,7 +101,8 @@ public: protected: - virtual std::string ConvertToIncludeReference(std::string const& path); + virtual std::string ConvertToIncludeReference(std::string const& path, + OutputFormat format = SHELL); private: From 971653b767f2e5e81085c525c94d5e596474aa88 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:06:29 -0500 Subject: [PATCH 084/278] cmLocalGenerator: Add format option to ConvertToLinkReference Replace the hard-coded SHELL output format with an optional argument. --- Source/cmLocalGenerator.cxx | 7 ++++--- Source/cmLocalGenerator.h | 3 ++- Source/cmLocalNinjaGenerator.cxx | 5 +++-- Source/cmLocalNinjaGenerator.h | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2090cc6a2..1372c2ae2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1759,7 +1759,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } -std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) +std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, + OutputFormat format) { #if defined(_WIN32) && !defined(__CYGWIN__) // Work-ardound command line parsing limitations in MSVC 6.0 and @@ -1781,14 +1782,14 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) sp += lib.substr(pos); // Convert to an output path. - return this->Convert(sp.c_str(), NONE, SHELL); + return this->Convert(sp.c_str(), NONE, format); } } } #endif // Normal behavior. - return this->Convert(lib.c_str(), START_OUTPUT, SHELL); + return this->Convert(lib.c_str(), START_OUTPUT, format); } /** diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 986f40556..2a761245d 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -415,7 +415,8 @@ protected: std::string FindRelativePathTopBinary(); void SetupPathConversions(); - virtual std::string ConvertToLinkReference(std::string const& lib); + virtual std::string ConvertToLinkReference(std::string const& lib, + OutputFormat format = SHELL); /** Check whether the native build system supports the given definition. Issues a warning. */ diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index c989cfb0e..862823fe7 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -143,9 +143,10 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator() // Virtual protected methods. std::string -cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib) +cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib, + OutputFormat format) { - return this->Convert(lib.c_str(), HOME_OUTPUT, SHELL); + return this->Convert(lib.c_str(), HOME_OUTPUT, format); } std::string diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index b3d3b6b49..8b26806ee 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -97,7 +97,8 @@ public: void AppendCustomCommandDeps(const cmCustomCommand *cc, cmNinjaDeps &ninjaDeps); - virtual std::string ConvertToLinkReference(std::string const& lib); + virtual std::string ConvertToLinkReference(std::string const& lib, + OutputFormat format = SHELL); protected: From b9aa5041989a415a360e61291142e760ae7eb9e1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:12:54 -0500 Subject: [PATCH 085/278] cmLocalGenerator: Simplify GetIncludeFlags output formatting Use the output format argument to ConvertToIncludeReference. --- Source/cmLocalGenerator.cxx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1372c2ae2..aa64e80c7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1295,6 +1295,7 @@ std::string cmLocalGenerator::GetIncludeFlags( return ""; } + OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL; cmOStringStream includeFlags; std::string flagVar = "CMAKE_INCLUDE_FLAG_"; @@ -1354,10 +1355,9 @@ std::string cmLocalGenerator::GetIncludeFlags( frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); if(emitted.insert(frameworkDir).second) { - OutputFormat format = forResponseFile? RESPONSE : SHELL; includeFlags << fwSearchFlag << this->Convert(frameworkDir.c_str(), - START_OUTPUT, format, true) + START_OUTPUT, shellFormat, true) << " "; } continue; @@ -1376,16 +1376,8 @@ std::string cmLocalGenerator::GetIncludeFlags( } flagUsed = true; } - std::string includePath; - if(forResponseFile) - { - includePath = this->Convert(i->c_str(), START_OUTPUT, - RESPONSE, true); - } - else - { - includePath = this->ConvertToIncludeReference(*i); - } + std::string includePath = + this->ConvertToIncludeReference(*i, shellFormat); if(quotePaths && includePath.size() && includePath[0] != '\"') { includeFlags << "\""; From 5e8e4d0f8819052d3a69eb3cb1a4bdbc674a956c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:20:04 -0500 Subject: [PATCH 086/278] cmLocalGenerator: Add response file option to OutputLinkLibraries Response files require different path conversion to be threaded through construction of the link libraries flags. --- Source/cmLocalGenerator.cxx | 23 ++++++++++++++--------- Source/cmLocalGenerator.h | 3 ++- Source/cmMakefileTargetGenerator.cxx | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index aa64e80c7..b86a956d4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1671,7 +1671,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false); + *target, false, false); } break; case cmTarget::EXECUTABLE: @@ -1696,7 +1696,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false); + *target, false, false); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { @@ -1793,8 +1793,11 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget &tgt, - bool relink) + bool relink, + bool forResponseFile) { + OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL; + bool escapeAllowMakeVars = !forResponseFile; cmOStringStream fout; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); @@ -1837,7 +1840,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, fdi != fwDirs.end(); ++fdi) { frameworkPath += fwSearchFlag; - frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false); + frameworkPath += this->Convert(fdi->c_str(), NONE, shellFormat, false); frameworkPath += " "; } } @@ -1847,7 +1850,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, for(std::vector::const_iterator libDir = libDirs.begin(); libDir != libDirs.end(); ++libDir) { - std::string libpath = this->ConvertToOutputForExisting(libDir->c_str()); + std::string libpath = this->ConvertToOutputForExisting(libDir->c_str(), + START_OUTPUT, + shellFormat); linkPath += " " + libPathFlag; linkPath += libpath; linkPath += libPathTerminator; @@ -1865,7 +1870,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, } if(li->IsPath) { - linkLibs += this->ConvertToLinkReference(li->Value); + linkLibs += this->ConvertToLinkReference(li->Value, shellFormat); } else { @@ -1890,7 +1895,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, ri != runtimeDirs.end(); ++ri) { rpath += cli.GetRuntimeFlag(); - rpath += this->Convert(ri->c_str(), NONE, SHELL, false); + rpath += this->Convert(ri->c_str(), NONE, shellFormat, false); rpath += " "; } fout << rpath; @@ -1904,7 +1909,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!rpath.empty()) { fout << cli.GetRuntimeFlag(); - fout << this->EscapeForShell(rpath.c_str(), true); + fout << this->EscapeForShell(rpath.c_str(), escapeAllowMakeVars); fout << " "; } } @@ -1914,7 +1919,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { fout << cli.GetRPathLinkFlag(); - fout << this->EscapeForShell(rpath_link.c_str(), true); + fout << this->EscapeForShell(rpath_link.c_str(), escapeAllowMakeVars); fout << " "; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2a761245d..2e0580446 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -372,7 +372,8 @@ protected: std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget &, - bool relink); + bool relink, + bool forResponseFile); // Expand rule variables in CMake of the type found in language rules void ExpandRuleVariables(std::string& string, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e5b163b41..0f2b6e371 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1840,7 +1840,7 @@ cmMakefileTargetGenerator std::string linkPath; this->LocalGenerator ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *this->GeneratorTarget, relink); + *this->GeneratorTarget, relink, false); linkLibs = frameworkPath + linkPath + linkLibs; } From b052902c32190f6c10c703ab07310a91fa50d46a Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 3 Mar 2014 21:36:09 +0100 Subject: [PATCH 087/278] Remove hard-coded version of RTDLL for Open Watcom In InstallRequiredSystemLibraries the version number for RTDLL can be calculated from the compiler version. This will support current and future OW versions without updating the module again. --- Modules/InstallRequiredSystemLibraries.cmake | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 013a028b4..7e68e8fda 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -366,18 +366,22 @@ endif() if(WATCOM) get_filename_component( CompilerPath ${CMAKE_C_COMPILER} PATH ) - if(WATCOM17) - set( __install__libs ${CompilerPath}/clbr17.dll - ${CompilerPath}/mt7r17.dll ${CompilerPath}/plbr17.dll ) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) endif() - if(WATCOM18) - set( __install__libs ${CompilerPath}/clbr18.dll - ${CompilerPath}/mt7r18.dll ${CompilerPath}/plbr18.dll ) - endif() - if(WATCOM19) - set( __install__libs ${CompilerPath}/clbr19.dll - ${CompilerPath}/mt7r19.dll ${CompilerPath}/plbr19.dll ) + string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}") + list(GET _watcom_version_list 0 _watcom_major) + list(GET _watcom_version_list 1 _watcom_minor) + if(${_watcom_major} GREATER 11) + math(EXPR _watcom_major "${_watcom_major} - 11") endif() + math(EXPR _watcom_minor "${_watcom_minor} / 10") + set( __install__libs + ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll + ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll + ${CompilerPath}/plbr${_watcom_major}${_watcom_minor}.dll ) foreach(lib ${__install__libs} ) From ea95e3eae32b35711e23de30b4cbdb5ad2bd930a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 5 Mar 2014 00:01:06 -0500 Subject: [PATCH 088/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 505e7cb07..66c8761bf 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140304) +set(CMake_VERSION_PATCH 20140305) #set(CMake_VERSION_RC 1) From 745caae6dddc9ab5c38a669adf3906f6e3484c80 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:21:15 -0500 Subject: [PATCH 089/278] Makefile: Rename linker response file boolean to be more specific Rename local variable useResponseFile to useResponseFileForObjects when it represents CMAKE__USE_RESPONSE_FILE_FOR_OBJECTS. --- Source/cmMakefileExecutableTargetGenerator.cxx | 8 ++++---- Source/cmMakefileLibraryTargetGenerator.cxx | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 696ce9414..6754525f3 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -307,14 +307,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } // Select whether to use a response file for objects. - bool useResponseFile = false; + bool useResponseFileForObjects = false; { std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; if(this->Makefile->IsOn(responseVar.c_str())) { - useResponseFile = true; + useResponseFileForObjects = true; } } @@ -330,8 +330,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; - this->CreateObjectLists(useLinkScript, false, useResponseFile, - buildObjs, depends); + this->CreateObjectLists(useLinkScript, false, + useResponseFileForObjects, buildObjs, depends); cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 28325156d..c639f3e58 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -474,14 +474,14 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules bool useLinkScript = this->GlobalGenerator->GetUseLinkScript(); // Select whether to use a response file for objects. - bool useResponseFile = false; + bool useResponseFileForObjects = false; { std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; if(this->Makefile->IsOn(responseVar.c_str())) { - useResponseFile = true; + useResponseFileForObjects = true; } } @@ -528,7 +528,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules useLinkScript = true; // Archiving rules never use a response file. - useResponseFile = false; + useResponseFileForObjects = false; // Limit the length of individual object lists to less than the // 32K command line length limit on Windows. We could make this a @@ -552,8 +552,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Construct object file lists that may be needed to expand the // rule. std::string buildObjs; - this->CreateObjectLists(useLinkScript, useArchiveRules, useResponseFile, - buildObjs, depends); + this->CreateObjectLists(useLinkScript, useArchiveRules, + useResponseFileForObjects, buildObjs, depends); cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); From 4da09d1a3f1541f075ce9614b9b7bd0cabbd800c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 5 Mar 2014 11:20:28 -0500 Subject: [PATCH 090/278] Help: Add release notes for topic 'FeatureSummary_combine_WHAT_values' --- Help/release/dev/FeatureSummary_combine_WHAT_values.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/FeatureSummary_combine_WHAT_values.rst diff --git a/Help/release/dev/FeatureSummary_combine_WHAT_values.rst b/Help/release/dev/FeatureSummary_combine_WHAT_values.rst new file mode 100644 index 000000000..174ef15cd --- /dev/null +++ b/Help/release/dev/FeatureSummary_combine_WHAT_values.rst @@ -0,0 +1,6 @@ +FeatureSummary_combine_WHAT_values +---------------------------------- + +* The :module:`FeatureSummary` module ``feature_summary`` API + learned to accept multiple values for the ``WHAT`` option and + combine them appropriately. From bf28ff1f422407f10ecc283f03ce8c5ee57f1812 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 5 Mar 2014 11:57:00 -0500 Subject: [PATCH 091/278] FindPythonLibs: Do not try to find the interpreter (#13794) The parent commit taught FindPythonLibs to try to find PythonInterp unconditionally. Some projects may want the libraries of a specific version even when the corresponding interpreter is not available. Drop the internal use of FindPythonInterp and just use the versions from it if it happens to have been found by the project first. That will allow projects to get a consistent version when they want both but not otherwise force them to find the interpreter. --- Modules/FindPythonLibs.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 27d9e4503..656ed7be7 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -83,7 +83,6 @@ endif() # If FindPythonInterp has already found the major and minor version, # insert that version between the user supplied versions and the stock # version list. -find_package(PythonInterp QUIET) set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS}) if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR) list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) From 489b1c23b9a880da0012427b60cce7b6f5ddaa27 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 4 Mar 2014 13:25:42 -0500 Subject: [PATCH 092/278] Windows: Use response files to specify link libraries for GNU tools Work around the command-line-length limit by using an @linklibs.rsp response file to pass the flags for link libraries. This allows very long lists of libraries to be used in addition to the existing support for passing object files via response file. Suggested-by: Peter Keuschnigg --- .../dev/link-libraries-response-files.rst | 5 ++++ Modules/Platform/Windows-GNU.cmake | 5 +++- .../cmMakefileExecutableTargetGenerator.cxx | 14 +++++++++- Source/cmMakefileLibraryTargetGenerator.cxx | 14 +++++++++- Source/cmMakefileTargetGenerator.cxx | 28 ++++++++++++++++++- Source/cmMakefileTargetGenerator.h | 1 + 6 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 Help/release/dev/link-libraries-response-files.rst diff --git a/Help/release/dev/link-libraries-response-files.rst b/Help/release/dev/link-libraries-response-files.rst new file mode 100644 index 000000000..cecf7f6ab --- /dev/null +++ b/Help/release/dev/link-libraries-response-files.rst @@ -0,0 +1,5 @@ +link-libraries-response-files +----------------------------- + +* The Makefile generators learned to use response files with GNU tools + on Windows to pass library directories and names to the linker. diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 2bb7a2076..5c5b36024 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -87,6 +87,7 @@ macro(__windows_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE}) + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES ${__WINDOWS_GNU_LD_RESPONSE}) set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1) # We prefer "@" for response files but it is not supported by gcc 3. @@ -103,7 +104,9 @@ macro(__windows_compiler_gnu lang) endif() # The GNU 3.x compilers do not support response files (only linkers). set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 0) - elseif(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS) + # Link libraries are generated only for the front-end. + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 0) + else() # Use "@" to pass the response file to the front-end. set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") endif() diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 6754525f3..180205427 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -318,6 +318,18 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } } + // Select whether to use a response file for libraries. + bool useResponseFileForLibs = false; + { + std::string responseVar = "CMAKE_"; + responseVar += linkLanguage; + responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; + if(this->Makefile->IsOn(responseVar.c_str())) + { + useResponseFileForLibs = true; + } + } + // Expand the rule variables. { // Set path conversion for link script shells. @@ -325,7 +337,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Collect up flags to link in needed libraries. std::string linkLibs; - this->CreateLinkLibs(linkLibs, relink, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); // Construct object file lists that may be needed to expand the // rule. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index c639f3e58..39e00b231 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -485,6 +485,18 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } } + // Select whether to use a response file for libraries. + bool useResponseFileForLibs = false; + { + std::string responseVar = "CMAKE_"; + responseVar += linkLanguage; + responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; + if(this->Makefile->IsOn(responseVar.c_str())) + { + useResponseFileForLibs = true; + } + } + // For static libraries there might be archiving rules. bool haveStaticLibraryRule = false; std::vector archiveCreateCommands; @@ -546,7 +558,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string linkLibs; if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { - this->CreateLinkLibs(linkLibs, relink, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); } // Construct object file lists that may be needed to expand the diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0f2b6e371..facbcc621 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1834,14 +1834,40 @@ cmMakefileTargetGenerator void cmMakefileTargetGenerator ::CreateLinkLibs(std::string& linkLibs, bool relink, + bool useResponseFile, std::vector& makefile_depends) { std::string frameworkPath; std::string linkPath; this->LocalGenerator ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *this->GeneratorTarget, relink, false); + *this->GeneratorTarget, relink, + useResponseFile); linkLibs = frameworkPath + linkPath + linkLibs; + + if(useResponseFile) + { + // Lookup the response file reference flag. + std::string responseFlagVar = "CMAKE_"; + responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); + responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; + const char* responseFlag = + this->Makefile->GetDefinition(responseFlagVar.c_str()); + if(!responseFlag) + { + responseFlag = "@"; + } + + // Create this response file. + std::string link_rsp = + this->CreateResponseFile("linklibs.rsp", linkLibs, makefile_depends); + + // Reference the response file. + linkLibs = responseFlag; + linkLibs += this->Convert(link_rsp.c_str(), + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index d47708d25..72dc6bc61 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -165,6 +165,7 @@ protected: /** Create list of flags for link libraries. */ void CreateLinkLibs(std::string& linkLibs, bool relink, + bool useResponseFile, std::vector& makefile_depends); /** Create lists of object files for linking and cleaning. */ From 70da6f198f8def8201c562365b914c700b10b95b Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 6 Mar 2014 00:01:05 -0500 Subject: [PATCH 093/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 66c8761bf..8fdad134e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140305) +set(CMake_VERSION_PATCH 20140306) #set(CMake_VERSION_RC 1) From 25fb430e96ecd33d437ad833f58fce509de6dc48 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Mar 2014 09:31:26 -0500 Subject: [PATCH 094/278] Utilities/Release: Fix nightly build upload Since commit 71b14dcb (Utilities/Release: Do not upload doc staging tarball, 2014-02-26) the prefix upload_release.cmake computes does not match any files when used with -DVERSION=master as has been done for the nightly binary builds. Since the version is not actually 'master' anyway, change the nightly binary upload logic to explicitly pass the destination directory. Do not pass any VERSION so the default is taken and matches the binaries. --- Tests/CMakeLists.txt | 2 +- Utilities/Release/upload_release.cmake | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 854b239d6..ea049114e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -575,7 +575,7 @@ if(BUILD_TESTING) file(WRITE "${_TEST_DIR}/nightly-cmake.sh" "cd ${_TEST_DIR} ${CMake_BINARY_DIR}/bin/cmake -DCMAKE_CREATE_VERSION=nightly -P ${CMake_SOURCE_DIR}/Utilities/Release/${script} -${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake +${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release/upload_release.cmake ") add_test(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh) if(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 613d73dc8..5f4da8f0e 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -5,16 +5,15 @@ endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) endif() -set(dir "v${VERSION}") -if("${VERSION}" MATCHES "master") - set(dir "dev") +if(NOT DEFINED DIR) + set(DIR "v${VERSION}") endif() file(GLOB FILES ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_PREFIX}*") list(SORT FILES) list(REVERSE FILES) message("${FILES}") set(UPLOAD_LOC - "kitware@www.cmake.org:/projects/FTP/pub/cmake/${dir}") + "kitware@www.cmake.org:/projects/FTP/pub/cmake/${DIR}") set(count 0) foreach(file ${FILES}) if(NOT IS_DIRECTORY ${file}) From 87d66066059509d355f87dfbf2b38b4738a10659 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Mar 2014 13:04:16 -0500 Subject: [PATCH 095/278] CTestCustom: Suppress MIPSpro warnings about Olimit Since we compile command implementations in large batches the translation units get too big for MIPSpro optimization limits. Suppress the warnings it produces: Warning: Olimit was exceeded on function ... Warning: To override Olimit for all functions in file, use -OPT:Olimit=3201 --- CTestCustom.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index eb0b2f695..b0f86ec46 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -39,6 +39,8 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*" "Warning: public.*_archive.*clashes with prior module.*" "Warning: LINN32: Last line.*is less.*" + "Warning: Olimit was exceeded on function.*" + "Warning: To override Olimit for all functions in file.*" "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*" "stl_deque.h:1051" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" From 00da6ac784dbd5cb7d5b316e262700b22117b2b1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 7 Mar 2014 00:01:08 -0500 Subject: [PATCH 096/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8fdad134e..357c39326 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140306) +set(CMake_VERSION_PATCH 20140307) #set(CMake_VERSION_RC 1) From c236691b32f4532d4da6db77322b4446e3802e3f Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Thu, 6 Mar 2014 13:01:40 -0500 Subject: [PATCH 097/278] KWSys 2014-03-06 (9c653603) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ 9c653603 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' b1916e0a..9c653603 Brad King (1): 9c653603 Process: Suppress IBM XL warning about infinite loop in test Change-Id: I3a1f36707bcfff0f34e0176528d9c792384ac8c5 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 083d865e1..52bcfe147 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1225,6 +1225,9 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|LLVM)$") SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0) + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") + # Tell IBM XL not to warn about our test infinite loop + SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010) ENDIF() # Test SharedForward From 666c0009319e4c2a73a000f41dc54544df894dfe Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 8 Mar 2014 00:01:07 -0500 Subject: [PATCH 098/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 357c39326..f1302da27 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140307) +set(CMake_VERSION_PATCH 20140308) #set(CMake_VERSION_RC 1) From ec97ed7d0c67b635caf3ada65541b2eaf0818a93 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 2 Sep 2013 16:27:32 -0400 Subject: [PATCH 099/278] stringapi: Use strings for property names Property names are always generated by CMake and should never be NULL. --- Source/cmCacheManager.cxx | 34 +++--- Source/cmCacheManager.h | 18 ++-- Source/cmExportFileGenerator.cxx | 15 +-- Source/cmExportFileGenerator.h | 8 +- Source/cmExportTryCompileFileGenerator.cxx | 5 +- Source/cmExportTryCompileFileGenerator.h | 2 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGeneratorTarget.h | 4 +- Source/cmGetTargetPropertyCommand.cxx | 12 ++- Source/cmLocalGenerator.cxx | 16 +-- Source/cmLocalGenerator.h | 4 +- Source/cmMakefile.cxx | 89 ++++++---------- Source/cmMakefile.h | 16 +-- Source/cmProperty.cxx | 5 +- Source/cmProperty.h | 5 +- Source/cmPropertyDefinition.cxx | 2 +- Source/cmPropertyDefinition.h | 2 +- Source/cmPropertyDefinitionMap.cxx | 21 +--- Source/cmPropertyDefinitionMap.h | 6 +- Source/cmPropertyMap.cxx | 16 ++- Source/cmPropertyMap.h | 8 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmSourceFile.cxx | 25 ++--- Source/cmSourceFile.h | 11 +- Source/cmTarget.cxx | 118 +++++++++------------ Source/cmTarget.h | 19 ++-- Source/cmTargetPropCommandBase.cxx | 5 +- Source/cmTargetPropCommandBase.h | 3 +- Source/cmTest.cxx | 18 +--- Source/cmTest.h | 9 +- Source/cmake.cxx | 50 ++++----- Source/cmake.h | 20 ++-- 32 files changed, 262 insertions(+), 310 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 9e0064e5d..04542d8c9 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -807,13 +807,13 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const //---------------------------------------------------------------------------- const char* -cmCacheManager::CacheEntry::GetProperty(const char* prop) const +cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const { - if(strcmp(prop, "TYPE") == 0) + if(prop == "TYPE") { return cmCacheManagerTypes[this->Type]; } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "VALUE") { return this->Value.c_str(); } @@ -823,14 +823,14 @@ cmCacheManager::CacheEntry::GetProperty(const char* prop) const } //---------------------------------------------------------------------------- -void cmCacheManager::CacheEntry::SetProperty(const char* prop, +void cmCacheManager::CacheEntry::SetProperty(const std::string& prop, const char* value) { - if(strcmp(prop, "TYPE") == 0) + if(prop == "TYPE") { this->Type = cmCacheManager::StringToType(value? value : "STRING"); } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "VALUE") { this->Value = value? value : ""; } @@ -841,15 +841,15 @@ void cmCacheManager::CacheEntry::SetProperty(const char* prop, } //---------------------------------------------------------------------------- -void cmCacheManager::CacheEntry::AppendProperty(const char* prop, +void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop, const char* value, bool asString) { - if(strcmp(prop, "TYPE") == 0) + if(prop == "TYPE") { this->Type = cmCacheManager::StringToType(value? value : "STRING"); } - else if(strcmp(prop, "VALUE") == 0) + else if(prop == "VALUE") { if(value) { @@ -867,7 +867,8 @@ void cmCacheManager::CacheEntry::AppendProperty(const char* prop, } //---------------------------------------------------------------------------- -const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const +const char* cmCacheManager::CacheIterator::GetProperty( + const std::string& prop) const { if(!this->IsAtEnd()) { @@ -877,7 +878,8 @@ const char* cmCacheManager::CacheIterator::GetProperty(const char* prop) const } //---------------------------------------------------------------------------- -void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) +void cmCacheManager::CacheIterator::SetProperty(const std::string& p, + const char* v) { if(!this->IsAtEnd()) { @@ -886,7 +888,7 @@ void cmCacheManager::CacheIterator::SetProperty(const char* p, const char* v) } //---------------------------------------------------------------------------- -void cmCacheManager::CacheIterator::AppendProperty(const char* p, +void cmCacheManager::CacheIterator::AppendProperty(const std::string& p, const char* v, bool asString) { @@ -897,7 +899,8 @@ void cmCacheManager::CacheIterator::AppendProperty(const char* p, } //---------------------------------------------------------------------------- -bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const +bool cmCacheManager::CacheIterator::GetPropertyAsBool( + const std::string& prop) const { if(const char* value = this->GetProperty(prop)) { @@ -907,13 +910,14 @@ bool cmCacheManager::CacheIterator::GetPropertyAsBool(const char* prop) const } //---------------------------------------------------------------------------- -void cmCacheManager::CacheIterator::SetProperty(const char* p, bool v) +void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v) { this->SetProperty(p, v ? "ON" : "OFF"); } //---------------------------------------------------------------------------- -bool cmCacheManager::CacheIterator::PropertyExists(const char* prop) const +bool cmCacheManager::CacheIterator::PropertyExists( + const std::string& prop) const { return this->GetProperty(prop)? true:false; } diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index f487e8e6b..ac6187bfc 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -39,9 +39,9 @@ private: std::string Value; CacheEntryType Type; cmPropertyMap Properties; - const char* GetProperty(const char*) const; - void SetProperty(const char* property, const char* value); - void AppendProperty(const char* property, const char* value, + const char* GetProperty(const std::string&) const; + void SetProperty(const std::string& property, const char* value); + void AppendProperty(const std::string& property, const char* value, bool asString=false); bool Initialized; CacheEntry() : Value(""), Type(UNINITIALIZED), Initialized(false) @@ -58,13 +58,13 @@ public: void Next(); const char *GetName() const { return this->Position->first.c_str(); } - const char* GetProperty(const char*) const ; - bool GetPropertyAsBool(const char*) const ; - bool PropertyExists(const char*) const; - void SetProperty(const char* property, const char* value); - void AppendProperty(const char* property, const char* value, + const char* GetProperty(const std::string&) const ; + bool GetPropertyAsBool(const std::string&) const ; + bool PropertyExists(const std::string&) const; + void SetProperty(const std::string& property, const char* value); + void AppendProperty(const std::string& property, const char* value, bool asString=false); - void SetProperty(const char* property, bool value); + void SetProperty(const std::string& property, bool value); const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 4a161eef7..79566a96d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -136,7 +136,8 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, } //---------------------------------------------------------------------------- -void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, +void cmExportFileGenerator::PopulateInterfaceProperty( + const std::string& propName, cmTarget *target, ImportPropertyMap &properties) { @@ -148,8 +149,9 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, } //---------------------------------------------------------------------------- -void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, - const char *outputName, +void cmExportFileGenerator::PopulateInterfaceProperty( + const std::string& propName, + const cmStdString& outputName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, @@ -391,7 +393,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( } //---------------------------------------------------------------------------- -void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, +void cmExportFileGenerator::PopulateInterfaceProperty( + const std::string& propName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, @@ -403,7 +406,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName, //---------------------------------------------------------------------------- -void getPropertyContents(cmTarget const* tgt, const char *prop, +void getPropertyContents(cmTarget const* tgt, const std::string& prop, std::set &ifaceProperties) { const char *p = tgt->GetProperty(prop); @@ -825,7 +828,7 @@ void cmExportFileGenerator ::SetImportLinkProperty(std::string const& suffix, cmTarget* target, - const char* propName, + const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, std::vector& missingTargets diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 57ab37899..326fe36c0 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -95,7 +95,7 @@ protected: ImportPropertyMap& properties, std::vector& missingTargets); void SetImportLinkProperty(std::string const& suffix, - cmTarget* target, const char* propName, + cmTarget* target, const std::string& propName, std::vector const& entries, ImportPropertyMap& properties, std::vector& missingTargets); @@ -116,7 +116,7 @@ protected: cmMakefile* mf, cmTarget* depender, cmTarget* dependee) = 0; - void PopulateInterfaceProperty(const char *, + void PopulateInterfaceProperty(const std::string&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, @@ -125,7 +125,7 @@ protected: cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, std::vector &missingTargets); - void PopulateInterfaceProperty(const char *propName, cmTarget *target, + void PopulateInterfaceProperty(const std::string& propName, cmTarget *target, ImportPropertyMap &properties); void PopulateCompatibleInterfaceProperties(cmTarget *target, ImportPropertyMap &properties); @@ -174,7 +174,7 @@ protected: std::set ExportedTargets; private: - void PopulateInterfaceProperty(const char *, const char *, + void PopulateInterfaceProperty(const std::string&, const cmStdString&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index a8a91d6d9..fe8c8ecad 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -46,8 +46,9 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) return true; } -std::string cmExportTryCompileFileGenerator::FindTargets(const char *propName, - cmTarget const* tgt, +std::string cmExportTryCompileFileGenerator::FindTargets( + const std::string& propName, + cmTarget const* tgt, std::set &emitted) { const char *prop = tgt->GetProperty(propName); diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index 71ac0dd9c..a16fe6b91 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -46,7 +46,7 @@ protected: std::string InstallNameDir(cmTarget* target, const std::string& config); private: - std::string FindTargets(const char *prop, cmTarget const* tgt, + std::string FindTargets(const std::string& prop, cmTarget const* tgt, std::set &emitted); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7b2fb69c..d9885b9ad 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -234,7 +234,7 @@ const char *cmGeneratorTarget::GetName() const } //---------------------------------------------------------------------------- -const char *cmGeneratorTarget::GetProperty(const char *prop) const +const char *cmGeneratorTarget::GetProperty(const std::string& prop) const { return this->Target->GetProperty(prop); } @@ -486,7 +486,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, } //---------------------------------------------------------------------------- -bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) const +bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const { return this->Target->GetPropertyAsBool(prop); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 1e6ce64c0..6e19f7de4 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -28,8 +28,8 @@ public: int GetType() const; const char *GetName() const; - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + const char *GetProperty(const std::string& prop) const; + bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files) const; void GetObjectSources(std::vector &) const; diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 4aa49fe9c..b64f84752 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -22,7 +22,7 @@ bool cmGetTargetPropertyCommand } std::string var = args[0].c_str(); const std::string& targetName = args[1]; - const char *prop = 0; + std::string prop; if(args[2] == "ALIASED_TARGET") { @@ -38,7 +38,11 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - prop = target.GetProperty(args[2].c_str()); + const char* prop_cstr = target.GetProperty(args[2].c_str()); + if(prop_cstr) + { + prop = prop_cstr; + } } else { @@ -70,9 +74,9 @@ bool cmGetTargetPropertyCommand } } } - if (prop) + if (!prop.empty()) { - this->Makefile->AddDefinition(var.c_str(), prop); + this->Makefile->AddDefinition(var.c_str(), prop.c_str()); return true; } this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b86a956d4..5bfd9da51 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1156,8 +1156,11 @@ void cmLocalGenerator::ExpandRuleVariables(std::string& s, const RuleVariables& replaceValues) { - this->InsertRuleLauncher(s, replaceValues.CMTarget, - replaceValues.RuleLauncher); + if(replaceValues.RuleLauncher) + { + this->InsertRuleLauncher(s, replaceValues.CMTarget, + replaceValues.RuleLauncher); + } std::string::size_type start = s.find('<'); // no variables to expand if(start == s.npos) @@ -1201,7 +1204,7 @@ cmLocalGenerator::ExpandRuleVariables(std::string& s, //---------------------------------------------------------------------------- const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, - const char* prop) + const std::string& prop) { if(target) { @@ -1215,7 +1218,7 @@ const char* cmLocalGenerator::GetRuleLauncher(cmTarget* target, //---------------------------------------------------------------------------- void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, - const char* prop) + const std::string& prop) { if(const char* val = this->GetRuleLauncher(target, prop)) { @@ -3455,11 +3458,12 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const } //---------------------------------------------------------------------------- -static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop) +static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, + const std::string& prop) { if(const char* val = target->GetProperty(prop)) { - mf->AddDefinition(prop, val); + mf->AddDefinition(prop.c_str(), val); } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 2e0580446..888611db1 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -382,9 +382,9 @@ protected: std::string ExpandRuleVariable(std::string const& variable, const RuleVariables& replaceValues); - const char* GetRuleLauncher(cmTarget* target, const char* prop); + const char* GetRuleLauncher(cmTarget* target, const std::string& prop); void InsertRuleLauncher(std::string& s, cmTarget* target, - const char* prop); + const std::string& prop); /** Convert a target to a utility target for unsupported diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 556e7a444..0fce1f410 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3548,17 +3548,9 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, return res; } -void cmMakefile::SetProperty(const char* prop, const char* value) +void cmMakefile::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } - - // handle special props - std::string propname = prop; - - if ( propname == "LINK_DIRECTORIES" ) + if ( prop == "LINK_DIRECTORIES" ) { std::vector varArgsExpanded; if(value) @@ -3568,7 +3560,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->SetLinkDirectories(varArgsExpanded); return; } - if (propname == "INCLUDE_DIRECTORIES") + if (prop == "INCLUDE_DIRECTORIES") { this->IncludeDirectoriesEntries.clear(); if (!value) @@ -3581,7 +3573,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_OPTIONS") + if (prop == "COMPILE_OPTIONS") { this->CompileOptionsEntries.clear(); if (!value) @@ -3593,7 +3585,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_DEFINITIONS") + if (prop == "COMPILE_DEFINITIONS") { this->CompileDefinitionsEntries.clear(); if (!value) @@ -3607,13 +3599,13 @@ void cmMakefile::SetProperty(const char* prop, const char* value) return; } - if ( propname == "INCLUDE_REGULAR_EXPRESSION" ) + if ( prop == "INCLUDE_REGULAR_EXPRESSION" ) { this->SetIncludeRegularExpression(value); return; } - if ( propname == "ADDITIONAL_MAKE_CLEAN_FILES" ) + if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) { // This property is not inherrited if ( strcmp(this->GetCurrentDirectory(), @@ -3626,18 +3618,11 @@ void cmMakefile::SetProperty(const char* prop, const char* value) this->Properties.SetProperty(prop,value,cmProperty::DIRECTORY); } -void cmMakefile::AppendProperty(const char* prop, const char* value, +void cmMakefile::AppendProperty(const std::string& prop, + const char* value, bool asString) { - if (!prop) - { - return; - } - - // handle special props - std::string propname = prop; - - if (propname == "INCLUDE_DIRECTORIES") + if (prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3645,7 +3630,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_OPTIONS") + if (prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3653,7 +3638,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if (propname == "COMPILE_DEFINITIONS") + if (prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->GetBacktrace(lfbt); @@ -3661,7 +3646,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, cmValueWithOrigin(value, lfbt)); return; } - if ( propname == "LINK_DIRECTORIES" ) + if ( prop == "LINK_DIRECTORIES" ) { std::vector varArgsExpanded; cmSystemTools::ExpandListArgument(value, varArgsExpanded); @@ -3676,32 +3661,28 @@ void cmMakefile::AppendProperty(const char* prop, const char* value, this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); } -const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const +const char *cmMakefile::GetPropertyOrDefinition(const std::string& prop) const { const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); if (!ret) { - ret = this->GetDefinition(prop); + ret = this->GetDefinition(prop.c_str()); } return ret; } -const char *cmMakefile::GetProperty(const char* prop) const +const char *cmMakefile::GetProperty(const std::string& prop) const { return this->GetProperty(prop, cmProperty::DIRECTORY); } -const char *cmMakefile::GetProperty(const char* prop, +const char *cmMakefile::GetProperty(const std::string& prop, cmProperty::ScopeType scope) const { - if(!prop) - { - return 0; - } // watch for specific properties static std::string output; output = ""; - if (!strcmp("PARENT_DIRECTORY",prop)) + if (prop == "PARENT_DIRECTORY") { if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { @@ -3709,12 +3690,12 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("INCLUDE_REGULAR_EXPRESSION",prop) ) + else if (prop == "INCLUDE_REGULAR_EXPRESSION" ) { output = this->GetIncludeRegularExpression(); return output.c_str(); } - else if (!strcmp("LISTFILE_STACK",prop)) + else if (prop == "LISTFILE_STACK") { for (std::deque::const_iterator i = this->ListFileStack.begin(); @@ -3728,10 +3709,10 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("VARIABLES",prop) || !strcmp("CACHE_VARIABLES",prop)) + else if (prop == "VARIABLES" || prop == "CACHE_VARIABLES") { int cacheonly = 0; - if ( !strcmp("CACHE_VARIABLES",prop) ) + if ( prop == "CACHE_VARIABLES" ) { cacheonly = 1; } @@ -3746,17 +3727,17 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("MACROS",prop)) + else if (prop == "MACROS") { this->GetListOfMacros(output); return output.c_str(); } - else if (!strcmp("DEFINITIONS",prop)) + else if (prop == "DEFINITIONS") { output += this->DefineFlagsOrig; return output.c_str(); } - else if (!strcmp("LINK_DIRECTORIES",prop)) + else if (prop == "LINK_DIRECTORIES") { cmOStringStream str; for (std::vector::const_iterator @@ -3773,7 +3754,7 @@ const char *cmMakefile::GetProperty(const char* prop, output = str.str(); return output.c_str(); } - else if (!strcmp("INCLUDE_DIRECTORIES",prop)) + else if (prop == "INCLUDE_DIRECTORIES") { std::string sep; for (std::vector::const_iterator @@ -3787,7 +3768,7 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("COMPILE_OPTIONS",prop)) + else if (prop == "COMPILE_OPTIONS") { std::string sep; for (std::vector::const_iterator @@ -3801,7 +3782,7 @@ const char *cmMakefile::GetProperty(const char* prop, } return output.c_str(); } - else if (!strcmp("COMPILE_DEFINITIONS",prop)) + else if (prop == "COMPILE_DEFINITIONS") { std::string sep; for (std::vector::const_iterator @@ -3832,7 +3813,7 @@ const char *cmMakefile::GetProperty(const char* prop, return retVal; } -bool cmMakefile::GetPropertyAsBool(const char* prop) const +bool cmMakefile::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); } @@ -4014,9 +3995,9 @@ void cmMakefile::PopScope() } } -void cmMakefile::RaiseScope(const char *var, const char *varDef) +void cmMakefile::RaiseScope(const cmStdString& var, const char *varDef) { - if (!var || !strlen(var)) + if (var.empty()) { return; } @@ -4025,10 +4006,10 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. - cur.Get(var); + cur.Get(var.c_str()); // Now update the definition in the parent scope. - up->Set(var, varDef); + up->Set(var.c_str(), varDef); } else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { @@ -4038,11 +4019,11 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) cmMakefile* parent = plg->GetMakefile(); if (varDef) { - parent->AddDefinition(var, varDef); + parent->AddDefinition(var.c_str(), varDef); } else { - parent->RemoveDefinition(var); + parent->RemoveDefinition(var.c_str()); } } else diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 45f3b9f4a..5f4b803d3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -800,12 +800,14 @@ public: std::string GetModulesFile(const char* name) const; ///! Set/Get a property of this directory - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char *prop, const char *value,bool asString=false); - const char *GetProperty(const char *prop) const; - const char *GetPropertyOrDefinition(const char *prop) const; - const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, const char *value, + bool asString=false); + const char *GetProperty(const std::string& prop) const; + const char *GetPropertyOrDefinition(const std::string& prop) const; + const char *GetProperty(const std::string& prop, + cmProperty::ScopeType scope) const; + bool GetPropertyAsBool(const std::string& prop) const; const char* GetFeature(const char* feature, const char* config); @@ -835,7 +837,7 @@ public: // push and pop variable scopes void PushScope(); void PopScope(); - void RaiseScope(const char *var, const char *value); + void RaiseScope(const cmStdString& var, const char *value); /** Helper class to push and pop scopes automatically. */ class ScopePushPop diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx index 3b37cf3b8..40976db15 100644 --- a/Source/cmProperty.cxx +++ b/Source/cmProperty.cxx @@ -12,14 +12,15 @@ #include "cmProperty.h" #include "cmSystemTools.h" -void cmProperty::Set(const char *name, const char *value) +void cmProperty::Set(const std::string& name, const char *value) { this->Name = name; this->Value = value; this->ValueHasBeenSet = true; } -void cmProperty::Append(const char *name, const char *value, bool asString) +void cmProperty::Append(const std::string& name, const char *value, + bool asString) { this->Name = name; if(!this->Value.empty() && *value && !asString) diff --git a/Source/cmProperty.h b/Source/cmProperty.h index bb75bb0b9..789be1d0c 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -21,10 +21,11 @@ public: TEST, VARIABLE, CACHED_VARIABLE }; // set this property - void Set(const char *name, const char *value); + void Set(const std::string& name, const char *value); // append to this property - void Append(const char *name, const char *value, bool asString = false); + void Append(const std::string& name, const char *value, + bool asString = false); // get the value const char *GetValue() const; diff --git a/Source/cmPropertyDefinition.cxx b/Source/cmPropertyDefinition.cxx index abc57ce01..1af967c94 100644 --- a/Source/cmPropertyDefinition.cxx +++ b/Source/cmPropertyDefinition.cxx @@ -13,7 +13,7 @@ #include "cmSystemTools.h" void cmPropertyDefinition -::DefineProperty(const char *name, cmProperty::ScopeType scope, +::DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *shortDescription, const char *fullDescription, bool chain) diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index 1b6a7a6a1..9ca822206 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -27,7 +27,7 @@ class cmPropertyDefinition { public: /// Define this property - void DefineProperty(const char *name, cmProperty::ScopeType scope, + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chained); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index db2950461..9ebbaa4d4 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -14,16 +14,11 @@ #include "cmDocumentationSection.h" void cmPropertyDefinitionMap -::DefineProperty(const char *name, cmProperty::ScopeType scope, +::DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain) { - if (!name) - { - return; - } - cmPropertyDefinitionMap::iterator it = this->find(name); cmPropertyDefinition *prop; if (it == this->end()) @@ -34,13 +29,8 @@ void cmPropertyDefinitionMap } } -bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name) +bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name) { - if (!name) - { - return false; - } - cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) { @@ -50,13 +40,8 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const char *name) +bool cmPropertyDefinitionMap::IsPropertyChained(const cmStdString& name) { - if (!name) - { - return false; - } - cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) { diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 736e24371..68c3ff3cd 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -21,16 +21,16 @@ public std::map { public: // define the property - void DefineProperty(const char *name, cmProperty::ScopeType scope, + void DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain); // has a named property been defined - bool IsPropertyDefined(const char *name); + bool IsPropertyDefined(const cmStdString& name); // is a named property set to chain - bool IsPropertyChained(const char *name); + bool IsPropertyChained(const cmStdString& name); }; #endif diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index e94e3e972..e335b3b55 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -13,7 +13,7 @@ #include "cmSystemTools.h" #include "cmake.h" -cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) +cmProperty *cmPropertyMap::GetOrCreateProperty(const std::string& name) { cmPropertyMap::iterator it = this->find(name); cmProperty *prop; @@ -28,13 +28,9 @@ cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) return prop; } -void cmPropertyMap::SetProperty(const char *name, const char *value, +void cmPropertyMap::SetProperty(const std::string& name, const char *value, cmProperty::ScopeType scope) { - if (!name) - { - return; - } if(!value) { this->erase(name); @@ -46,11 +42,11 @@ void cmPropertyMap::SetProperty(const char *name, const char *value, prop->Set(name,value); } -void cmPropertyMap::AppendProperty(const char* name, const char* value, +void cmPropertyMap::AppendProperty(const std::string& name, const char* value, cmProperty::ScopeType scope, bool asString) { // Skip if nothing to append. - if(!name || !value || !*value) + if(!value || !*value) { return; } @@ -61,12 +57,12 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value, } const char *cmPropertyMap -::GetPropertyValue(const char *name, +::GetPropertyValue(const std::string& name, cmProperty::ScopeType scope, bool &chain) const { chain = false; - if (!name) + if (name.empty()) { return 0; } diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 0c3aad461..a13ac351f 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -19,15 +19,15 @@ class cmake; class cmPropertyMap : public std::map { public: - cmProperty *GetOrCreateProperty(const char *name); + cmProperty *GetOrCreateProperty(const std::string& name); - void SetProperty(const char *name, const char *value, + void SetProperty(const std::string& name, const char *value, cmProperty::ScopeType scope); - void AppendProperty(const char* name, const char* value, + void AppendProperty(const std::string& name, const char* value, cmProperty::ScopeType scope, bool asString=false); - const char *GetPropertyValue(const char *name, + const char *GetPropertyValue(const std::string& name, cmProperty::ScopeType scope, bool &chain) const; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index dfb310e54..7d0ce5f6d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -105,7 +105,7 @@ static std::string extractSubDir(const std::string& absPath, static void copyTargetProperty(cmTarget* destinationTarget, cmTarget* sourceTarget, - const char* propertyName) + const std::string& propertyName) { const char* propertyValue = sourceTarget->GetProperty(propertyName); if (propertyValue) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 23422a27e..dd95f23da 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -279,13 +279,8 @@ bool cmSourceFile::Matches(cmSourceFileLocation const& loc) } //---------------------------------------------------------------------------- -void cmSourceFile::SetProperty(const char* prop, const char* value) +void cmSourceFile::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } - this->Properties.SetProperty(prop, value, cmProperty::SOURCE_FILE); std::string ext = @@ -293,7 +288,7 @@ void cmSourceFile::SetProperty(const char* prop, const char* value) if (ext == ".ui") { cmMakefile const* mf = this->Location.GetMakefile(); - if (strcmp(prop, "AUTOUIC_OPTIONS") == 0) + if (prop == "AUTOUIC_OPTIONS") { const_cast(mf)->AddQtUiFileWithOptions(this); } @@ -301,19 +296,15 @@ void cmSourceFile::SetProperty(const char* prop, const char* value) } //---------------------------------------------------------------------------- -void cmSourceFile::AppendProperty(const char* prop, const char* value, +void cmSourceFile::AppendProperty(const std::string& prop, const char* value, bool asString) { - if (!prop) - { - return; - } this->Properties.AppendProperty(prop, value, cmProperty::SOURCE_FILE, asString); } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetPropertyForUser(const char *prop) +const char* cmSourceFile::GetPropertyForUser(const std::string& prop) { // This method is a consequence of design history and backwards // compatibility. GetProperty is (and should be) a const method. @@ -329,7 +320,7 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop) // cmSourceFileLocation class to commit to a particular full path to // the source file as late as possible. If the users requests the // LOCATION property we must commit now. - if(strcmp(prop, "LOCATION") == 0) + if(prop == "LOCATION") { // Commit to a location. this->GetFullPath(); @@ -340,10 +331,10 @@ const char* cmSourceFile::GetPropertyForUser(const char *prop) } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetProperty(const char* prop) const +const char* cmSourceFile::GetProperty(const std::string& prop) const { // Check for computed properties. - if(strcmp(prop, "LOCATION") == 0) + if(prop == "LOCATION") { if(this->FullPath.empty()) { @@ -368,7 +359,7 @@ const char* cmSourceFile::GetProperty(const char* prop) const } //---------------------------------------------------------------------------- -bool cmSourceFile::GetPropertyAsBool(const char* prop) const +bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 4440b05f6..85d63323c 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -43,14 +43,15 @@ public: void SetCustomCommand(cmCustomCommand *cc); ///! Set/Get a property of this source file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char* value,bool asString=false); + const char *GetProperty(const std::string& prop) const; + bool GetPropertyAsBool(const std::string& prop) const; /** Implement getting a property when called from a CMake language command like get_property or get_source_file_property. */ - const char* GetPropertyForUser(const char *prop); + const char* GetPropertyForUser(const std::string& prop); /** * The full path to the file. The non-const version of this method diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1c2b27a9e..fc2ab252a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1293,7 +1293,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, } //---------------------------------------------------------------------------- -static bool whiteListedInterfaceProperty(const char *prop) +static bool whiteListedInterfaceProperty(const std::string& prop) { if(cmHasLiteralPrefix(prop, "INTERFACE_")) { @@ -1313,8 +1313,8 @@ static bool whiteListedInterfaceProperty(const char *prop) if (std::binary_search(cmArrayBegin(builtIns), cmArrayEnd(builtIns), - prop, - cmStrCmp(prop))) + prop.c_str(), + cmStrCmp(prop.c_str()))) { return true; } @@ -1328,12 +1328,8 @@ static bool whiteListedInterfaceProperty(const char *prop) } //---------------------------------------------------------------------------- -void cmTarget::SetProperty(const char* prop, const char* value) +void cmTarget::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) { @@ -1344,14 +1340,14 @@ void cmTarget::SetProperty(const char* prop, const char* value) return; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1362,7 +1358,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1373,7 +1369,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1384,7 +1380,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) + if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" @@ -1392,7 +1388,7 @@ void cmTarget::SetProperty(const char* prop, const char* value) this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if (strcmp(prop, "LINK_LIBRARIES") == 0) + if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); cmListFileBacktrace lfbt; @@ -1406,13 +1402,9 @@ void cmTarget::SetProperty(const char* prop, const char* value) } //---------------------------------------------------------------------------- -void cmTarget::AppendProperty(const char* prop, const char* value, +void cmTarget::AppendProperty(const std::string& prop, const char* value, bool asString) { - if (!prop) - { - return; - } if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) { @@ -1422,14 +1414,14 @@ void cmTarget::AppendProperty(const char* prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1438,7 +1430,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1447,7 +1439,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -1456,7 +1448,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported()) + if(prop == "EXPORT_NAME" && this->IsImported()) { cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" @@ -1464,7 +1456,7 @@ void cmTarget::AppendProperty(const char* prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); return; } - if (strcmp(prop, "LINK_LIBRARIES") == 0) + if (prop == "LINK_LIBRARIES") { cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); @@ -2215,7 +2207,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } //---------------------------------------------------------------------------- -void cmTarget::MaybeInvalidatePropertyCache(const char* prop) +void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop) { // Wipe out maps caching information affected by this property. if(this->IsImported() && cmHasLiteralPrefix(prop, "IMPORTED")) @@ -2230,8 +2222,8 @@ void cmTarget::MaybeInvalidatePropertyCache(const char* prop) //---------------------------------------------------------------------------- static void cmTargetCheckLINK_INTERFACE_LIBRARIES( - const char* prop, const char* value, cmMakefile* context, bool imported - ) + const std::string& prop, const char* value, cmMakefile* context, + bool imported) { // Look for link-type keywords in the value. static cmsys::RegularExpression @@ -2295,7 +2287,8 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value, } //---------------------------------------------------------------------------- -void cmTarget::CheckProperty(const char* prop, cmMakefile* context) const +void cmTarget::CheckProperty(const std::string& prop, + cmMakefile* context) const { // Certain properties need checking. if(cmHasLiteralPrefix(prop, "LINK_INTERFACE_LIBRARIES")) @@ -2579,7 +2572,7 @@ const char* cmTarget::GetFeature(const char* feature, const char* config) const } //---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const char* prop) const +const char *cmTarget::GetProperty(const std::string& prop) const { return this->GetProperty(prop, cmProperty::TARGET); } @@ -2622,14 +2615,9 @@ bool cmTarget::HandleLocationPropertyPolicy() const } //---------------------------------------------------------------------------- -const char *cmTarget::GetProperty(const char* prop, +const char *cmTarget::GetProperty(const std::string& prop, cmProperty::ScopeType scope) const { - if(!prop) - { - return 0; - } - if (this->GetType() == INTERFACE_LIBRARY && !whiteListedInterfaceProperty(prop)) { @@ -2640,7 +2628,7 @@ const char *cmTarget::GetProperty(const char* prop, return 0; } - if (strcmp(prop, "NAME") == 0) + if (prop == "NAME") { return this->GetName(); } @@ -2653,7 +2641,7 @@ const char *cmTarget::GetProperty(const char* prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(strcmp(prop,"LOCATION") == 0) + if(prop == "LOCATION") { if (!this->HandleLocationPropertyPolicy()) { @@ -2680,13 +2668,13 @@ const char *cmTarget::GetProperty(const char* prop, { return 0; } - std::string configName = prop+9; + const char* configName = prop.c_str() + 9; this->Properties.SetProperty(prop, - this->GetLocation(configName.c_str()), + this->GetLocation(configName), cmProperty::TARGET); } } - if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) + if(prop == "INCLUDE_DIRECTORIES") { static std::string output; output = ""; @@ -2704,7 +2692,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"COMPILE_OPTIONS") == 0) + if(prop == "COMPILE_OPTIONS") { static std::string output; output = ""; @@ -2722,7 +2710,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) + if(prop == "COMPILE_DEFINITIONS") { static std::string output; output = ""; @@ -2740,7 +2728,7 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"LINK_LIBRARIES") == 0) + if(prop == "LINK_LIBRARIES") { static std::string output; output = ""; @@ -2757,12 +2745,12 @@ const char *cmTarget::GetProperty(const char* prop, return output.c_str(); } - if (strcmp(prop,"IMPORTED") == 0) + if (prop == "IMPORTED") { return this->IsImported()?"TRUE":"FALSE"; } - if(!strcmp(prop,"SOURCES")) + if(prop == "SOURCES") { cmOStringStream ss; const char* sep = ""; @@ -2791,7 +2779,7 @@ const char *cmTarget::GetProperty(const char* prop, } // the type property returns what type the target is - if (!strcmp(prop,"TYPE")) + if (prop == "TYPE") { return cmTarget::GetTargetTypeName(this->GetType()); } @@ -2806,7 +2794,7 @@ const char *cmTarget::GetProperty(const char* prop, } //---------------------------------------------------------------------------- -bool cmTarget::GetPropertyAsBool(const char* prop) const +bool cmTarget::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); } @@ -3804,7 +3792,7 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, } //---------------------------------------------------------------------------- -void cmTarget::SetPropertyDefault(const char* property, +void cmTarget::SetPropertyDefault(const std::string& property, const char* default_value) { // Compute the name of the variable holding the default value. @@ -4740,7 +4728,7 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( //---------------------------------------------------------------------------- bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, - const char *interfaceProperty, + const std::string& interfaceProperty, const char *config) { std::vector deps; @@ -5984,14 +5972,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const template PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType, PropertyType *); template<> bool getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType, bool *) { @@ -6000,7 +5988,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt, template<> const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, - const std::string prop, + const std::string& prop, const char *config, CompatibleType t, const char **) @@ -6025,7 +6013,7 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, template void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, - const char *propName, + const cmStdString& propName, std::set &emitted, const char *config, CompatibleType t, @@ -6135,32 +6123,32 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_BOOL", - emittedBools, config, BoolType, 0); + std::string("COMPATIBLE_INTERFACE_BOOL"), + emittedBools, config, BoolType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_STRING", - emittedStrings, config, - StringType, 0); + std::string("COMPATIBLE_INTERFACE_STRING"), + emittedStrings, config, + StringType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_NUMBER_MIN", - emittedMinNumbers, config, - NumberMinType, 0); + std::string("COMPATIBLE_INTERFACE_NUMBER_MIN"), + emittedMinNumbers, config, + NumberMinType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; } checkPropertyConsistency(this, li->Target, - "COMPATIBLE_INTERFACE_NUMBER_MAX", - emittedMaxNumbers, config, - NumberMaxType, 0); + std::string("COMPATIBLE_INTERFACE_NUMBER_MAX"), + emittedMaxNumbers, config, + NumberMaxType, 0); if (cmSystemTools::GetErrorOccuredFlag()) { return; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 471ea94a9..f0dd7087e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -223,12 +223,14 @@ public: void FinishConfigure(); ///! Set/Get a property of this target file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; - bool GetPropertyAsBool(const char *prop) const; - void CheckProperty(const char* prop, cmMakefile* context) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, const char* value, + bool asString=false); + const char *GetProperty(const std::string& prop) const; + const char *GetProperty(const std::string& prop, + cmProperty::ScopeType scope) const; + bool GetPropertyAsBool(const std::string& prop) const; + void CheckProperty(const std::string& prop, cmMakefile* context) const; const char* GetFeature(const char* feature, const char* config) const; @@ -632,7 +634,8 @@ private: // Use a makefile variable to set a default for the given property. // If the variable is not defined use the given default instead. - void SetPropertyDefault(const char* property, const char* default_value); + void SetPropertyDefault(const std::string& property, + const char* default_value); // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. const char* GetOutputTargetType(bool implib) const; @@ -729,7 +732,7 @@ private: void ClearLinkMaps(); - void MaybeInvalidatePropertyCache(const char* prop); + void MaybeInvalidatePropertyCache(const std::string& prop); void ProcessSourceExpression(std::string const& expr); diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 195690e7f..2a20516ac 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -16,8 +16,9 @@ //---------------------------------------------------------------------------- bool cmTargetPropCommandBase -::HandleArguments(std::vector const& args, const char *prop, - ArgumentFlags flags) +::HandleArguments(std::vector const& args, + const std::string& prop, + ArgumentFlags flags) { if(args.size() < 2) { diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index c4028365c..555a08a36 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -29,7 +29,8 @@ public: }; bool HandleArguments(std::vector const& args, - const char *prop, ArgumentFlags flags = NO_FLAGS); + const std::string& prop, + ArgumentFlags flags = NO_FLAGS); cmTypeMacro(cmTargetPropCommandBase, cmCommand); protected: diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 9cda97894..4ff71ac9a 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -54,7 +54,7 @@ void cmTest::SetCommand(std::vector const& command) } //---------------------------------------------------------------------------- -const char *cmTest::GetProperty(const char* prop) const +const char *cmTest::GetProperty(const std::string& prop) const { bool chain = false; const char *retVal = @@ -67,28 +67,20 @@ const char *cmTest::GetProperty(const char* prop) const } //---------------------------------------------------------------------------- -bool cmTest::GetPropertyAsBool(const char* prop) const +bool cmTest::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); } //---------------------------------------------------------------------------- -void cmTest::SetProperty(const char* prop, const char* value) +void cmTest::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } - this->Properties.SetProperty(prop, value, cmProperty::TEST); } //---------------------------------------------------------------------------- -void cmTest::AppendProperty(const char* prop, const char* value, bool asString) +void cmTest::AppendProperty(const std::string& prop, + const char* value, bool asString) { - if (!prop) - { - return; - } this->Properties.AppendProperty(prop, value, cmProperty::TEST, asString); } diff --git a/Source/cmTest.h b/Source/cmTest.h index 1fe8fc0cc..1becbf79e 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -46,10 +46,11 @@ public: void Print() const; ///! Set/Get a property of this source file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char* prop, const char* value,bool asString=false); - const char *GetProperty(const char *prop) const; - bool GetPropertyAsBool(const char *prop) const; + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char* value,bool asString=false); + const char *GetProperty(const std::string& prop) const; + bool GetPropertyAsBool(const std::string& prop) const; cmPropertyMap &GetProperties() { return this->Properties; }; /** Get the cmMakefile instance that owns this test. */ diff --git a/Source/cmake.cxx b/Source/cmake.cxx index abbabe762..149e299b5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2144,7 +2144,8 @@ void cmake::GenerateGraphViz(const char* fileName) const #endif } -void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, +void cmake::DefineProperty(const std::string& name, + cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chained) @@ -2155,7 +2156,7 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, } cmPropertyDefinition *cmake -::GetPropertyDefinition(const char *name, +::GetPropertyDefinition(const std::string& name, cmProperty::ScopeType scope) { if (this->IsPropertyDefined(name,scope)) @@ -2165,25 +2166,22 @@ cmPropertyDefinition *cmake return 0; } -bool cmake::IsPropertyDefined(const char *name, cmProperty::ScopeType scope) +bool cmake::IsPropertyDefined(const std::string& name, + cmProperty::ScopeType scope) { return this->PropertyDefinitions[scope].IsPropertyDefined(name); } -bool cmake::IsPropertyChained(const char *name, cmProperty::ScopeType scope) +bool cmake::IsPropertyChained(const std::string& name, + cmProperty::ScopeType scope) { return this->PropertyDefinitions[scope].IsPropertyChained(name); } -void cmake::SetProperty(const char* prop, const char* value) +void cmake::SetProperty(const std::string& prop, const char* value) { - if (!prop) - { - return; - } - // Special hook to invalidate cached value. - if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + if(prop == "DEBUG_CONFIGURATIONS") { this->DebugConfigs.clear(); } @@ -2191,15 +2189,11 @@ void cmake::SetProperty(const char* prop, const char* value) this->Properties.SetProperty(prop, value, cmProperty::GLOBAL); } -void cmake::AppendProperty(const char* prop, const char* value, bool asString) +void cmake::AppendProperty(const std::string& prop, + const char* value, bool asString) { - if (!prop) - { - return; - } - // Special hook to invalidate cached value. - if(strcmp(prop, "DEBUG_CONFIGURATIONS") == 0) + if(prop == "DEBUG_CONFIGURATIONS") { this->DebugConfigs.clear(); } @@ -2207,23 +2201,19 @@ void cmake::AppendProperty(const char* prop, const char* value, bool asString) this->Properties.AppendProperty(prop, value, cmProperty::GLOBAL, asString); } -const char *cmake::GetProperty(const char* prop) +const char *cmake::GetProperty(const std::string& prop) { return this->GetProperty(prop, cmProperty::GLOBAL); } -const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) +const char *cmake::GetProperty(const std::string& prop, + cmProperty::ScopeType scope) { - if(!prop) - { - return 0; - } bool chain = false; // watch for special properties - std::string propname = prop; std::string output = ""; - if ( propname == "CACHE_VARIABLES" ) + if ( prop == "CACHE_VARIABLES" ) { cmCacheManager::CacheIterator cit = this->GetCacheManager()->GetCacheIterator(); @@ -2237,7 +2227,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) } this->SetProperty("CACHE_VARIABLES", output.c_str()); } - else if ( propname == "COMMANDS" ) + else if ( prop == "COMMANDS" ) { cmake::RegisteredCommandsMap::iterator cmds = this->GetCommands()->begin(); @@ -2252,12 +2242,12 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) } this->SetProperty("COMMANDS",output.c_str()); } - else if ( propname == "IN_TRY_COMPILE" ) + else if ( prop == "IN_TRY_COMPILE" ) { this->SetProperty("IN_TRY_COMPILE", this->GetIsInTryCompile()? "1":"0"); } - else if ( propname == "ENABLED_LANGUAGES" ) + else if ( prop == "ENABLED_LANGUAGES" ) { std::string lang; if(this->GlobalGenerator) @@ -2278,7 +2268,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope) return this->Properties.GetPropertyValue(prop, scope, chain); } -bool cmake::GetPropertyAsBool(const char* prop) +bool cmake::GetPropertyAsBool(const std::string& prop) { return cmSystemTools::IsOn(this->GetProperty(prop)); } diff --git a/Source/cmake.h b/Source/cmake.h index dfec55c5c..e89868c7b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -269,11 +269,13 @@ class cmake void GetGeneratorDocumentation(std::vector&); ///! Set/Get a property of this target file - void SetProperty(const char *prop, const char *value); - void AppendProperty(const char *prop, const char *value,bool asString=false); - const char *GetProperty(const char *prop); - const char *GetProperty(const char *prop, cmProperty::ScopeType scope); - bool GetPropertyAsBool(const char *prop); + void SetProperty(const std::string& prop, const char *value); + void AppendProperty(const std::string& prop, + const char *value,bool asString=false); + const char *GetProperty(const std::string& prop); + const char *GetProperty(const std::string& prop, + cmProperty::ScopeType scope); + bool GetPropertyAsBool(const std::string& prop); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -317,18 +319,18 @@ class cmake void MarkCliAsUsed(const std::string& variable); // Define a property - void DefineProperty(const char *name, cmProperty::ScopeType scope, + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain = false); // get property definition cmPropertyDefinition *GetPropertyDefinition - (const char *name, cmProperty::ScopeType scope); + (const std::string& name, cmProperty::ScopeType scope); // Is a property defined? - bool IsPropertyDefined(const char *name, cmProperty::ScopeType scope); - bool IsPropertyChained(const char *name, cmProperty::ScopeType scope); + bool IsPropertyDefined(const std::string& name, cmProperty::ScopeType scope); + bool IsPropertyChained(const std::string& name, cmProperty::ScopeType scope); /** Get the list of configurations (in upper case) considered to be debugging configurations.*/ From 3742bb0d324b971f63cc7e557b1cb8a9d08c5cdd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 16:06:56 -0500 Subject: [PATCH 100/278] stringapi: Use strings for variable names Variable names are always generated by CMake and should never be NULL. --- Source/CPack/cmCPackGenerator.cxx | 14 +++---- Source/CPack/cmCPackGenerator.h | 10 ++--- Source/CTest/cmCTestGenericHandler.cxx | 14 ++----- Source/CTest/cmCTestGenericHandler.h | 6 +-- .../cmCursesCacheEntryComposite.cxx | 9 +++-- .../cmCursesCacheEntryComposite.h | 5 ++- Source/CursesDialog/cmCursesMainForm.cxx | 10 ++--- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/cmCTest.cxx | 17 +++------ Source/cmCTest.h | 8 ++-- Source/cmCacheManager.cxx | 11 +++--- Source/cmCacheManager.h | 10 ++--- Source/cmDefinitions.cxx | 8 ++-- Source/cmDefinitions.h | 8 ++-- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportFileGenerator.h | 2 +- Source/cmFindBase.cxx | 6 +-- Source/cmFindBase.h | 4 +- Source/cmFindCommon.cxx | 2 +- Source/cmFindCommon.h | 2 +- Source/cmFindPackageCommand.cxx | 3 +- Source/cmFindPackageCommand.h | 2 +- Source/cmIfCommand.cxx | 18 ++++----- Source/cmIfCommand.h | 2 +- Source/cmListCommand.cxx | 10 ++--- Source/cmListCommand.h | 4 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 2 +- Source/cmMakefile.cxx | 37 ++++++++++--------- Source/cmMakefile.h | 32 ++++++++-------- Source/cmMakefileLibraryTargetGenerator.cxx | 4 +- Source/cmMakefileLibraryTargetGenerator.h | 3 +- Source/cmMakefileTargetGenerator.cxx | 3 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmScriptGenerator.cxx | 2 +- Source/cmScriptGenerator.h | 2 +- Source/cmake.cxx | 10 ++--- Source/cmake.h | 10 ++--- 38 files changed, 142 insertions(+), 156 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index e1dd4e983..b46fd8623 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -972,7 +972,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) } //---------------------------------------------------------------------- -void cmCPackGenerator::SetOptionIfNotSet(const char* op, +void cmCPackGenerator::SetOptionIfNotSet(const std::string& op, const char* value) { const char* def = this->MakefileMap->GetDefinition(op); @@ -984,12 +984,8 @@ void cmCPackGenerator::SetOptionIfNotSet(const char* op, } //---------------------------------------------------------------------- -void cmCPackGenerator::SetOption(const char* op, const char* value) +void cmCPackGenerator::SetOption(const std::string& op, const char* value) { - if ( !op ) - { - return; - } if ( !value ) { this->MakefileMap->RemoveDefinition(op); @@ -1176,19 +1172,19 @@ int cmCPackGenerator::InitializeInternal() } //---------------------------------------------------------------------- -bool cmCPackGenerator::IsSet(const char* name) const +bool cmCPackGenerator::IsSet(const std::string& name) const { return this->MakefileMap->IsSet(name); } //---------------------------------------------------------------------- -bool cmCPackGenerator::IsOn(const char* name) const +bool cmCPackGenerator::IsOn(const std::string& name) const { return cmSystemTools::IsOn(GetOption(name)); } //---------------------------------------------------------------------- -const char* cmCPackGenerator::GetOption(const char* op) const +const char* cmCPackGenerator::GetOption(const std::string& op) const { const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index b1a7840a2..39ef64da7 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -99,12 +99,12 @@ public: virtual ~cmCPackGenerator(); //! Set and get the options - void SetOption(const char* op, const char* value); - void SetOptionIfNotSet(const char* op, const char* value); - const char* GetOption(const char* op) const; + void SetOption(const std::string& op, const char* value); + void SetOptionIfNotSet(const std::string& op, const char* value); + const char* GetOption(const std::string& op) const; std::vector GetOptions() const; - bool IsSet(const char* name) const; - bool IsOn(const char* name) const; + bool IsSet(const std::string& name) const; + bool IsOn(const std::string& name) const; //! Set the logger void SetLogger(cmCPackLog* log) { this->Logger = log; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 5338f307b..ae498ea44 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -30,12 +30,8 @@ cmCTestGenericHandler::~cmCTestGenericHandler() } //---------------------------------------------------------------------- -void cmCTestGenericHandler::SetOption(const char* op, const char* value) +void cmCTestGenericHandler::SetOption(const std::string& op, const char* value) { - if ( !op ) - { - return; - } if ( !value ) { cmCTestGenericHandler::t_StringToString::iterator remit @@ -51,14 +47,10 @@ void cmCTestGenericHandler::SetOption(const char* op, const char* value) } //---------------------------------------------------------------------- -void cmCTestGenericHandler::SetPersistentOption(const char* op, +void cmCTestGenericHandler::SetPersistentOption(const std::string& op, const char* value) { this->SetOption(op, value); - if ( !op ) - { - return; - } if ( !value ) { cmCTestGenericHandler::t_StringToString::iterator remit @@ -88,7 +80,7 @@ void cmCTestGenericHandler::Initialize() } //---------------------------------------------------------------------- -const char* cmCTestGenericHandler::GetOption(const char* op) +const char* cmCTestGenericHandler::GetOption(const std::string& op) { cmCTestGenericHandler::t_StringToString::iterator remit = this->Options.find(op); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index ba8febb61..d05e23023 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -74,9 +74,9 @@ public: typedef std::map t_StringToString; - void SetPersistentOption(const char* op, const char* value); - void SetOption(const char* op, const char* value); - const char* GetOption(const char* op); + void SetPersistentOption(const std::string& op, const char* value); + void SetOption(const std::string& op, const char* value); + const char* GetOption(const std::string& op); void SetCommand(cmCTestCommand* command) { diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 249137f52..7929ce76a 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -19,9 +19,10 @@ #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" -cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, - int labelwidth, - int entrywidth) : +cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( + const std::string& key, + int labelwidth, + int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { this->Label = new cmCursesLabelWidget(this->LabelWidth, 1, 1, 1, key); @@ -31,7 +32,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key, } cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( - const char* key, const cmCacheManager::CacheIterator& it, bool isNew, + const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth) : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth) { diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index 1357a02ec..98107cc70 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -18,8 +18,9 @@ class cmCursesCacheEntryComposite { public: - cmCursesCacheEntryComposite(const char* key, int labelwidth, int entrywidth); - cmCursesCacheEntryComposite(const char* key, + cmCursesCacheEntryComposite(const std::string& key, int labelwidth, + int entrywidth); + cmCursesCacheEntryComposite(const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew, int labelwidth, int entrywidth); ~cmCursesCacheEntryComposite(); diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index d94cd37fa..073492714 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -84,9 +84,9 @@ cmCursesMainForm::~cmCursesMainForm() } // See if a cache entry is in the list of entries in the ui. -bool cmCursesMainForm::LookForCacheEntry(const char* key) +bool cmCursesMainForm::LookForCacheEntry(const std::string& key) { - if (!key || !this->Entries) + if (!this->Entries) { return false; } @@ -94,7 +94,7 @@ bool cmCursesMainForm::LookForCacheEntry(const char* key) std::vector::iterator it; for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { - if (!strcmp(key, (*it)->Key.c_str())) + if (key == (*it)->Key) { return true; } @@ -146,7 +146,7 @@ void cmCursesMainForm::InitializeUI() this->CMakeInstance->GetCacheManager()->NewIterator(); !i.IsAtEnd(); i.Next()) { - const char* key = i.GetName(); + std::string key = i.GetName(); if ( i.GetType() == cmCacheManager::INTERNAL || i.GetType() == cmCacheManager::STATIC || i.GetType() == cmCacheManager::UNINITIALIZED ) @@ -168,7 +168,7 @@ void cmCursesMainForm::InitializeUI() this->CMakeInstance->GetCacheManager()->NewIterator(); !i.IsAtEnd(); i.Next()) { - const char* key = i.GetName(); + std::string key = i.GetName(); if ( i.GetType() == cmCacheManager::INTERNAL || i.GetType() == cmCacheManager::STATIC || i.GetType() == cmCacheManager::UNINITIALIZED ) diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 883a2b3d6..fba9bc50d 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -51,7 +51,7 @@ public: * Returns true if an entry with the given key is in the * list of current composites. */ - bool LookForCacheEntry(const char* key); + bool LookForCacheEntry(const std::string& key); enum { MIN_WIDTH = 65, diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index acedc1a36..39b623d3c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2593,13 +2593,9 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) } //---------------------------------------------------------------------- -void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, +void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, VectorOfStrings& vec) { - if ( !def) - { - return; - } const char* dval = mf->GetDefinition(def); if ( !dval ) { @@ -2620,12 +2616,9 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const char* def, } //---------------------------------------------------------------------- -void cmCTest::PopulateCustomInteger(cmMakefile* mf, const char* def, int& val) +void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def, + int& val) { - if ( !def) - { - return; - } const char* dval = mf->GetDefinition(def); if ( !dval ) { @@ -2702,7 +2695,7 @@ std::string cmCTest::GetShortPathToFile(const char* cfname) } //---------------------------------------------------------------------- -std::string cmCTest::GetCTestConfiguration(const char *name) +std::string cmCTest::GetCTestConfiguration(const std::string& name) { if ( this->CTestConfigurationOverwrites.find(name) != this->CTestConfigurationOverwrites.end() ) @@ -2877,7 +2870,7 @@ void cmCTest::SetConfigType(const char* ct) //---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const char* cmake_var) + const char* dconfig, const std::string& cmake_var) { const char* ctvar; ctvar = mf->GetDefinition(cmake_var); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index becb0f5a6..6418f0987 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -172,7 +172,7 @@ public: std::string GetTestModelString(); static int GetTestModelFromString(const char* str); static std::string CleanString(const std::string& str); - std::string GetCTestConfiguration(const char *name); + std::string GetCTestConfiguration(const std::string& name); void SetCTestConfiguration(const char *name, const char* value); void EmptyCTestConfiguration(); @@ -185,9 +185,9 @@ public: //! Set the notes files to be created. void SetNotesFiles(const char* notes); - void PopulateCustomVector(cmMakefile* mf, const char* definition, + void PopulateCustomVector(cmMakefile* mf, const std::string& definition, VectorOfStrings& vec); - void PopulateCustomInteger(cmMakefile* mf, const char* def, + void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); ///! Get the current time as string @@ -332,7 +332,7 @@ public: * Set the CTest variable from CMake variable */ bool SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, - const char* dconfig, const char* cmake_var); + const char* dconfig, const std::string& cmake_var); //! Make string safe to be send as an URL static std::string MakeURLSafe(const std::string&); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 04542d8c9..7a71482a1 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -650,7 +650,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout, } } -void cmCacheManager::RemoveCacheEntry(const char* key) +void cmCacheManager::RemoveCacheEntry(const std::string& key) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) @@ -660,7 +660,8 @@ void cmCacheManager::RemoveCacheEntry(const char* key) } -cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry(const char* key) +cmCacheManager::CacheEntry *cmCacheManager::GetCacheEntry( + const std::string& key) { CacheEntryMap::iterator i = this->Cache.find(key); if(i != this->Cache.end()) @@ -676,7 +677,7 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator( return CacheIterator(*this, key); } -const char* cmCacheManager::GetCacheValue(const char* key) const +const char* cmCacheManager::GetCacheValue(const std::string& key) const { CacheEntryMap::const_iterator i = this->Cache.find(key); if(i != this->Cache.end() && @@ -708,7 +709,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const } -void cmCacheManager::AddCacheEntry(const char* key, +void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, CacheEntryType type) @@ -767,7 +768,7 @@ void cmCacheManager::CacheIterator::Begin() this->Position = this->Container.Cache.begin(); } -bool cmCacheManager::CacheIterator::Find(const char* key) +bool cmCacheManager::CacheIterator::Find(const std::string& key) { this->Position = this->Container.Cache.find(key); return !this->IsAtEnd(); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index ac6187bfc..7a6139476 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -53,7 +53,7 @@ public: { public: void Begin(); - bool Find(const char*); + bool Find(const std::string&); bool IsAtEnd() const; void Next(); const char *GetName() const { @@ -129,7 +129,7 @@ public: cmCacheManager::CacheIterator GetCacheIterator(const char *key=0); ///! Remove an entry from the cache - void RemoveCacheEntry(const char* key); + void RemoveCacheEntry(const std::string& key); ///! Get the number of entries in the cache int GetSize() { @@ -142,7 +142,7 @@ public: CacheEntryType& type); ///! Get a value from the cache given a key - const char* GetCacheValue(const char* key) const; + const char* GetCacheValue(const std::string& key) const; /** Get the version of CMake that wrote the cache. */ unsigned int GetCacheMajorVersion() const @@ -153,11 +153,11 @@ public: protected: ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, + void AddCacheEntry(const std::string& key, const char* value, const char* helpString, CacheEntryType type); ///! Get a cache entry object for a key - CacheEntry *GetCacheEntry(const char *key); + CacheEntry *GetCacheEntry(const std::string& key); ///! Clean out the CMakeFiles directory if no CMakeCache.txt void CleanCMakeFiles(const char* path); diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 9d2870058..5fa387750 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -28,7 +28,7 @@ void cmDefinitions::Reset(cmDefinitions* parent) //---------------------------------------------------------------------------- cmDefinitions::Def const& -cmDefinitions::GetInternal(const char* key) +cmDefinitions::GetInternal(const std::string& key) { MapType::const_iterator i = this->Map.find(key); if(i != this->Map.end()) @@ -46,7 +46,7 @@ cmDefinitions::GetInternal(const char* key) //---------------------------------------------------------------------------- cmDefinitions::Def const& -cmDefinitions::SetInternal(const char* key, Def const& def) +cmDefinitions::SetInternal(const std::string& key, Def const& def) { if(this->Up || def.Exists) { @@ -71,14 +71,14 @@ cmDefinitions::SetInternal(const char* key, Def const& def) } //---------------------------------------------------------------------------- -const char* cmDefinitions::Get(const char* key) +const char* cmDefinitions::Get(const std::string& key) { Def const& def = this->GetInternal(key); return def.Exists? def.c_str() : 0; } //---------------------------------------------------------------------------- -const char* cmDefinitions::Set(const char* key, const char* value) +const char* cmDefinitions::Set(const std::string& key, const char* value) { Def const& def = this->SetInternal(key, Def(value)); return def.Exists? def.c_str() : 0; diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4834d8443..24dad29d5 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -35,10 +35,10 @@ public: /** Get the value associated with a key; null if none. Store the result locally if it came from a parent. */ - const char* Get(const char* key); + const char* Get(const std::string& key); /** Set (or unset if null) a value associated with a key. */ - const char* Set(const char* key, const char* value); + const char* Set(const std::string& key, const char* value); /** Get the set of all local keys. */ std::set LocalKeys() const; @@ -69,8 +69,8 @@ private: MapType Map; // Internal query and update methods. - Def const& GetInternal(const char* key); - Def const& SetInternal(const char* key, Def const& def); + Def const& GetInternal(const std::string& key); + Def const& SetInternal(const std::string& key, Def const& def); // Implementation of Closure() method. struct ClosureTag {}; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 79566a96d..c06f88966 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -151,7 +151,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty( //---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, - const cmStdString& outputName, + const std::string& outputName, cmTarget *target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 326fe36c0..f93e72a2a 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -174,7 +174,7 @@ protected: std::set ExportedTargets; private: - void PopulateInterfaceProperty(const std::string&, const cmStdString&, + void PopulateInterfaceProperty(const std::string&, const std::string&, cmTarget *target, cmGeneratorExpression::PreprocessContext, ImportPropertyMap &properties, diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index ae15ee724..86fd54b07 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -268,7 +268,7 @@ void cmFindBase::AddPrefixPaths(std::vector const& in_paths, } //---------------------------------------------------------------------------- -void cmFindBase::AddCMakePrefixPath(const char* variable) +void cmFindBase::AddCMakePrefixPath(const std::string& variable) { // Get a path from a CMake variable. if(const char* varPath = this->Makefile->GetDefinition(variable)) @@ -280,11 +280,11 @@ void cmFindBase::AddCMakePrefixPath(const char* variable) } //---------------------------------------------------------------------------- -void cmFindBase::AddEnvPrefixPath(const char* variable) +void cmFindBase::AddEnvPrefixPath(const std::string& variable) { // Get a path from the environment. std::vector tmp; - cmSystemTools::GetPath(tmp, variable); + cmSystemTools::GetPath(tmp, variable.c_str()); this->AddPrefixPaths(tmp, EnvPath); } diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index 0562b1b0a..e590d6e69 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -63,8 +63,8 @@ private: void AddUserGuessPath(); // Helpers. - void AddCMakePrefixPath(const char* variable); - void AddEnvPrefixPath(const char* variable); + void AddCMakePrefixPath(const std::string& variable); + void AddEnvPrefixPath(const std::string& variable); void AddPrefixPaths(std::vector const& in_paths, PathType pathType); }; diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index e8c8da35d..bd75e1054 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -374,7 +374,7 @@ void cmFindCommon::AddUserPath(std::string const& p, } //---------------------------------------------------------------------------- -void cmFindCommon::AddCMakePath(const char* variable) +void cmFindCommon::AddCMakePath(const std::string& variable) { // Get a path from a CMake variable. if(const char* varPath = this->Makefile->GetDefinition(variable)) diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 6109a9fd4..ba90a8498 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -63,7 +63,7 @@ protected: void AddPathSuffix(std::string const& arg); void AddUserPath(std::string const& p, std::vector& paths); - void AddCMakePath(const char* variable); + void AddCMakePath(const std::string& variable); void AddEnvPath(const char* variable); void AddPathsInternal(std::vector const& in_paths, PathType pathType); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 73eba517e..d557fba4a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -535,7 +535,8 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) } //---------------------------------------------------------------------------- -void cmFindPackageCommand::AddFindDefinition(const char* var, const char* val) +void cmFindPackageCommand::AddFindDefinition(const std::string& var, + const char* val) { if(const char* old = this->Makefile->GetDefinition(var)) { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 0d80e48e7..9819d4f54 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -57,7 +57,7 @@ private: void AppendToFoundProperty(bool found); void SetModuleVariables(const std::string& components); bool FindModule(bool& found); - void AddFindDefinition(const char* var, const char* val); + void AddFindDefinition(const std::string& var, const char* val); void RestoreFindDefinitions(); bool HandlePackageMode(); bool FindConfig(); diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ee95c0591..bd123275c 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -593,7 +593,7 @@ namespace if (argP1 != newArgs.end() && argP2 != newArgs.end() && *(argP1) == "MATCHES") { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); const char* rex = (argP2)->c_str(); cmStringCommand::ClearMatches(makefile); cmsys::RegularExpression regEntry; @@ -634,8 +634,8 @@ namespace (*(argP1) == "LESS" || *(argP1) == "GREATER" || *(argP1) == "EQUAL")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); double lhs; double rhs; bool result; @@ -665,8 +665,8 @@ namespace *(argP1) == "STREQUAL" || *(argP1) == "STRGREATER")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); int val = strcmp(def,def2); bool result; if (*(argP1) == "STRLESS") @@ -689,8 +689,8 @@ namespace (*(argP1) == "VERSION_LESS" || *(argP1) == "VERSION_GREATER" || *(argP1) == "VERSION_EQUAL")) { - def = cmIfCommand::GetVariableOrString(arg->c_str(), makefile); - def2 = cmIfCommand::GetVariableOrString((argP2)->c_str(), makefile); + def = cmIfCommand::GetVariableOrString(*arg, makefile); + def2 = cmIfCommand::GetVariableOrString(*argP2, makefile); cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL; if(*argP1 == "VERSION_LESS") { @@ -907,13 +907,13 @@ bool cmIfCommand::IsTrue(const std::vector &args, } //========================================================================= -const char* cmIfCommand::GetVariableOrString(const char* str, +const char* cmIfCommand::GetVariableOrString(const std::string& str, const cmMakefile* mf) { const char* def = mf->GetDefinition(str); if(!def) { - def = str; + def = str.c_str(); } return def; } diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index f2633adc4..02d87edee 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -79,7 +79,7 @@ public: // Get a definition from the makefile. If it doesn't exist, // return the original string. - static const char* GetVariableOrString(const char* str, + static const char* GetVariableOrString(const std::string& str, const cmMakefile* mf); cmTypeMacro(cmIfCommand, cmCommand); diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index df64695aa..20e760a8c 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -74,12 +74,9 @@ bool cmListCommand } //---------------------------------------------------------------------------- -bool cmListCommand::GetListString(std::string& listString, const char* var) +bool cmListCommand::GetListString(std::string& listString, + const std::string& var) { - if ( !var ) - { - return false; - } // get the old value const char* cacheValue = this->Makefile->GetDefinition(var); @@ -92,7 +89,8 @@ bool cmListCommand::GetListString(std::string& listString, const char* var) } //---------------------------------------------------------------------------- -bool cmListCommand::GetList(std::vector& list, const char* var) +bool cmListCommand::GetList(std::vector& list, + const std::string& var) { std::string listString; if ( !this->GetListString(listString, var) ) diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 0cb5da2a7..b79ff0d72 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -60,8 +60,8 @@ protected: bool HandleReverseCommand(std::vector const& args); - bool GetList(std::vector& list, const char* var); - bool GetListString(std::string& listString, const char* var); + bool GetList(std::vector& list, const std::string& var); + bool GetListString(std::string& listString, const std::string& var); }; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5bfd9da51..476c95d93 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2324,7 +2324,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, - const char* var, + const std::string& var, const char* config) { // Add the flags from the variable itself. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 888611db1..80a1421b0 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -145,7 +145,7 @@ public: std::string const& lang, const char *config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, const char *lang); - void AddConfigVariableFlags(std::string& flags, const char* var, + void AddConfigVariableFlags(std::string& flags, const std::string& var, const char* config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0fce1f410..edf33c19a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1769,7 +1769,7 @@ cmMakefile::AddSystemIncludeDirectories(const std::set &incs) } } -void cmMakefile::AddDefinition(const char* name, const char* value) +void cmMakefile::AddDefinition(const std::string& name, const char* value) { if (!value ) { @@ -1798,14 +1798,14 @@ void cmMakefile::AddDefinition(const char* name, const char* value) } -void cmMakefile::AddCacheDefinition(const char* name, const char* value, +void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmCacheManager::CacheEntryType type, bool force) { const char* val = value; cmCacheManager::CacheIterator it = - this->GetCacheManager()->GetCacheIterator(name); + this->GetCacheManager()->GetCacheIterator(name.c_str()); if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && it.Initialized()) { @@ -1845,7 +1845,7 @@ void cmMakefile::AddCacheDefinition(const char* name, const char* value, } -void cmMakefile::AddDefinition(const char* name, bool value) +void cmMakefile::AddDefinition(const std::string& name, bool value) { this->Internal->VarStack.top().Set(name, value? "ON" : "OFF"); if (this->Internal->VarUsageStack.size() && @@ -1880,12 +1880,12 @@ void cmMakefile::CheckForUnusedVariables() const } } -void cmMakefile::MarkVariableAsUsed(const char* var) +void cmMakefile::MarkVariableAsUsed(const std::string& var) { this->Internal->VarUsageStack.top().insert(var); } -bool cmMakefile::VariableInitialized(const char* var) const +bool cmMakefile::VariableInitialized(const std::string& var) const { if(this->Internal->VarInitStack.top().find(var) != this->Internal->VarInitStack.top().end()) @@ -1895,7 +1895,7 @@ bool cmMakefile::VariableInitialized(const char* var) const return false; } -bool cmMakefile::VariableUsed(const char* var) const +bool cmMakefile::VariableUsed(const std::string& var) const { if(this->Internal->VarUsageStack.top().find(var) != this->Internal->VarUsageStack.top().end()) @@ -1905,7 +1905,8 @@ bool cmMakefile::VariableUsed(const char* var) const return false; } -void cmMakefile::CheckForUnused(const char* reason, const char* name) const +void cmMakefile::CheckForUnused(const char* reason, + const std::string& name) const { if (this->WarnUnused && !this->VariableUsed(name)) { @@ -1943,7 +1944,7 @@ void cmMakefile::CheckForUnused(const char* reason, const char* name) const } } -void cmMakefile::RemoveDefinition(const char* name) +void cmMakefile::RemoveDefinition(const std::string& name) { this->Internal->VarStack.top().Set(name, 0); if (this->Internal->VarUsageStack.size() && @@ -1963,7 +1964,7 @@ void cmMakefile::RemoveDefinition(const char* name) #endif } -void cmMakefile::RemoveCacheDefinition(const char* name) +void cmMakefile::RemoveCacheDefinition(const std::string& name) { this->GetCacheManager()->RemoveCacheEntry(name); } @@ -2329,13 +2330,13 @@ void cmMakefile::ExpandVariablesCMP0019() } } -bool cmMakefile::IsOn(const char* name) const +bool cmMakefile::IsOn(const std::string& name) const { const char* value = this->GetDefinition(name); return cmSystemTools::IsOn(value); } -bool cmMakefile::IsSet(const char* name) const +bool cmMakefile::IsSet(const std::string& name) const { const char* value = this->GetDefinition(name); if ( !value ) @@ -2406,7 +2407,7 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const return true; } -const char* cmMakefile::GetRequiredDefinition(const char* name) const +const char* cmMakefile::GetRequiredDefinition(const std::string& name) const { const char* ret = this->GetDefinition(name); if(!ret) @@ -2414,13 +2415,13 @@ const char* cmMakefile::GetRequiredDefinition(const char* name) const cmSystemTools::Error("Error required internal CMake variable not " "set, cmake may be not be built correctly.\n", "Missing variable is:\n", - name); + name.c_str()); return ""; } return ret; } -bool cmMakefile::IsDefinitionSet(const char* name) const +bool cmMakefile::IsDefinitionSet(const std::string& name) const { const char* def = this->Internal->VarStack.top().Get(name); this->Internal->VarUsageStack.top().insert(name); @@ -2442,7 +2443,7 @@ bool cmMakefile::IsDefinitionSet(const char* name) const return def?true:false; } -const char* cmMakefile::GetDefinition(const char* name) const +const char* cmMakefile::GetDefinition(const std::string& name) const { if (this->WarnUnused) { @@ -2483,7 +2484,7 @@ const char* cmMakefile::GetDefinition(const char* name) const return def; } -const char* cmMakefile::GetSafeDefinition(const char* def) const +const char* cmMakefile::GetSafeDefinition(const std::string& def) const { const char* ret = this->GetDefinition(def); if(!ret) @@ -3995,7 +3996,7 @@ void cmMakefile::PopScope() } } -void cmMakefile::RaiseScope(const cmStdString& var, const char *varDef) +void cmMakefile::RaiseScope(const std::string& var, const char *varDef) { if (var.empty()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 5f4b803d3..fc71ab743 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -69,11 +69,11 @@ public: /* Check for unused variables in this scope */ void CheckForUnusedVariables() const; /* Mark a variable as used */ - void MarkVariableAsUsed(const char* var); + void MarkVariableAsUsed(const std::string& var); /* return true if a variable has been initialized */ - bool VariableInitialized(const char* ) const; + bool VariableInitialized(const std::string& ) const; /* return true if a variable has been used */ - bool VariableUsed(const char* ) const; + bool VariableUsed(const std::string& ) const; /** Return whether compatibility features needed for a version of the cache or lower should be enabled. */ bool NeedCacheCompatibility(int major, int minor) const; @@ -283,9 +283,9 @@ public: * Add a variable definition to the build. This variable * can be used in CMake to refer to lists, directories, etc. */ - void AddDefinition(const char* name, const char* value); + void AddDefinition(const std::string& name, const char* value); ///! Add a definition to this makefile and the global cmake cache. - void AddCacheDefinition(const char* name, const char* value, + void AddCacheDefinition(const std::string& name, const char* value, const char* doc, cmCacheManager::CacheEntryType type, bool force = false); @@ -293,15 +293,15 @@ public: /** * Add bool variable definition to the build. */ - void AddDefinition(const char* name, bool); + void AddDefinition(const std::string& name, bool); /** * Remove a variable definition from the build. This is not valid * for cache entries, and will only affect the current makefile. */ - void RemoveDefinition(const char* name); + void RemoveDefinition(const std::string& name); ///! Remove a definition from the cache. - void RemoveCacheDefinition(const char* name); + void RemoveCacheDefinition(const std::string& name); /** * Specify the name of the project for this build. @@ -587,10 +587,10 @@ public: * If the variable is not found in this makefile instance, the * cache is then queried. */ - const char* GetDefinition(const char*) const; - const char* GetSafeDefinition(const char*) const; - const char* GetRequiredDefinition(const char* name) const; - bool IsDefinitionSet(const char*) const; + const char* GetDefinition(const std::string&) const; + const char* GetSafeDefinition(const std::string&) const; + const char* GetRequiredDefinition(const std::string& name) const; + bool IsDefinitionSet(const std::string&) const; /** * Get the list of all variables in the current space. If argument * cacheonly is specified and is greater than 0, then only cache @@ -601,8 +601,8 @@ public: /** Test a boolean cache entry to see if it is true or false, * returns false if no entry defined. */ - bool IsOn(const char* name) const; - bool IsSet(const char* name) const; + bool IsOn(const std::string& name) const; + bool IsSet(const std::string& name) const; /** Return whether the target platform is 64-bit. */ bool PlatformIs64Bit() const; @@ -837,7 +837,7 @@ public: // push and pop variable scopes void PushScope(); void PopScope(); - void RaiseScope(const cmStdString& var, const char *value); + void RaiseScope(const std::string& var, const char *value); /** Helper class to push and pop scopes automatically. */ class ScopePushPop @@ -882,7 +882,7 @@ protected: void AddGlobalLinkInformation(const char* name, cmTarget& target); // Check for a an unused variable - void CheckForUnused(const char* reason, const char* name) const; + void CheckForUnused(const char* reason, const std::string& name) const; std::string Prefix; std::vector AuxSourceDirectories; // diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 39e00b231..10418d0a3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -237,7 +237,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteLibraryRules -(const char* linkRuleVar, const char* extraFlags, bool relink) +(const std::string& linkRuleVar, const std::string& extraFlags, bool relink) { // TODO: Merge the methods that call this method to avoid // code duplication. @@ -261,7 +261,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->LocalGenerator->AppendFlags(linkFlags, extraFlags.c_str()); // Add OSX version flags, if any. if(this->Target->GetType() == cmTarget::SHARED_LIBRARY || diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 1487b56b1..4873516c8 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -30,7 +30,8 @@ protected: void WriteStaticLibraryRules(); void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); - void WriteLibraryRules(const char *linkRule, const char *extraFlags, + void WriteLibraryRules(const std::string& linkRule, + const std::string& extraFlags, bool relink); // MacOSX Framework support methods void WriteFrameworkRules(bool relink); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index facbcc621..bf0dc5141 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1682,7 +1682,8 @@ void cmMakefileTargetGenerator } //---------------------------------------------------------------------------- -std::string cmMakefileTargetGenerator::GetLinkRule(const char* linkRuleVar) +std::string cmMakefileTargetGenerator::GetLinkRule( + const cmStdString& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); if(this->Target->HasImplibGNUtoMS()) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 72dc6bc61..f960afc14 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -138,7 +138,7 @@ protected: void AppendLinkDepends(std::vector& depends); // Lookup the link rule for this target. - std::string GetLinkRule(const char* linkRuleVar); + std::string GetLinkRule(const cmStdString& linkRuleVar); /** In order to support parallel builds for custom commands with multiple outputs the outputs are given a serial order, and only diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 3b6a49bf7..7a8efc10c 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -15,7 +15,7 @@ //---------------------------------------------------------------------------- cmScriptGenerator -::cmScriptGenerator(const char* config_var, +::cmScriptGenerator(const std::string& config_var, std::vector const& configurations): RuntimeConfigVariable(config_var), Configurations(configurations), diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 8b2ca335f..3515e204e 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -47,7 +47,7 @@ inline std::ostream& operator<<(std::ostream& os, class cmScriptGenerator { public: - cmScriptGenerator(const char* config_var, + cmScriptGenerator(const std::string& config_var, std::vector const& configurations); virtual ~cmScriptGenerator(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 149e299b5..ad1d0fafb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1202,7 +1202,7 @@ struct SaveCacheEntry cmCacheManager::CacheEntryType type; }; -int cmake::HandleDeleteCacheVariables(const char* var) +int cmake::HandleDeleteCacheVariables(const std::string& var) { std::vector argsSplit; cmSystemTools::ExpandListArgument(std::string(var), argsSplit, true); @@ -1725,7 +1725,7 @@ int cmake::Generate() return 0; } -void cmake::AddCacheEntry(const char* key, const char* value, +void cmake::AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type) { @@ -1734,7 +1734,7 @@ void cmake::AddCacheEntry(const char* key, const char* value, cmCacheManager::CacheEntryType(type)); } -const char* cmake::GetCacheDefinition(const char* name) const +const char* cmake::GetCacheDefinition(const std::string& name) const { return this->CacheManager->GetCacheValue(name); } @@ -2676,7 +2676,7 @@ int cmake::Build(const std::string& dir, nativeOptions); } -void cmake::WatchUnusedCli(const char* var) +void cmake::WatchUnusedCli(const std::string& var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->AddWatch(var, cmWarnUnusedCliWarning, this); @@ -2687,7 +2687,7 @@ void cmake::WatchUnusedCli(const char* var) #endif } -void cmake::UnwatchUnusedCli(const char* var) +void cmake::UnwatchUnusedCli(const std::string& var) { #ifdef CMAKE_BUILD_WITH_CMAKE this->VariableWatch->RemoveWatch(var, cmWarnUnusedCliWarning); diff --git a/Source/cmake.h b/Source/cmake.h index e89868c7b..2d78e8f00 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -203,9 +203,9 @@ class cmake /** * Given a variable name, return its value (as a string). */ - const char* GetCacheDefinition(const char*) const; + const char* GetCacheDefinition(const std::string&) const; ///! Add an entry into the cache - void AddCacheEntry(const char* key, const char* value, + void AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type); @@ -357,12 +357,12 @@ class cmake const std::vector& nativeOptions, bool clean); - void UnwatchUnusedCli(const char* var); - void WatchUnusedCli(const char* var); + void UnwatchUnusedCli(const std::string& var); + void WatchUnusedCli(const std::string& var); protected: void RunCheckForUnusedVariables(); void InitializeProperties(); - int HandleDeleteCacheVariables(const char* var); + int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; std::set > AccessedProperties; From 381d50c149183183378b446fd789b1bd18c7524c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Jan 2014 13:38:27 -0500 Subject: [PATCH 101/278] stringapi: Accept strings in cmStrCmp --- Source/cmQtAutoGenerators.cxx | 4 ++-- Source/cmStandardIncludes.h | 11 ++++++++--- Source/cmTarget.cxx | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 7d0ce5f6d..d940fe24d 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -660,7 +660,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); @@ -831,7 +831,7 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector &opts, ++o; } if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions), - cmStrCmp(o)) != cmArrayEnd(valueOptions)) + cmStrCmp(*it)) != cmArrayEnd(valueOptions)) { assert(existingIt + 1 != opts.end()); *(existingIt + 1) = *(it + 1); diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index b4ae65760..04e1bc840 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -449,11 +449,16 @@ bool cmHasLiteralSuffix(T str1, const char (&str2)[N]) struct cmStrCmp { cmStrCmp(const char *test) : m_test(test) {} - cmStrCmp(std::string &test) : m_test(test.c_str()) {} + cmStrCmp(const std::string &test) : m_test(test) {} + + bool operator()(const std::string& input) const + { + return m_test == input; + } bool operator()(const char * input) const { - return strcmp(input, m_test) == 0; + return strcmp(input, m_test.c_str()) == 0; } // For use with binary_search @@ -463,7 +468,7 @@ struct cmStrCmp { } private: - const char * const m_test; + const cmStdString m_test; }; #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc2ab252a..d5cd140b9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1314,7 +1314,7 @@ static bool whiteListedInterfaceProperty(const std::string& prop) if (std::binary_search(cmArrayBegin(builtIns), cmArrayEnd(builtIns), prop.c_str(), - cmStrCmp(prop.c_str()))) + cmStrCmp(prop))) { return true; } From f29754573d2b2a199f17be80eb01ae309699bb23 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:06:17 -0500 Subject: [PATCH 102/278] stringapi: Accept string parameters in methods which store to strings --- Source/cmMakefile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fc71ab743..79931adb8 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -494,7 +494,7 @@ public: * Set a regular expression that include files that are not found * must match in order to be considered a problem. */ - void SetComplainRegularExpression(const char* regex) + void SetComplainRegularExpression(const std::string& regex) { this->ComplainFileRegularExpression = regex; } From 22c54a109050d026269f57dddc0ce0f146fc149d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 31 Jan 2014 10:45:30 -0500 Subject: [PATCH 103/278] makefile: Remove an unused method --- Source/cmMakefile.cxx | 10 ---------- Source/cmMakefile.h | 1 - 2 files changed, 11 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index edf33c19a..76b3b09fe 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3662,16 +3662,6 @@ void cmMakefile::AppendProperty(const std::string& prop, this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); } -const char *cmMakefile::GetPropertyOrDefinition(const std::string& prop) const -{ - const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); - if (!ret) - { - ret = this->GetDefinition(prop.c_str()); - } - return ret; -} - const char *cmMakefile::GetProperty(const std::string& prop) const { return this->GetProperty(prop, cmProperty::DIRECTORY); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 79931adb8..559d49cc1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -804,7 +804,6 @@ public: void AppendProperty(const std::string& prop, const char *value, bool asString=false); const char *GetProperty(const std::string& prop) const; - const char *GetPropertyOrDefinition(const std::string& prop) const; const char *GetProperty(const std::string& prop, cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; From 24e8b929eef74098d4ddf4581619322e0f4b5108 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 13:59:50 -0500 Subject: [PATCH 104/278] genex: Store predicates as a map for faster searching May warrant a fast path for predicates which more frequently. --- Source/cmGeneratorExpressionEvaluator.cxx | 135 +++++++++------------- 1 file changed, 52 insertions(+), 83 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index bdefcfb28..c27c03f20 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1555,89 +1555,58 @@ TargetFilesystemArtifact targetSoNameFileDirNode; static const cmGeneratorExpressionNode* GetNode(const std::string &identifier) { - if (identifier == "0") - return &zeroNode; - else if (identifier == "1") - return &oneNode; - else if (identifier == "AND") - return &andNode; - else if (identifier == "OR") - return &orNode; - else if (identifier == "NOT") - return ¬Node; - else if (identifier == "C_COMPILER_ID") - return &cCompilerIdNode; - else if (identifier == "CXX_COMPILER_ID") - return &cxxCompilerIdNode; - else if (identifier == "VERSION_GREATER") - return &versionGreaterNode; - else if (identifier == "VERSION_LESS") - return &versionLessNode; - else if (identifier == "VERSION_EQUAL") - return &versionEqualNode; - else if (identifier == "C_COMPILER_VERSION") - return &cCompilerVersionNode; - else if (identifier == "CXX_COMPILER_VERSION") - return &cxxCompilerVersionNode; - else if (identifier == "PLATFORM_ID") - return &platformIdNode; - else if (identifier == "CONFIGURATION") - return &configurationNode; - else if (identifier == "CONFIG") - return &configurationTestNode; - else if (identifier == "TARGET_FILE") - return &targetFileNode; - else if (identifier == "TARGET_LINKER_FILE") - return &targetLinkerFileNode; - else if (identifier == "TARGET_SONAME_FILE") - return &targetSoNameFileNode; - else if (identifier == "TARGET_FILE_NAME") - return &targetFileNameNode; - else if (identifier == "TARGET_LINKER_FILE_NAME") - return &targetLinkerFileNameNode; - else if (identifier == "TARGET_SONAME_FILE_NAME") - return &targetSoNameFileNameNode; - else if (identifier == "TARGET_FILE_DIR") - return &targetFileDirNode; - else if (identifier == "TARGET_LINKER_FILE_DIR") - return &targetLinkerFileDirNode; - else if (identifier == "TARGET_SONAME_FILE_DIR") - return &targetSoNameFileDirNode; - else if (identifier == "STREQUAL") - return &strEqualNode; - else if (identifier == "EQUAL") - return &equalNode; - else if (identifier == "LOWER_CASE") - return &lowerCaseNode; - else if (identifier == "UPPER_CASE") - return &upperCaseNode; - else if (identifier == "MAKE_C_IDENTIFIER") - return &makeCIdentifierNode; - else if (identifier == "BOOL") - return &boolNode; - else if (identifier == "ANGLE-R") - return &angle_rNode; - else if (identifier == "COMMA") - return &commaNode; - else if (identifier == "SEMICOLON") - return &semicolonNode; - else if (identifier == "TARGET_PROPERTY") - return &targetPropertyNode; - else if (identifier == "TARGET_NAME") - return &targetNameNode; - else if (identifier == "TARGET_POLICY") - return &targetPolicyNode; - else if (identifier == "BUILD_INTERFACE") - return &buildInterfaceNode; - else if (identifier == "INSTALL_INTERFACE") - return &installInterfaceNode; - else if (identifier == "INSTALL_PREFIX") - return &installPrefixNode; - else if (identifier == "JOIN") - return &joinNode; - else if (identifier == "LINK_ONLY") - return &linkOnlyNode; - return 0; + typedef std::map NodeMap; + static NodeMap nodeMap; + if (nodeMap.empty()) + { + nodeMap["0"] = &zeroNode; + nodeMap["1"] = &oneNode; + nodeMap["AND"] = &andNode; + nodeMap["OR"] = &orNode; + nodeMap["NOT"] = ¬Node; + nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; + nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; + nodeMap["VERSION_GREATER"] = &versionGreaterNode; + nodeMap["VERSION_LESS"] = &versionLessNode; + nodeMap["VERSION_EQUAL"] = &versionEqualNode; + nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; + nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; + nodeMap["PLATFORM_ID"] = &platformIdNode; + nodeMap["CONFIGURATION"] = &configurationNode; + nodeMap["CONFIG"] = &configurationTestNode; + nodeMap["TARGET_FILE"] = &targetFileNode; + nodeMap["TARGET_LINKER_FILE"] = &targetLinkerFileNode; + nodeMap["TARGET_SONAME_FILE"] = &targetSoNameFileNode; + nodeMap["TARGET_FILE_NAME"] = &targetFileNameNode; + nodeMap["TARGET_LINKER_FILE_NAME"] = &targetLinkerFileNameNode; + nodeMap["TARGET_SONAME_FILE_NAME"] = &targetSoNameFileNameNode; + nodeMap["TARGET_FILE_DIR"] = &targetFileDirNode; + nodeMap["TARGET_LINKER_FILE_DIR"] = &targetLinkerFileDirNode; + nodeMap["TARGET_SONAME_FILE_DIR"] = &targetSoNameFileDirNode; + nodeMap["STREQUAL"] = &strEqualNode; + nodeMap["EQUAL"] = &equalNode; + nodeMap["LOWER_CASE"] = &lowerCaseNode; + nodeMap["UPPER_CASE"] = &upperCaseNode; + nodeMap["MAKE_C_IDENTIFIER"] = &makeCIdentifierNode; + nodeMap["BOOL"] = &boolNode; + nodeMap["ANGLE-R"] = &angle_rNode; + nodeMap["COMMA"] = &commaNode; + nodeMap["SEMICOLON"] = &semicolonNode; + nodeMap["TARGET_PROPERTY"] = &targetPropertyNode; + nodeMap["TARGET_NAME"] = &targetNameNode; + nodeMap["TARGET_POLICY"] = &targetPolicyNode; + nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; + nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; + nodeMap["INSTALL_PREFIX"] = &installPrefixNode; + nodeMap["JOIN"] = &joinNode; + nodeMap["LINK_ONLY"] = &linkOnlyNode; + } + NodeMap::const_iterator i = nodeMap.find(identifier); + if (i == nodeMap.end()) + { + return 0; + } + return i->second; } From 310ef08fed57b1c60ea8dc8ed98520e2cb0bff4e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 14:05:57 -0500 Subject: [PATCH 105/278] stringapi: Use strings for source names --- Source/cmMakefile.cxx | 31 +++++++++++++------------------ Source/cmMakefile.h | 14 +++++++------- Source/cmSourceFile.cxx | 2 +- Source/cmSourceFile.h | 2 +- Source/cmSourceFileLocation.cxx | 13 +++++++------ Source/cmSourceFileLocation.h | 8 ++++---- Source/cmSourceGroup.cxx | 2 +- Source/cmSourceGroup.h | 2 +- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 2 +- 10 files changed, 37 insertions(+), 41 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 76b3b09fe..97628f386 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2060,9 +2060,8 @@ cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name) } cmSourceFile* -cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const +cmMakefile::LinearGetSourceFileWithOutput(const std::string& name) const { - std::string name = cname; std::string out; // look through all the source files that have custom commands @@ -2096,15 +2095,14 @@ cmMakefile::LinearGetSourceFileWithOutput(const char *cname) const return 0; } -cmSourceFile *cmMakefile::GetSourceFileWithOutput(const char *cname) const +cmSourceFile *cmMakefile::GetSourceFileWithOutput( + const std::string& name) const { - std::string name = cname; - // If the queried path is not absolute we use the backward compatible // linear-time search for an output with a matching suffix. - if(!cmSystemTools::FileIsFullPath(cname)) + if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(cname); + return LinearGetSourceFileWithOutput(name.c_str()); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); @@ -2149,15 +2147,12 @@ cmMakefile::GetSourceGroup(const std::vector&name) const return sg; } - void cmMakefile::AddSourceGroup(const char* name, +void cmMakefile::AddSourceGroup(const std::string& name, const char* regex) { - if (name) - { - std::vector nameVector; - nameVector.push_back(name); - AddSourceGroup(nameVector, regex); - } + std::vector nameVector; + nameVector.push_back(name); + AddSourceGroup(nameVector, regex); } void cmMakefile::AddSourceGroup(const std::vector& name, @@ -3011,9 +3006,9 @@ void cmMakefile::SetArgcArgv(const std::vector& args) } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetSource(const char* sourceName) const +cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const { - cmSourceFileLocation sfl(this, sourceName); + cmSourceFileLocation sfl(this, sourceName.c_str()); for(std::vector::const_iterator sfi = this->SourceFiles.begin(); sfi != this->SourceFiles.end(); ++sfi) @@ -3028,7 +3023,7 @@ cmSourceFile* cmMakefile::GetSource(const char* sourceName) const } //---------------------------------------------------------------------------- -cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, +cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, bool generated) { if(cmSourceFile* esf = this->GetSource(sourceName)) @@ -3037,7 +3032,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const char* sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName); + cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str()); if(generated) { sf->SetProperty("GENERATED", "1"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 559d49cc1..a8ad1e21b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -332,7 +332,7 @@ public: /** * Add a root source group for consideration when adding a new source. */ - void AddSourceGroup(const char* name, const char* regex=0); + void AddSourceGroup(const std::string& name, const char* regex=0); /** * Add a source group for consideration when adding a new source. @@ -555,14 +555,14 @@ public: /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then a null pointer is returned. */ - cmSourceFile* GetSource(const char* sourceName) const; + cmSourceFile* GetSource(const std::string& sourceName) const; /** Get a cmSourceFile pointer for a given source name, if the name is * not found, then create the source file and return it. generated * indicates if it is a generated file, this is used in determining * how to create the source file instance e.g. name */ - cmSourceFile* GetOrCreateSource(const char* sourceName, + cmSourceFile* GetOrCreateSource(const std::string& sourceName, bool generated = false); /** @@ -773,7 +773,7 @@ public: * Is there a source file that has the provided source file as an output? * if so then return it */ - cmSourceFile *GetSourceFileWithOutput(const char *outName) const; + cmSourceFile *GetSourceFileWithOutput(const std::string& outName) const; /** * Add a macro to the list of macros. The arguments should be name of the @@ -1030,12 +1030,12 @@ private: bool GeneratingBuildSystem; /** - * Old version of GetSourceFileWithOutput(const char*) kept for + * Old version of GetSourceFileWithOutput(const std::string&) kept for * backward-compatibility. It implements a linear search and support * relative file paths. It is used as a fall back by - * GetSourceFileWithOutput(const char*). + * GetSourceFileWithOutput(const std::string&). */ - cmSourceFile *LinearGetSourceFileWithOutput(const char *cname) const; + cmSourceFile *LinearGetSourceFileWithOutput(const std::string& cname) const; // A map for fast output to input look up. #if defined(CMAKE_BUILD_WITH_CMAKE) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index dd95f23da..9feda6c38 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -18,7 +18,7 @@ #include "cmake.h" //---------------------------------------------------------------------------- -cmSourceFile::cmSourceFile(cmMakefile* mf, const char* name): +cmSourceFile::cmSourceFile(cmMakefile* mf, const std::string& name): Location(mf, name) { this->CustomCommand = 0; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 85d63323c..833a490a3 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -31,7 +31,7 @@ public: * Construct with the makefile storing the source and the initial * name referencing it. */ - cmSourceFile(cmMakefile* mf, const char* name); + cmSourceFile(cmMakefile* mf, const std::string& name); ~cmSourceFile(); diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 5a8578b76..832a6a79d 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -18,9 +18,10 @@ //---------------------------------------------------------------------------- cmSourceFileLocation -::cmSourceFileLocation(cmMakefile const* mf, const char* name): Makefile(mf) +::cmSourceFileLocation(cmMakefile const* mf, const std::string& name) + : Makefile(mf) { - this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name); + this->AmbiguousDirectory = !cmSystemTools::FileIsFullPath(name.c_str()); this->AmbiguousExtension = true; this->Directory = cmSystemTools::GetFilenamePath(name); this->Name = cmSystemTools::GetFilenameName(name); @@ -28,7 +29,7 @@ cmSourceFileLocation } //---------------------------------------------------------------------------- -void cmSourceFileLocation::Update(const char* name) +void cmSourceFileLocation::Update(const std::string& name) { if(this->AmbiguousDirectory) { @@ -80,7 +81,7 @@ void cmSourceFileLocation::DirectoryUseBinary() } //---------------------------------------------------------------------------- -void cmSourceFileLocation::UpdateExtension(const char* name) +void cmSourceFileLocation::UpdateExtension(const std::string& name) { // Check the extension. std::string ext = cmSystemTools::GetFilenameLastExtension(name); @@ -136,10 +137,10 @@ void cmSourceFileLocation::UpdateExtension(const char* name) } //---------------------------------------------------------------------------- -void cmSourceFileLocation::UpdateDirectory(const char* name) +void cmSourceFileLocation::UpdateDirectory(const std::string& name) { // If a full path was given we know the directory. - if(cmSystemTools::FileIsFullPath(name)) + if(cmSystemTools::FileIsFullPath(name.c_str())) { this->Directory = cmSystemTools::GetFilenamePath(name); this->AmbiguousDirectory = false; diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index c03eee7f2..64b8c1fd5 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -33,7 +33,7 @@ public: * Construct for a source file created in a given cmMakefile * instance with an initial name. */ - cmSourceFileLocation(cmMakefile const* mf, const char* name); + cmSourceFileLocation(cmMakefile const* mf, const std::string& name); /** * Return whether the givne source file location could refers to the @@ -93,9 +93,9 @@ private: // Update the location with additional knowledge. void Update(cmSourceFileLocation const& loc); - void Update(const char* name); - void UpdateExtension(const char* name); - void UpdateDirectory(const char* name); + void Update(const std::string& name); + void UpdateExtension(const std::string& name); + void UpdateDirectory(const std::string& name); }; #endif diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index d272b6cd0..195feb5ff 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -73,7 +73,7 @@ void cmSourceGroup::SetGroupRegex(const char* regex) } //---------------------------------------------------------------------------- -void cmSourceGroup::AddGroupFile(const char* name) +void cmSourceGroup::AddGroupFile(const std::string& name) { this->GroupFiles.insert(name); } diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 3bbdef97a..2d891d1d5 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -46,7 +46,7 @@ public: /** * Add a file name to the explicit list of files for this group. */ - void AddGroupFile(const char* name); + void AddGroupFile(const std::string& name); /** * Add child to this sourcegroup diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d5cd140b9..34d92fa0f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -592,7 +592,7 @@ void cmTarget::AddSources(std::vector const& srcs) } //---------------------------------------------------------------------------- -cmSourceFile* cmTarget::AddSource(const char* s) +cmSourceFile* cmTarget::AddSource(const std::string& s) { std::string src = s; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f0dd7087e..9f7b811bd 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -143,7 +143,7 @@ public: * Add sources to the target. */ void AddSources(std::vector const& srcs); - cmSourceFile* AddSource(const char* src); + cmSourceFile* AddSource(const std::string& src); enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; From 971eb4d56e3d3c9bc11acf6082e21d5388d808bb Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 17:00:21 -0500 Subject: [PATCH 106/278] stringapi: Use strings for TryFullPath --- Source/cmSourceFile.cxx | 9 +++++---- Source/cmSourceFile.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 9feda6c38..f05204496 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -164,7 +164,7 @@ bool cmSourceFile::FindFullPath(std::string* error) } tryPath += this->Location.GetName(); tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di); - if(this->TryFullPath(tryPath.c_str(), 0)) + if(this->TryFullPath(tryPath.c_str(), "")) { return true; } @@ -217,10 +217,11 @@ bool cmSourceFile::FindFullPath(std::string* error) } //---------------------------------------------------------------------------- -bool cmSourceFile::TryFullPath(const char* tp, const char* ext) +bool cmSourceFile::TryFullPath(const std::string& path, + const std::string& ext) { - std::string tryPath = tp; - if(ext && *ext) + std::string tryPath = path; + if(!ext.empty()) { tryPath += "."; tryPath += ext; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 833a490a3..b362c986e 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -107,7 +107,7 @@ private: bool FindFullPathFailed; bool FindFullPath(std::string* error); - bool TryFullPath(const char* tryPath, const char* ext); + bool TryFullPath(const std::string& path, const std::string& ext); void CheckExtension(); void CheckLanguage(std::string const& ext); From 9f48d3bac22118fc1dddbf1eec6da4cb24c585c4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:04:22 -0500 Subject: [PATCH 107/278] stringapi: Use strings in CPack generator parameters Most of these are turned into strings in the body of the method (multiple times in some cases). Accept strings to simplify the API and keep string construction down. --- Source/CPack/cmCPackGenerator.cxx | 12 +++++++----- Source/CPack/cmCPackGenerator.h | 14 ++++++++------ Source/CPack/cmCPackGeneratorFactory.cxx | 13 +++++-------- Source/CPack/cmCPackGeneratorFactory.h | 6 +++--- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index b46fd8623..bed3891c0 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1482,8 +1482,8 @@ bool cmCPackGenerator::WantsComponentInstallation() const //---------------------------------------------------------------------- cmCPackInstallationType* -cmCPackGenerator::GetInstallationType(const char *projectName, - const char *name) +cmCPackGenerator::GetInstallationType(const std::string& projectName, + const std::string& name) { (void) projectName; bool hasInstallationType = this->InstallationTypes.count(name) != 0; @@ -1514,7 +1514,8 @@ cmCPackGenerator::GetInstallationType(const char *projectName, //---------------------------------------------------------------------- cmCPackComponent* -cmCPackGenerator::GetComponent(const char *projectName, const char *name) +cmCPackGenerator::GetComponent(const std::string& projectName, + const std::string& name) { bool hasComponent = this->Components.count(name) != 0; cmCPackComponent *component = &this->Components[name]; @@ -1582,7 +1583,7 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) ++installTypesIt) { component->InstallationTypes.push_back( - this->GetInstallationType(projectName, installTypesIt->c_str())); + this->GetInstallationType(projectName, *installTypesIt)); } } @@ -1609,7 +1610,8 @@ cmCPackGenerator::GetComponent(const char *projectName, const char *name) //---------------------------------------------------------------------- cmCPackComponentGroup* -cmCPackGenerator::GetComponentGroup(const char *projectName, const char *name) +cmCPackGenerator::GetComponentGroup(const std::string& projectName, + const std::string& name) { (void) projectName; std::string macroPrefix = "CPACK_COMPONENT_GROUP_" diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 39ef64da7..7e7c94f2b 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -245,12 +245,14 @@ protected: * @return true if component installation is supported and wanted. */ virtual bool WantsComponentInstallation() const; - virtual cmCPackInstallationType* GetInstallationType(const char *projectName, - const char* name); - virtual cmCPackComponent* GetComponent(const char *projectName, - const char* name); - virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName, - const char* name); + virtual cmCPackInstallationType* GetInstallationType( + const std::string& projectName, + const std::string& name); + virtual cmCPackComponent* GetComponent(const std::string& projectName, + const std::string& name); + virtual cmCPackComponentGroup* GetComponentGroup( + const std::string& projectName, + const std::string& name); cmSystemTools::OutputOption GeneratorVerbose; std::string Name; diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index b36c2a2f8..9faf2b0fe 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -151,7 +151,8 @@ cmCPackGeneratorFactory::~cmCPackGeneratorFactory() } //---------------------------------------------------------------------- -cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) +cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator( + const std::string& name) { cmCPackGenerator* gen = this->NewGeneratorInternal(name); if ( !gen ) @@ -165,12 +166,8 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(const char* name) //---------------------------------------------------------------------- cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( - const char* name) + const std::string& name) { - if ( !name ) - { - return 0; - } cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it = this->GeneratorCreators.find(name); if ( it == this->GeneratorCreators.end() ) @@ -181,11 +178,11 @@ cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal( } //---------------------------------------------------------------------- -void cmCPackGeneratorFactory::RegisterGenerator(const char* name, +void cmCPackGeneratorFactory::RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator) { - if ( !name || !createGenerator ) + if ( !createGenerator ) { cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR, "Cannot register generator" << std::endl); diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index dff2e49eb..e6f74f9e8 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -31,12 +31,12 @@ public: ~cmCPackGeneratorFactory(); //! Get the generator - cmCPackGenerator* NewGenerator(const char* name); + cmCPackGenerator* NewGenerator(const std::string& name); void DeleteGenerator(cmCPackGenerator* gen); typedef cmCPackGenerator* CreateGeneratorCall(); - void RegisterGenerator(const char* name, + void RegisterGenerator(const std::string& name, const char* generatorDescription, CreateGeneratorCall* createGenerator); @@ -47,7 +47,7 @@ public: { return this->GeneratorDescriptions; } private: - cmCPackGenerator* NewGeneratorInternal(const char* name); + cmCPackGenerator* NewGeneratorInternal(const std::string& name); std::vector Generators; typedef std::map t_GeneratorCreatorsMap; From b26c70cc9a59de5b8ece8b00b67d571aaf6ee8f0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:16:12 -0500 Subject: [PATCH 108/278] stringapi: Use strings for AddString methods It gets turned into a string anyways, so pass them in. --- Source/cmCommandArgumentParserHelper.cxx | 12 ++++++------ Source/cmCommandArgumentParserHelper.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmXCodeObject.cxx | 2 +- Source/cmXCodeObject.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index dbeeb0793..6284cb77c 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -49,14 +49,14 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file) this->FileName = file; } -char* cmCommandArgumentParserHelper::AddString(const char* str) +char* cmCommandArgumentParserHelper::AddString(const std::string& str) { - if ( !str || !*str ) + if ( str.empty() ) { return this->EmptyVariable; } - char* stVal = new char[strlen(str)+1]; - strcpy(stVal, str); + char* stVal = new char[str.size()+1]; + strcpy(stVal, str.c_str()); this->Variables.push_back(stVal); return stVal; } @@ -153,7 +153,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); } - return this->AddString(value); + return this->AddString(value ? value : ""); } char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) @@ -166,7 +166,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) // then return an empty string if(!ret && this->RemoveEmpty) { - return this->AddString(ret); + return this->AddString(""); } // if the ret was not 0, then return it if(ret) diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index f8c672fef..da00124ef 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -86,7 +86,7 @@ private: void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); - char* AddString(const char* str); + char* AddString(const std::string& str); void CleanupParser(); void SetError(std::string const& msg); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 004f7acf1..ab92c6e49 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -613,7 +613,7 @@ cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) //---------------------------------------------------------------------------- cmXCodeObject* -cmGlobalXCodeGenerator::CreateString(const char* s) +cmGlobalXCodeGenerator::CreateString(const std::string& s) { cmXCodeObject* obj = this->CreateObject(cmXCodeObject::STRING); obj->SetString(s); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c9d20c2e3..31c2cfbcc 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -135,7 +135,7 @@ private: // correctly. All objects created are stored in this->XCodeObjects. cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype); cmXCodeObject* CreateObject(cmXCodeObject::Type type); - cmXCodeObject* CreateString(const char* s); + cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); cmXCodeObject* CreateXCodeTarget(cmTarget& target, cmXCodeObject* buildPhases); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 6abf6bf00..3b9035fea 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -266,7 +266,7 @@ void cmXCodeObject::PrintString(std::ostream& os) const } //---------------------------------------------------------------------------- -void cmXCodeObject::SetString(const char* s) +void cmXCodeObject::SetString(const std::string& s) { this->String = s; } diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b89f78cf3..076113653 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -37,7 +37,7 @@ public: Type GetType() { return this->TypeValue;} PBXType GetIsA() { return this->IsA;} - void SetString(const char* s); + void SetString(const std::string& s); const char* GetString() { return this->String.c_str(); From 83a5e453f8c0dc0fc9b6bdee9723478aafefd0da Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:20:33 -0500 Subject: [PATCH 109/278] stringapi: Use strings for test names --- Source/cmCTest.cxx | 5 ++--- Source/cmCTest.h | 6 +++--- Source/cmMakefile.cxx | 21 +++++++-------------- Source/cmMakefile.h | 4 ++-- Source/cmSetTestsPropertiesCommand.cxx | 2 +- Source/cmSetTestsPropertiesCommand.h | 2 +- Source/cmTest.cxx | 6 +----- Source/cmTest.h | 4 ++-- 8 files changed, 19 insertions(+), 31 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 39b623d3c..72bb7fd76 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2126,7 +2126,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, if(this->CheckArgument(arg, "--overwrite") && i < args.size() - 1) { i++; - this->AddCTestConfigurationOverwrite(args[i].c_str()); + this->AddCTestConfigurationOverwrite(args[i]); } if(this->CheckArgument(arg, "-A", "--add-notes") && i < args.size() - 1) { @@ -2840,9 +2840,8 @@ void cmCTest::AddSubmitFile(Part part, const char* name) } //---------------------------------------------------------------------- -void cmCTest::AddCTestConfigurationOverwrite(const char* encstr) +void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) { - std::string overStr = encstr; size_t epos = overStr.find("="); if ( epos == overStr.npos ) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 6418f0987..1eb0e01a8 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -70,8 +70,8 @@ public: { PartInfo(): Enabled(false) {} - void SetName(const char* name) { this->Name = name; } - const char* GetName() const { return this->Name.c_str(); } + void SetName(const std::string& name) { this->Name = name; } + const std::string& GetName() const { return this->Name; } void Enable() { this->Enabled = true; } operator bool() const { return this->Enabled; } @@ -349,7 +349,7 @@ public: //! Add overwrite to ctest configuration. // The format is key=value - void AddCTestConfigurationOverwrite(const char* encstr); + void AddCTestConfigurationOverwrite(const std::string& encstr); //! Create XML file that contains all the notes specified int GenerateNotesFile(const std::vector &files); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 97628f386..ff0576ed1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3852,34 +3852,27 @@ cmTarget* cmMakefile::FindTarget(const std::string& name, } //---------------------------------------------------------------------------- -cmTest* cmMakefile::CreateTest(const char* testName) +cmTest* cmMakefile::CreateTest(const std::string& testName) { - if ( !testName ) - { - return 0; - } cmTest* test = this->GetTest(testName); if ( test ) { return test; } test = new cmTest(this); - test->SetName(testName); + test->SetName(testName.c_str()); this->Tests[testName] = test; return test; } //---------------------------------------------------------------------------- -cmTest* cmMakefile::GetTest(const char* testName) const +cmTest* cmMakefile::GetTest(const std::string& testName) const { - if(testName) + std::map::const_iterator + mi = this->Tests.find(testName); + if(mi != this->Tests.end()) { - std::map::const_iterator - mi = this->Tests.find(testName); - if(mi != this->Tests.end()) - { - return mi->second; - } + return mi->second; } return 0; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a8ad1e21b..044324ef3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -782,12 +782,12 @@ public: void AddMacro(const char* name, const char* signature); ///! Add a new cmTest to the list of tests for this makefile. - cmTest* CreateTest(const char* testName); + cmTest* CreateTest(const std::string& testName); /** Get a cmTest pointer for a given test name, if the name is * not found, then a null pointer is returned. */ - cmTest* GetTest(const char* testName) const; + cmTest* GetTest(const std::string& testName) const; /** * Get a list of macros as a ; separated string diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 3d52cf242..c725d358a 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -91,7 +91,7 @@ bool cmSetTestsPropertiesCommand bool cmSetTestsPropertiesCommand -::SetOneTest(const char *tname, +::SetOneTest(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors) { diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 9e85495a9..7f8d57d13 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -36,7 +36,7 @@ public: cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); - static bool SetOneTest(const char *tname, + static bool SetOneTest(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf, std::string &errors); diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 4ff71ac9a..28a7bb17c 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -38,12 +38,8 @@ cmListFileBacktrace const& cmTest::GetBacktrace() const } //---------------------------------------------------------------------------- -void cmTest::SetName(const char* name) +void cmTest::SetName(const std::string& name) { - if ( !name ) - { - name = ""; - } this->Name = name; } diff --git a/Source/cmTest.h b/Source/cmTest.h index 1becbf79e..a5795c3dd 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -31,8 +31,8 @@ public: ~cmTest(); ///! Set the test name - void SetName(const char* name); - const char* GetName() const { return this->Name.c_str(); } + void SetName(const std::string& name); + std::string GetName() const { return this->Name; } void SetCommand(std::vector const& command); std::vector const& GetCommand() const From ce5114354c357df973e54872ab7abebbff36793b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 3 Feb 2014 21:20:56 -0500 Subject: [PATCH 110/278] stringapi: Use strings for the languages --- Source/cmComputeLinkInformation.cxx | 4 +- Source/cmComputeLinkInformation.h | 4 +- Source/cmCoreTryCompile.cxx | 3 +- Source/cmDepends.cxx | 2 +- Source/cmDepends.h | 4 +- Source/cmDependsC.cxx | 2 +- Source/cmDependsC.h | 3 +- Source/cmExtraCodeBlocksGenerator.cxx | 3 +- Source/cmExtraCodeLiteGenerator.cxx | 3 +- Source/cmExtraSublimeTextGenerator.cxx | 10 +--- Source/cmGeneratorExpressionEvaluator.cxx | 3 +- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 36 ++++++------ Source/cmGlobalGenerator.h | 21 +++---- Source/cmGlobalVisualStudioGenerator.h | 3 +- Source/cmGlobalXCodeGenerator.cxx | 41 ++++++-------- Source/cmGlobalXCodeGenerator.h | 11 ++-- Source/cmLocalGenerator.cxx | 55 ++++++++++--------- Source/cmLocalGenerator.h | 28 ++++++---- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 4 +- Source/cmLocalVisualStudio6Generator.cxx | 41 +++++++------- Source/cmLocalVisualStudio7Generator.cxx | 32 +++++------ Source/cmMakefile.cxx | 4 +- Source/cmMakefile.h | 2 +- .../cmMakefileExecutableTargetGenerator.cxx | 6 +- Source/cmMakefileLibraryTargetGenerator.cxx | 36 ++++-------- Source/cmMakefileLibraryTargetGenerator.h | 2 +- Source/cmMakefileTargetGenerator.cxx | 22 ++++---- Source/cmMakefileTargetGenerator.h | 8 +-- Source/cmNinjaNormalTargetGenerator.cxx | 8 +-- Source/cmNinjaNormalTargetGenerator.h | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmSourceFile.cxx | 11 ++-- Source/cmSourceFile.h | 4 +- Source/cmSourceFileLocation.cxx | 2 +- Source/cmTarget.cxx | 20 ++++--- Source/cmTarget.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 39 +++++++------ Source/cmVisualStudioGeneratorOptions.cxx | 4 +- Source/cmVisualStudioGeneratorOptions.h | 2 +- Source/cmXCodeObject.h | 2 +- 44 files changed, 246 insertions(+), 253 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 69869654c..716eb4dff 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -268,7 +268,7 @@ cmComputeLinkInformation // Get the language used for linking this target. this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget); - if(!this->LinkLanguage) + if(this->LinkLanguage.empty()) { // The Compute method will do nothing, so skip the rest of the // initialization. @@ -496,7 +496,7 @@ bool cmComputeLinkInformation::Compute() } // We require a link language for the target. - if(!this->LinkLanguage) + if(this->LinkLanguage.empty()) { cmSystemTools:: Error("CMake can not determine linker language for target: ", diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 356e6edcd..26ee8f044 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -50,7 +50,7 @@ public: std::vector const& GetDirectories(); std::vector const& GetDepends(); std::vector const& GetFrameworkPaths(); - const char* GetLinkLanguage() const { return this->LinkLanguage; } + std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector const& GetRuntimeSearchPath(); std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } std::string const& GetRuntimeSep() const { return this->RuntimeSep; } @@ -83,7 +83,7 @@ private: // Configuration information. const char* Config; - const char* LinkLanguage; + std::string LinkLanguage; bool LinkDependsNoShared; // Modes for dealing with dependent shared libraries. diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 7b5206945..1e8e4d09b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -249,7 +249,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) si != sources.end(); ++si) { std::string ext = cmSystemTools::GetFilenameLastExtension(*si); - if(const char* lang = gg->GetLanguageFromExtension(ext.c_str())) + std::string lang = gg->GetLanguageFromExtension(ext.c_str()); + if(!lang.empty()) { testLangs.insert(lang); } diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 1a0e93fe3..51150f2e8 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -297,7 +297,7 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, } //---------------------------------------------------------------------------- -void cmDepends::SetIncludePathFromLanguage(const char* lang) +void cmDepends::SetIncludePathFromLanguage(const std::string& lang) { // Look for the new per "TARGET_" variant first: const char * includePath = 0; diff --git a/Source/cmDepends.h b/Source/cmDepends.h index d787eddc6..b293c5ba7 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -41,7 +41,7 @@ public: void SetLocalGenerator(cmLocalGenerator* lg) { this->LocalGenerator = lg; } /** Set the specific language to be scanned. */ - void SetLanguage(const char* lang) { this->Language = lang; } + void SetLanguage(const std::string& lang) { this->Language = lang; } /** Set the target build directory. */ void SetTargetDirectory(const char* dir) { this->TargetDirectory = dir; } @@ -114,7 +114,7 @@ protected: // The include file search path. std::vector IncludePath; - void SetIncludePathFromLanguage(const char* lang); + void SetIncludePathFromLanguage(const std::string& lang); private: cmDepends(cmDepends const&); // Purposely not implemented. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 4fc5efb6a..585f959da 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -37,7 +37,7 @@ cmDependsC::cmDependsC() //---------------------------------------------------------------------------- cmDependsC::cmDependsC(cmLocalGenerator* lg, const char* targetDir, - const char* lang, + const std::string& lang, const std::map* validDeps) : cmDepends(lg, targetDir) , ValidDeps(validDeps) diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index 16dfad7bc..cd1e7a4bd 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -25,7 +25,8 @@ public: /** Checking instances need to know the build directory name and the relative path from the build directory to the target file. */ cmDependsC(); - cmDependsC(cmLocalGenerator* lg, const char* targetDir, const char* lang, + cmDependsC(cmLocalGenerator* lg, const char* targetDir, + const std::string& lang, const std::map* validDeps); /** Virtual destructor to cleanup subclasses properly. */ diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 548c88bba..8d4cf850d 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -411,7 +411,8 @@ void cmExtraCodeBlocksGenerator // check whether it is a C/C++ implementation file bool isCFile = false; - if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C')) + std::string lang = (*si)->GetLanguage(); + if (lang == "C" || lang == "CXX") { for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index ff84fb791..028d3d5b5 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -220,7 +220,8 @@ void cmExtraCodeLiteGenerator { // check whether it is a C/C++ implementation file bool isCFile = false; - if ((*si)->GetLanguage() && (*(*si)->GetLanguage() == 'C')) + std::string lang = (*si)->GetLanguage(); + if (lang == "C" || lang == "CXX") { for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 604bfcc15..1c9ac0260 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -369,8 +369,8 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, std::string flags; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) + std::string language = source->GetLanguage(); + if (language.empty()) { language = "C"; } @@ -423,11 +423,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, { std::set defines; cmMakefile *makefile = lg->GetMakefile(); - const char* language = source->GetLanguage(); - if (language == NULL) - { - language = ""; - } + const std::string& language = source->GetLanguage(); const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add the export symbol definition for shared library objects. diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c27c03f20..d12a66de0 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -990,8 +990,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "link libraries for a static library"); return std::string(); } - const char *lang = target->GetLinkerLanguage(context->Config); - return lang ? lang : ""; + return target->GetLinkerLanguage(context->Config); } cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d9885b9ad..4e7c71ef8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -168,7 +168,7 @@ struct TagVisitor this->BadObjLibFiles.push_back(sf); } } - else if(sf->GetLanguage()) + else if(!sf->GetLanguage().empty()) { DoAccept::Result>::Do(this->Data, sf); } diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 3d85e6d7d..a6e4fcce6 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -35,7 +35,7 @@ bool cmGetSourceFilePropertyCommand { if(args[2] == "LANGUAGE") { - this->Makefile->AddDefinition(var, sf->GetLanguage()); + this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } const char *prop = sf->GetPropertyForUser(args[2].c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f76c6d19a..7e9367630 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -722,7 +722,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, //---------------------------------------------------------------------------- void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, - std::string lang, + std::string const& lang, const char* envVar) const { // Subclasses override this method if they do not support this advice. @@ -744,7 +744,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, //---------------------------------------------------------------------------- void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, - std::string lang) const + std::string const& lang) const { std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; const char* compilerId = mf->GetDefinition(compilerIdVar.c_str()); @@ -817,17 +817,18 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } //---------------------------------------------------------------------------- -const char* +std::string cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const { - if(const char* lang = source.GetLanguage()) + const std::string& lang = source.GetLanguage(); + if(!lang.empty()) { std::map::const_iterator it = this->LanguageToOutputExtension.find(lang); if(it != this->LanguageToOutputExtension.end()) { - return it->second.c_str(); + return it->second; } } else @@ -840,7 +841,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const { if(this->OutputExtensions.count(ext)) { - return ext.c_str(); + return ext; } } } @@ -848,7 +849,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const } -const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const +std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const { // if there is an extension and it starts with . then move past the // . because the extensions are not stored with a . in the map @@ -860,9 +861,9 @@ const char* cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const = this->ExtensionToLanguage.find(ext); if(it != this->ExtensionToLanguage.end()) { - return it->second.c_str(); + return it->second; } - return 0; + return ""; } /* SetLanguageEnabled() is now split in two parts: @@ -877,13 +878,15 @@ files could change the object file extension (CMAKE__OUTPUT_EXTENSION) before the CMake variables were copied to the C++ maps. */ -void cmGlobalGenerator::SetLanguageEnabled(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabled(const std::string& l, + cmMakefile* mf) { this->SetLanguageEnabledFlag(l, mf); this->SetLanguageEnabledMaps(l, mf); } -void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabledFlag(const std::string& l, + cmMakefile* mf) { this->LanguageEnabled[l] = true; @@ -895,7 +898,8 @@ void cmGlobalGenerator::SetLanguageEnabledFlag(const char* l, cmMakefile* mf) this->FillExtensionToLanguageMap(l, mf); } -void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf) +void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, + cmMakefile* mf) { // use LanguageToLinkerPreference to detect whether this functions has // run before @@ -969,7 +973,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const char* l, cmMakefile* mf) } -void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l, +void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf) { std::string extensionsVar = std::string("CMAKE_") + @@ -986,14 +990,14 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const char* l, bool cmGlobalGenerator::IgnoreFile(const char* l) const { - if(this->GetLanguageFromExtension(l)) + if(!this->GetLanguageFromExtension(l).empty()) { return false; } return (this->IgnoreExtensions.count(l) > 0); } -bool cmGlobalGenerator::GetLanguageEnabled(const char* l) const +bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const { return (this->LanguageEnabled.find(l)!= this->LanguageEnabled.end()); } @@ -1958,7 +1962,7 @@ cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const } } -int cmGlobalGenerator::GetLinkerPreference(const char* lang) const +int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const { std::map::const_iterator it = this->LanguageToLinkerPreference.find(lang); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b66f01e86..2f23fd581 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -77,8 +77,8 @@ public: /** * Set/Get and Clear the enabled languages. */ - void SetLanguageEnabled(const char*, cmMakefile* mf); - bool GetLanguageEnabled(const char*) const; + void SetLanguageEnabled(const std::string&, cmMakefile* mf); + bool GetLanguageEnabled(const std::string&) const; void ClearEnabledLanguages(); void GetEnabledLanguages(std::vector& lang) const; /** @@ -182,13 +182,13 @@ public: bool GetToolSupportsColor() const { return this->ToolSupportsColor; } ///! return the language for the given extension - const char* GetLanguageFromExtension(const char* ext) const; + std::string GetLanguageFromExtension(const char* ext) const; ///! is an extension to be ignored bool IgnoreFile(const char* ext) const; ///! What is the preference for linkers and this language (None or Prefered) - int GetLinkerPreference(const char* lang) const; + int GetLinkerPreference(const std::string& lang) const; ///! What is the object file extension for a given source file? - const char* GetLanguageOutputExtension(cmSourceFile const&) const; + std::string GetLanguageOutputExtension(cmSourceFile const&) const; ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const { return "."; } @@ -332,9 +332,9 @@ protected: bool IsRootOnlyTarget(cmTarget* target) const; void AddTargetDepends(cmTarget const* target, TargetDependSet& projectTargets); - void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); - void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); - void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); + void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf); + void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf); + void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf); virtual bool ComputeTargetDepends(); @@ -420,9 +420,10 @@ private: void WriteSummary(cmTarget* target); void FinalizeTargetCompileInfo(); - virtual void PrintCompilerAdvice(std::ostream& os, std::string lang, + virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang, const char* envVar) const; - void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const; + void CheckCompilerIdCompatibility(cmMakefile* mf, + std::string const& lang) const; cmExternalMakefileProjectGenerator* ExtraGenerator; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 9186d6594..4b73118e8 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -114,7 +114,8 @@ protected: private: virtual std::string GetVSMakeProgram() = 0; - void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {} + void PrintCompilerAdvice(std::ostream&, std::string const&, + const char*) const {} void ComputeTargetObjects(cmGeneratorTarget* gt) const; void FollowLinkDepends(cmTarget const* target, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ab92c6e49..3f2416749 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -696,12 +696,8 @@ cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg, flags += flagsBuild.GetString(); } - const char* lang = + std::string lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); - if (!lang) - { - lang = ""; - } cmXCodeObject* buildFile = this->CreateXCodeSourceFileFromPath(sf->GetFullPath(), cmtarget, lang); @@ -906,12 +902,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf, cmTarget& cmtarget) { - const char* lang = + std::string lang = this->CurrentLocalGenerator->GetSourceFileLanguage(*sf); - if (!lang) - { - lang = ""; - } return this->CreateXCodeFileReferenceFromPath( sf->GetFullPath(), cmtarget, lang); @@ -1036,7 +1028,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, // Include this file in the build if it has a known language // and has not been listed as an ignored extension for this // generator. - if(this->CurrentLocalGenerator->GetSourceFileLanguage(**i) && + if(!this->CurrentLocalGenerator->GetSourceFileLanguage(**i).empty() && !this->IgnoreFile((*i)->GetExtension().c_str())) { sourceFiles.push_back(xsf); @@ -1241,8 +1233,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) return; } - const char* llang = cmtarget.GetLinkerLanguage("NOCONFIG"); - if(!llang) { return; } + std::string llang = cmtarget.GetLinkerLanguage("NOCONFIG"); + if(llang.empty()) { return; } // If the language is compiled as a source trust Xcode to link with it. cmTarget::LinkImplementation const* impl = @@ -1270,7 +1262,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) } if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str())) { - sf->SetProperty("LANGUAGE", llang); + sf->SetProperty("LANGUAGE", llang.c_str()); cmtarget.AddSourceFile(sf); } } @@ -1714,12 +1706,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, (target.GetType() == cmTarget::EXECUTABLE) || shared); - const char* lang = target.GetLinkerLanguage(configName); + std::string lang = target.GetLinkerLanguage(configName); std::string cflags; - if(lang) + if(!lang.empty()) { // for c++ projects get the c flags as well - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { this->CurrentLocalGenerator->AddLanguageFlags(cflags, "C", configName); this->CurrentLocalGenerator->AddCMP0018Flags(cflags, &target, @@ -2178,7 +2170,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, const char* debugStr = "YES"; // We can't set the Xcode flag differently depending on the language, // so put them back in this case. - if( (lang && strcmp(lang, "CXX") == 0) && gflag != gflagc ) + if( (lang == "CXX") && gflag != gflagc ) { cflags += " "; cflags += gflagc; @@ -2201,7 +2193,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CreateString("NO")); buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN", this->CreateString("NO")); - if(lang && strcmp(lang, "CXX") == 0) + if(lang == "CXX") { flags += " "; flags += defFlags; @@ -3800,12 +3792,13 @@ cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::LookupFlags(const char* varNamePrefix, - const char* varNameLang, - const char* varNameSuffix, - const char* default_flags) +std::string cmGlobalXCodeGenerator::LookupFlags( + const std::string& varNamePrefix, + const std::string& varNameLang, + const std::string& varNameSuffix, + const std::string& default_flags) { - if(varNameLang) + if(!varNameLang.empty()) { std::string varName = varNamePrefix; varName += varNameLang; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 31c2cfbcc..15f1363cc 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -190,10 +190,10 @@ private: void CreateReRunCMakeFile(cmLocalGenerator* root, std::vector const& gens); - std::string LookupFlags(const char* varNamePrefix, - const char* varNameLang, - const char* varNameSuffix, - const char* default_flags); + std::string LookupFlags(const std::string& varNamePrefix, + const std::string& varNameLang, + const std::string& varNameSuffix, + const std::string& default_flags); class Factory; class BuildObjectListOrString; @@ -215,7 +215,8 @@ protected: std::vector XCodeObjects; cmXCodeObject* RootObject; private: - void PrintCompilerAdvice(std::ostream&, std::string, const char*) const {} + void PrintCompilerAdvice(std::ostream&, std::string const&, + const char*) const {} void ComputeTargetObjects(cmGeneratorTarget* gt) const; std::string GetObjectsNormalDirectory( diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 476c95d93..0b4f94b1f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -572,7 +572,7 @@ void cmLocalGenerator::GenerateTargetManifest() } void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const char* lang, + const std::string& lang, cmSourceFile& source, cmGeneratorTarget& target) { @@ -604,7 +604,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, std::vector commands; cmSystemTools::ExpandList(rules, commands); cmLocalGenerator::RuleVariables vars; - vars.Language = lang; + vars.Language = lang.c_str(); vars.Source = sourceFile.c_str(); vars.Object = objectFile.c_str(); vars.ObjectDir = objectDir.c_str(); @@ -653,7 +653,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const char* llang, +void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmGeneratorTarget& target) { cmStdString objs; @@ -703,7 +703,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, &target); linkLibs = frameworkPath + linkPath + linkLibs; cmLocalGenerator::RuleVariables vars; - vars.Language = llang; + vars.Language = llang.c_str(); vars.Objects = objs.c_str(); vars.ObjectDir = "."; vars.Target = targetName.c_str(); @@ -776,8 +776,8 @@ void cmLocalGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.Target->GetLinkerLanguage(); - if(!llang) + std::string llang = target.Target->GetLinkerLanguage(); + if(llang.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1290,10 +1290,11 @@ cmLocalGenerator::ConvertToIncludeReference(std::string const& path, std::string cmLocalGenerator::GetIncludeFlags( const std::vector &includes, cmGeneratorTarget* target, - const char* lang, bool forResponseFile, + const std::string& lang, + bool forResponseFile, const char *config) { - if(!lang) + if(lang.empty()) { return ""; } @@ -1415,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileOptions( std::string& flags, cmTarget* target, - const char* lang, const char* config + const std::string& lang, const char* config ) { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; @@ -1463,7 +1464,7 @@ void cmLocalGenerator::AddCompileOptions( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, - const char* lang, + const std::string& lang, const char *config, bool stripImplicitInclDirs ) @@ -1689,8 +1690,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - const char* linkLanguage = target->Target->GetLinkerLanguage(); - if(!linkLanguage) + std::string linkLanguage = target->Target->GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1813,7 +1814,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, // Collect library linking flags command line options. std::string linkLibs; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); std::string libPathFlag = this->Makefile->GetRequiredDefinition("CMAKE_LIBRARY_PATH_FLAG"); @@ -1943,7 +1944,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const char *lang, + const std::string& lang, const char* config) { // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): @@ -1969,7 +1970,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); - if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F')) + if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F')) { for(std::vector::iterator i = archs.begin(); i != archs.end(); ++i) @@ -2000,7 +2001,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddLanguageFlags(std::string& flags, - const char* lang, + const std::string& lang, const char* config) { // Add language-specific flags. @@ -2112,7 +2113,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, //---------------------------------------------------------------------------- void cmLocalGenerator::AddSharedFlags(std::string& flags, - const char* lang, + const std::string& lang, bool shared) { std::string flagsVar; @@ -2128,7 +2129,8 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, } static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, - cmLocalGenerator *lg, const char *lang) + cmLocalGenerator *lg, + const std::string& lang) { std::string l(lang); std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY"; @@ -2182,7 +2184,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, //---------------------------------------------------------------------------- void cmLocalGenerator ::AddVisibilityPresetFlags(std::string &flags, cmTarget* target, - const char *lang) + const std::string& lang) { int targetType = target->GetType(); bool suitableTarget = ((targetType == cmTarget::SHARED_LIBRARY) @@ -2194,13 +2196,13 @@ void cmLocalGenerator return; } - if (!lang) + if (lang.empty()) { return; } AddVisibilityCompileOption(flags, target, this, lang); - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { AddInlineVisibilityCompileOption(flags, target, this); } @@ -2396,11 +2398,11 @@ void cmLocalGenerator::AppendDefines(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::JoinDefines(const std::set& defines, std::string &definesString, - const char* lang) + const std::string& lang) { // Lookup the define flag for the current language. std::string dflag = "-D"; - if(lang) + if(!lang.empty()) { std::string defineFlagVar = "CMAKE_"; defineFlagVar += lang; @@ -2460,7 +2462,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AppendFeatureOptions( - std::string& flags, const char* lang, const char* feature) + std::string& flags, const std::string& lang, const char* feature) { std::string optVar = "CMAKE_"; optVar += lang; @@ -3140,7 +3142,8 @@ cmLocalGenerator bool replaceExt = this->NeedBackwardsCompatibility_2_4(); if(!replaceExt) { - if(const char* lang = source.GetLanguage()) + std::string lang = source.GetLanguage(); + if(!lang.empty()) { std::string repVar = "CMAKE_"; repVar += lang; @@ -3174,7 +3177,7 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -const char* +std::string cmLocalGenerator ::GetSourceFileLanguage(const cmSourceFile& source) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 80a1421b0..74303f492 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -137,14 +137,14 @@ public: void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const char *lang, const char* config); + const std::string&lang, const char* config); - void AddLanguageFlags(std::string& flags, const char* lang, + void AddLanguageFlags(std::string& flags, const std::string& lang, const char* config); void AddCMP0018Flags(std::string &flags, cmTarget* target, std::string const& lang, const char *config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, - const char *lang); + const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, const char* config); ///! Append flags to a string. @@ -153,7 +153,8 @@ public: ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector &includes, cmGeneratorTarget* target, - const char* lang, bool forResponseFile = false, + const std::string& lang, + bool forResponseFile = false, const char *config = 0); /** @@ -175,10 +176,10 @@ public: */ void JoinDefines(const std::set& defines, std::string &definesString, - const char* lang); + const std::string& lang); /** Lookup and append options associated with a particular feature. */ - void AppendFeatureOptions(std::string& flags, const char* lang, + void AppendFeatureOptions(std::string& flags, const std::string& lang, const char* feature); /** \brief Get absolute path to dependency \a name @@ -223,16 +224,17 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, - const char* lang = "C", const char *config = 0, + const std::string& lang = "C", + const char *config = 0, bool stripImplicitInclDirs = true); void AddCompileOptions(std::string& flags, cmTarget* target, - const char* lang, const char* config); + const std::string& lang, const char* config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, const char* config); /** Compute the language used to compile the given source file. */ - const char* GetSourceFileLanguage(const cmSourceFile& source); + std::string GetSourceFileLanguage(const cmSourceFile& source); // Fill the vector with the target names for the object files, // preprocessed files and assembly files. @@ -389,10 +391,11 @@ protected: /** Convert a target to a utility target for unsupported * languages of a generator */ - void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target); + void AddBuildTargetRule(const std::string& llang, + cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, - const char* lang, + const std::string& lang, cmSourceFile& source, cmGeneratorTarget& target); // Create Custom Targets and commands for unsupported languages @@ -473,7 +476,8 @@ private: std::string const& result, OutputFormat format); - void AddSharedFlags(std::string& flags, const char* lang, bool shared); + void AddSharedFlags(std::string& flags, const std::string& lang, + bool shared); bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; void AddPositionIndependentFlags(std::string& flags, std::string const& l, int targetType); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 93722d1d8..11b89f464 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2198,7 +2198,7 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt) //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, - const char* lang, + const std::string& lang, const char* obj, const char* src) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 703369e1c..b0ccf52bc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -217,7 +217,7 @@ public: public std::map {}; ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt); - void AddImplicitDepends(cmTarget const& tgt, const char* lang, + void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, const char* obj, const char* src); void AppendGlobalTargetDepends(std::vector& depends, @@ -358,7 +358,7 @@ private: cmTarget* Target; std::string Language; LocalObjectEntry(): Target(0), Language() {} - LocalObjectEntry(cmTarget* t, const char* lang): + LocalObjectEntry(cmTarget* t, const std::string& lang): Target(t), Language(lang) {} }; struct LocalObjectInfo: public std::vector diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index a5e82943f..ff217c37f 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -413,19 +413,16 @@ void cmLocalVisualStudio6Generator compileFlags += cflags; } - const char* lang = this->GetSourceFileLanguage(*(*sf)); - if(lang) + const std::string& lang = this->GetSourceFileLanguage(*(*sf)); + if(lang == "CXX") { - if(strcmp(lang, "CXX") == 0) - { - // force a C++ file type - compileFlags += " /TP "; - } - else if(strcmp(lang, "C") == 0) - { - // force to c file type - compileFlags += " /TC "; - } + // force a C++ file type + compileFlags += " /TP "; + } + else if(lang == "C") + { + // force to c file type + compileFlags += " /TC "; } // Add per-source and per-configuration preprocessor definitions. @@ -469,7 +466,7 @@ void cmLocalVisualStudio6Generator } bool excludedFromBuild = - (lang && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); + (!lang.empty() && (*sf)->GetPropertyAsBool("HEADER_FILE_ONLY")); // Check for extra object-file dependencies. const char* dependsValue = (*sf)->GetProperty("OBJECT_DEPENDS"); @@ -1255,8 +1252,8 @@ void cmLocalVisualStudio6Generator if(targetBuilds) { // Get the language to use for linking. - const char* linkLanguage = target.GetLinkerLanguage(); - if(!linkLanguage) + const std::string& linkLanguage = target.GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1677,8 +1674,8 @@ void cmLocalVisualStudio6Generator if(target.GetType() >= cmTarget::EXECUTABLE && target.GetType() <= cmTarget::OBJECT_LIBRARY) { - const char* linkLanguage = target.GetLinkerLanguage(); - if(!linkLanguage) + const std::string& linkLanguage = target.GetLinkerLanguage(); + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", @@ -1745,11 +1742,11 @@ void cmLocalVisualStudio6Generator std::string minsizeDefines = " "; std::string debugrelDefines = " "; - this->JoinDefines(definesSet, defines, 0); - this->JoinDefines(debugDefinesSet, debugDefines, 0); - this->JoinDefines(releaseDefinesSet, releaseDefines, 0); - this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); - this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); + this->JoinDefines(definesSet, defines, ""); + this->JoinDefines(debugDefinesSet, debugDefines, ""); + this->JoinDefines(releaseDefinesSet, releaseDefines, ""); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, ""); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, ""); flags += defines; flagsDebug += debugDefines; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index d11bf55a4..f93a7aace 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -687,17 +687,18 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, std::string flags; if(strcmp(configType, "10") != 0) { - const char* linkLanguage = (this->FortranProject? "Fortran": + const std::string& linkLanguage = (this->FortranProject? + std::string("Fortran"): target.GetLinkerLanguage(configName)); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", target.GetName()); return; } - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) + if(linkLanguage == "C" || linkLanguage == "CXX" + || linkLanguage == "Fortran") { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; @@ -709,11 +710,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flags += this->Makefile->GetRequiredDefinition(flagVar.c_str()); } // set the correct language - if(strcmp(linkLanguage, "C") == 0) + if(linkLanguage == "C") { flags += " /TC "; } - if(strcmp(linkLanguage, "CXX") == 0) + if(linkLanguage == "CXX") { flags += " /TP "; } @@ -1081,7 +1082,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, return; } cmComputeLinkInformation& cli = *pcli; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); // Compute the variable name to lookup standard libraries for this // language. @@ -1177,7 +1178,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, return; } cmComputeLinkInformation& cli = *pcli; - const char* linkLanguage = cli.GetLinkLanguage(); + std::string linkLanguage = cli.GetLinkLanguage(); bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE"); @@ -1546,14 +1547,14 @@ cmLocalVisualStudio7GeneratorFCInfo } } - const char* lang = + std::string lang = lg->GlobalGenerator->GetLanguageFromExtension (sf.GetExtension().c_str()); - const char* sourceLang = lg->GetSourceFileLanguage(sf); - const char* linkLanguage = target.GetLinkerLanguage(i->c_str()); + const std::string& sourceLang = lg->GetSourceFileLanguage(sf); + const std::string& linkLanguage = target.GetLinkerLanguage(i->c_str()); bool needForceLang = false; // source file does not match its extension language - if(lang && sourceLang && strcmp(lang, sourceLang) != 0) + if(lang != sourceLang) { needForceLang = true; lang = sourceLang; @@ -1569,16 +1570,15 @@ cmLocalVisualStudio7GeneratorFCInfo // if the source file does not match the linker language // then force c or c++ - if(needForceLang || (linkLanguage && lang - && strcmp(lang, linkLanguage) != 0)) + if(needForceLang || (linkLanguage != lang)) { - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { // force a C++ file type fc.CompileFlags += " /TP "; needfc = true; } - else if(strcmp(lang, "C") == 0) + else if(lang == "C") { // force to c fc.CompileFlags += " /TC "; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ff0576ed1..8274b1377 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2361,10 +2361,10 @@ bool cmMakefile::PlatformIs64Bit() const return false; } -const char* cmMakefile::GetSONameFlag(const char* language) const +const char* cmMakefile::GetSONameFlag(const std::string& language) const { std::string name = "CMAKE_SHARED_LIBRARY_SONAME"; - if(language) + if(!language.empty()) { name += "_"; name += language; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 044324ef3..331a06495 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -608,7 +608,7 @@ public: bool PlatformIs64Bit() const; /** Retrieve soname flag for the specified language if supported */ - const char* GetSONameFlag(const char* language) const; + const char* GetSONameFlag(const std::string& language) const; /** * Get a list of preprocessor define flags. diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 180205427..b8273630e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -160,11 +160,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::SHELL); // Get the language to use for linking this executable. - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); // Make sure we have a link language. - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", this->Target->GetName(), "\"."); @@ -348,7 +348,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->Target; - vars.Language = linkLanguage; + vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 10418d0a3..96159f953 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -131,13 +131,10 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_STATIC_LIBRARY"; if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && @@ -160,13 +157,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) this->WriteFrameworkRules(relink); return; } - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; @@ -187,13 +181,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; @@ -213,13 +204,10 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; @@ -248,11 +236,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->AppendLinkDepends(depends); // Get the language to use for linking this library. - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); // Make sure we have a link language. - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", this->Target->GetName(), "\"."); @@ -589,7 +577,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->Target; - vars.Language = linkLanguage; + vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), @@ -786,7 +774,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator -::AppendOSXVerFlag(std::string& flags, const char* lang, +::AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so) { // Lookup the flag to specify the version. diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 4873516c8..68980c3ff 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -39,7 +39,7 @@ protected: // Store the computd framework version for OS X Frameworks. std::string FrameworkVersion; - void AppendOSXVerFlag(std::string& flags, const char* lang, + void AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so); }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index bf0dc5141..3ba5a77e2 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -422,8 +422,9 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) { // Identify the language of the source file. - const char* lang = this->LocalGenerator->GetSourceFileLanguage(source); - if(!lang) + const std::string& lang = + this->LocalGenerator->GetSourceFileLanguage(source); + if(lang.empty()) { // don't know anything about this file so skip it return; @@ -523,7 +524,7 @@ cmMakefileTargetGenerator void cmMakefileTargetGenerator ::WriteObjectBuildFile(std::string &obj, - const char *lang, + const std::string& lang, cmSourceFile& source, std::vector& depends) { @@ -552,7 +553,7 @@ cmMakefileTargetGenerator cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); // Add Fortran format flags. - if(strcmp(lang, "Fortran") == 0) + if(lang == "Fortran") { this->AppendFortranFormatFlags(flags, source); } @@ -664,7 +665,7 @@ cmMakefileTargetGenerator cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.CMTarget = this->Target; - vars.Language = lang; + vars.Language = lang.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); @@ -689,8 +690,7 @@ cmMakefileTargetGenerator vars.Defines = definesString.c_str(); - bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) || - (strcmp(lang, "CXX") == 0)); + bool lang_is_c_or_cxx = ((lang == "C") || (lang == "CXX")); // Construct the compile rules. { @@ -1709,8 +1709,8 @@ void cmMakefileTargetGenerator } void cmMakefileTargetGenerator::RemoveForbiddenFlags(const char* flagVar, - const char* linkLang, - std::string& linkFlags) + const std::string& linkLang, + std::string& linkFlags) { // check for language flags that are not allowed at link time, and // remove them, -w on darwin for gcc -w -dynamiclib sends -w to libtool @@ -1943,7 +1943,7 @@ cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, - const char* lang) + const std::string& lang) { std::string responseVar = "CMAKE_"; responseVar += lang; @@ -2113,7 +2113,7 @@ bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::AddFeatureFlags( - std::string& flags, const char* lang + std::string& flags, const std::string& lang ) { // Add language-specific flags. diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f960afc14..8ab65bf5d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -93,7 +93,7 @@ protected: // write the build rule for an object void WriteObjectBuildFile(std::string &obj, - const char *lang, + const std::string& lang, cmSourceFile& source, std::vector& depends); @@ -173,10 +173,10 @@ protected: bool useResponseFile, std::string& buildObjs, std::vector& makefile_depends); - void AddIncludeFlags(std::string& flags, const char* lang); + void AddIncludeFlags(std::string& flags, const std::string& lang); virtual void CloseFileStreams(); - void RemoveForbiddenFlags(const char* flagVar, const char* linkLang, + void RemoveForbiddenFlags(const char* flagVar, const std::string& linkLang, std::string& linkFlags); cmTarget *Target; cmGeneratorTarget* GeneratorTarget; @@ -260,7 +260,7 @@ protected: void AddModuleDefinitionFlag(std::string& flags); // Add language feature flags. - void AddFeatureFlags(std::string& flags, const char* lang); + void AddFeatureFlags(std::string& flags, const std::string& lang); // Feature query methods. const char* GetFeature(const char* feature); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 73ba8154b..b81fbeb40 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -35,7 +35,7 @@ cmNinjaNormalTargetGenerator(cmGeneratorTarget* target) , TargetNameReal() , TargetNameImport() , TargetNamePDB() - , TargetLinkLanguage(0) + , TargetLinkLanguage("") { this->TargetLinkLanguage = target->Target ->GetLinkerLanguage(this->GetConfigName()); @@ -72,7 +72,7 @@ cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() void cmNinjaNormalTargetGenerator::Generate() { - if (!this->TargetLinkLanguage) { + if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " "target: ", this->GetTarget()->GetName()); @@ -140,7 +140,7 @@ std::string cmNinjaNormalTargetGenerator ::LanguageLinkerRule() const { - return std::string(this->TargetLinkLanguage) + return this->TargetLinkLanguage + "_" + cmTarget::GetTargetTypeName(this->GetTarget()->GetType()) + "_LINKER"; @@ -163,7 +163,7 @@ cmNinjaNormalTargetGenerator cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->GetTarget(); - vars.Language = this->TargetLinkLanguage; + vars.Language = this->TargetLinkLanguage.c_str(); std::string responseFlag; if (!useResponseFile) { diff --git a/Source/cmNinjaNormalTargetGenerator.h b/Source/cmNinjaNormalTargetGenerator.h index c7a089c6f..556ed5e13 100644 --- a/Source/cmNinjaNormalTargetGenerator.h +++ b/Source/cmNinjaNormalTargetGenerator.h @@ -47,7 +47,7 @@ private: std::string TargetNameReal; std::string TargetNameImport; std::string TargetNamePDB; - const char *TargetLinkLanguage; + std::string TargetLinkLanguage; }; #endif // ! cmNinjaNormalTargetGenerator_h diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 00b04413d..1c43cb3ce 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -110,7 +110,7 @@ bool cmNinjaTargetGenerator::GetFeatureAsBool(const char* feature) // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags, - const char* lang) + const std::string& lang) { // Add language-specific flags. this->LocalGenerator->AddLanguageFlags(flags, lang, this->GetConfigName()); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 43f22799c..e8ac81c61 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -72,7 +72,7 @@ protected: const char* GetFeature(const char* feature); bool GetFeatureAsBool(const char* feature); - void AddFeatureFlags(std::string& flags, const char* lang); + void AddFeatureFlags(std::string& flags, const std::string& lang); /** * Compute the flags for compilation of object files for a given @a language. diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index f05204496..0d3720572 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -39,7 +39,7 @@ std::string const& cmSourceFile::GetExtension() const } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetLanguage() +std::string cmSourceFile::GetLanguage() { // If the language was set explicitly by the user then use it. if(const char* lang = this->GetProperty("LANGUAGE")) @@ -76,7 +76,7 @@ const char* cmSourceFile::GetLanguage() } //---------------------------------------------------------------------------- -const char* cmSourceFile::GetLanguage() const +std::string cmSourceFile::GetLanguage() const { // If the language was set explicitly by the user then use it. if(const char* lang = this->GetProperty("LANGUAGE")) @@ -87,11 +87,11 @@ const char* cmSourceFile::GetLanguage() const // If the language was determined from the source file extension use it. if(!this->Language.empty()) { - return this->Language.c_str(); + return this->Language; } // The language is not known. - return 0; + return ""; } //---------------------------------------------------------------------------- @@ -267,7 +267,8 @@ void cmSourceFile::CheckLanguage(std::string const& ext) // Try to identify the source file language from the extension. cmMakefile const* mf = this->Location.GetMakefile(); cmGlobalGenerator* gg = mf->GetLocalGenerator()->GetGlobalGenerator(); - if(const char* l = gg->GetLanguageFromExtension(ext.c_str())) + std::string l = gg->GetLanguageFromExtension(ext.c_str()); + if(!l.empty()) { this->Language = l; } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index b362c986e..17c96ac09 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -79,8 +79,8 @@ public: /** * Get the language of the compiler to use for this source file. */ - const char* GetLanguage(); - const char* GetLanguage() const; + std::string GetLanguage(); + std::string GetLanguage() const; /** * Return the vector that holds the list of dependencies diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 832a6a79d..30a53cbd0 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -93,7 +93,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) cmMakefile const* mf = this->Makefile; const std::vector& srcExts = mf->GetSourceExtensions(); const std::vector& hdrExts = mf->GetHeaderExtensions(); - if(gg->GetLanguageFromExtension(ext.c_str()) || + if(!gg->GetLanguageFromExtension(ext.c_str()).empty() || std::find(srcExts.begin(), srcExts.end(), ext) != srcExts.end() || std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 34d92fa0f..6782822c5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2884,13 +2884,11 @@ private: }; //---------------------------------------------------------------------------- -const char* cmTarget::GetLinkerLanguage(const char* config, +std::string cmTarget::GetLinkerLanguage(const char* config, cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; - const char* lang = this->GetLinkClosure(config, headTarget) - ->LinkerLanguage.c_str(); - return *lang? lang : 0; + return this->GetLinkClosure(config, headTarget)->LinkerLanguage; } //---------------------------------------------------------------------------- @@ -2924,7 +2922,7 @@ public: this->Makefile = this->Target->GetMakefile(); this->GG = this->Makefile->GetLocalGenerator()->GetGlobalGenerator(); } - void Consider(const char* lang) + void Consider(const std::string& lang) { int preference = this->GG->GetLinkerPreference(lang); if(preference > this->Preference) @@ -3530,7 +3528,8 @@ void cmTarget::GetFullNameInternal(const char* config, const char* suffixVar = this->GetSuffixVariableInternal(implib); // Check for language-specific default prefix and suffix. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { if(!targetSuffix && suffixVar && *suffixVar) { @@ -3867,7 +3866,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const } // Check for rpath support on this platform. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; flagVar += ll; @@ -4825,7 +4825,8 @@ void cmTarget::GetLanguages(std::set& languages) const for(std::vector::const_iterator i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i) { - if(const char* lang = (*i)->GetLanguage()) + const std::string& lang = (*i)->GetLanguage(); + if(!lang.empty()) { languages.insert(lang); } @@ -4876,7 +4877,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const #if defined(CMAKE_USE_ELF_PARSER) // Enable if the rpath flag uses a separator and the target uses ELF // binaries. - if(const char* ll = this->GetLinkerLanguage(config, this)) + std::string ll = this->GetLinkerLanguage(config, this); + if(!ll.empty()) { std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; sepVar += ll; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9f7b811bd..205c81c56 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -347,7 +347,7 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - const char* GetLinkerLanguage(const char* config = 0, + std::string GetLinkerLanguage(const char* config = 0, cmTarget const* head = 0) const; /** Get the full name of the target according to the settings in its diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2d21a3d3f..aa721b75c 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1012,18 +1012,18 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() si = objectSources.begin(); si != objectSources.end(); ++si) { - const char* lang = (*si)->GetLanguage(); + const std::string& lang = (*si)->GetLanguage(); const char* tool = NULL; - if (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0) + if (lang == "C"|| lang == "CXX") { tool = "ClCompile"; } - else if (strcmp(lang, "ASM_MASM") == 0 && + else if (lang == "ASM_NASM" && this->GlobalGenerator->IsMasmEnabled()) { tool = "MASM"; } - else if (strcmp(lang, "RC") == 0) + else if (lang == "RC") { tool = "ResourceCompile"; } @@ -1108,29 +1108,28 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( { defines += cdefs; } - const char* lang = + std::string lang = this->GlobalGenerator->GetLanguageFromExtension (sf.GetExtension().c_str()); - const char* sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf); - const char* linkLanguage = this->Target->GetLinkerLanguage(); + std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf); + const std::string& linkLanguage = this->Target->GetLinkerLanguage(); bool needForceLang = false; // source file does not match its extension language - if(lang && sourceLang && strcmp(lang, sourceLang) != 0) + if(lang != sourceLang) { needForceLang = true; lang = sourceLang; } // if the source file does not match the linker language // then force c or c++ - if(needForceLang || (linkLanguage && lang - && strcmp(lang, linkLanguage) != 0)) + if(needForceLang || (linkLanguage != lang)) { - if(strcmp(lang, "CXX") == 0) + if(lang == "CXX") { // force a C++ file type flags += " /TP "; } - else if(strcmp(lang, "C") == 0) + else if(lang == "C") { // force to c flags += " /TC "; @@ -1341,17 +1340,17 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // collect up flags for if(this->Target->GetType() < cmTarget::UTILITY) { - const char* linkLanguage = + const std::string& linkLanguage = this->Target->GetLinkerLanguage(configName.c_str()); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", this->Name.c_str()); return false; } - if(strcmp(linkLanguage, "C") == 0 || strcmp(linkLanguage, "CXX") == 0 - || strcmp(linkLanguage, "Fortran") == 0) + if(linkLanguage == "C" || linkLanguage == "CXX" + || linkLanguage == "Fortran") { std::string baseFlagVar = "CMAKE_"; baseFlagVar += linkLanguage; @@ -1365,11 +1364,11 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); } // set the correct language - if(strcmp(linkLanguage, "C") == 0) + if(linkLanguage == "C") { flags += " /TC "; } - if(strcmp(linkLanguage, "CXX") == 0) + if(linkLanguage == "CXX") { flags += " /TP "; } @@ -1525,9 +1524,9 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config) cmVSGetLinkFlagTable(this->LocalGenerator), 0, this)); Options& linkOptions = *pOptions; - const char* linkLanguage = + const std::string& linkLanguage = this->Target->GetLinkerLanguage(config.c_str()); - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error ("CMake can not determine linker language for target: ", diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6aca787f5..f48c59345 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -222,7 +222,7 @@ cmVisualStudioGeneratorOptions ::OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, const char* suffix, - const char* lang) + const std::string& lang) { if(this->Defines.empty()) { @@ -270,7 +270,7 @@ cmVisualStudioGeneratorOptions { define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str()); - if(0 == strcmp(lang, "RC")) + if(lang == "RC") { cmSystemTools::ReplaceString(define, "\"", "\\\""); } diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 90f76672d..214b89372 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -55,7 +55,7 @@ public: void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, const char* suffix, - const char* lang); + const std::string& lang); void OutputFlagMap(std::ostream& fout, const char* indent); void OutputAdditionalOptions(std::ostream& fout, const char* prefix, diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 076113653..ad1533ecd 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -123,7 +123,7 @@ public: void CopyAttributes(cmXCodeObject* ); void AddDependLibrary(const char* configName, - const char* l) + const std::string& l) { if(!configName) { From a6ae2ea72bc0d4149c2ff6118fcfd577e95c680d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 13:31:39 -0500 Subject: [PATCH 111/278] stringapi: Use strings in Convert methods in LocalGenerator The C strings were turned into std::strings internally anyways and most callers used .c_str(). --- Source/cmLocalGenerator.cxx | 36 ++++++++++++++++-------------- Source/cmLocalGenerator.h | 20 +++++++++-------- Source/cmMakefileTargetGenerator.h | 2 +- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0b4f94b1f..e1abfef99 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1230,7 +1230,7 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, +cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, OutputFormat format) { @@ -1238,10 +1238,10 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, // already exists, we can use a short-path to reference it without a // space. if(this->WindowsShell && result.find(' ') != result.npos && - cmSystemTools::FileExists(remote)) + cmSystemTools::FileExists(remote.c_str())) { std::string tmp; - if(cmSystemTools::GetShortPath(remote, tmp)) + if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) { return this->Convert(tmp.c_str(), NONE, format, true); } @@ -1253,7 +1253,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const char* remote, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOutputForExisting(const char* remote, +cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote, RelativeRoot local, OutputFormat format) { @@ -1267,7 +1267,7 @@ cmLocalGenerator::ConvertToOutputForExisting(const char* remote, //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote, - const char* local, + const std::string& local, OutputFormat format) { // Perform standard conversion. @@ -2513,7 +2513,8 @@ cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConvertToOptionallyRelativeOutputPath(const char* remote) +cmLocalGenerator::ConvertToOptionallyRelativeOutputPath( + const std::string& remote) { return this->Convert(remote, START_OUTPUT, SHELL, true); } @@ -2533,7 +2534,7 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::Convert(const char* source, +std::string cmLocalGenerator::Convert(const std::string& source, RelativeRoot relative, OutputFormat output, bool optional) @@ -2585,7 +2586,7 @@ std::string cmLocalGenerator::Convert(const char* source, } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, +std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, OutputFormat output) { std::string result = source; @@ -2627,7 +2628,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const char* source, //---------------------------------------------------------------------------- std::string cmLocalGenerator::Convert(RelativeRoot remote, - const char* local, + const std::string& local, OutputFormat output, bool optional) { @@ -2636,10 +2637,10 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, // The relative root must have a path (i.e. not FULL or NONE) assert(remotePath != 0); - if(local && (!optional || this->UseRelativePaths)) + if(!local.empty() && (!optional || this->UseRelativePaths)) { std::vector components; - cmSystemTools::SplitPath(local, components); + cmSystemTools::SplitPath(local.c_str(), components); std::string result = this->ConvertToRelativePath(components, remotePath); return this->ConvertToOutputFormat(result.c_str(), output); } @@ -2722,7 +2723,8 @@ static bool cmLocalGeneratorNotAbove(const char* a, const char* b) //---------------------------------------------------------------------------- std::string cmLocalGenerator::ConvertToRelativePath(const std::vector& local, - const char* in_remote, bool force) + const std::string& in_remote, + bool force) { // The path should never be quoted. assert(in_remote[0] != '\"'); @@ -2731,7 +2733,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, assert(local.size() > 0 && !(local[local.size()-1] == "")); // If the path is already relative then just return the path. - if(!cmSystemTools::FileIsFullPath(in_remote)) + if(!cmSystemTools::FileIsFullPath(in_remote.c_str())) { return in_remote; } @@ -2750,11 +2752,11 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, std::string local_path = cmSystemTools::JoinPath(local); if(!((cmLocalGeneratorNotAbove(local_path.c_str(), this->RelativePathTopBinary.c_str()) && - cmLocalGeneratorNotAbove(in_remote, + cmLocalGeneratorNotAbove(in_remote.c_str(), this->RelativePathTopBinary.c_str())) || (cmLocalGeneratorNotAbove(local_path.c_str(), this->RelativePathTopSource.c_str()) && - cmLocalGeneratorNotAbove(in_remote, + cmLocalGeneratorNotAbove(in_remote.c_str(), this->RelativePathTopSource.c_str())))) { return in_remote; @@ -2764,7 +2766,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, // Identify the longest shared path component between the remote // path and the local path. std::vector remote; - cmSystemTools::SplitPath(in_remote, remote); + cmSystemTools::SplitPath(in_remote.c_str(), remote); unsigned int common=0; while(common < remote.size() && common < local.size() && @@ -2982,7 +2984,7 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName, //---------------------------------------------------------------------------- std::string& cmLocalGenerator -::CreateSafeUniqueObjectFileName(const char* sin, +::CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max) { // Look for an existing mapped name for this object file. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 74303f492..182b7839b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -106,11 +106,12 @@ public: */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE }; - std::string ConvertToOutputFormat(const char* source, OutputFormat output); - std::string Convert(const char* remote, RelativeRoot local, + std::string ConvertToOutputFormat(const std::string& source, + OutputFormat output); + std::string Convert(const std::string& remote, RelativeRoot local, OutputFormat output = UNCHANGED, bool optional = false); - std::string Convert(RelativeRoot remote, const char* local, + std::string Convert(RelativeRoot remote, const std::string& local, OutputFormat output = UNCHANGED, bool optional = false); @@ -125,7 +126,7 @@ public: * remote path must use forward slashes and not already be escaped * or quoted. */ - std::string ConvertToOptionallyRelativeOutputPath(const char* remote); + std::string ConvertToOptionallyRelativeOutputPath(const std::string& remote); ///! set/get the parent generator cmLocalGenerator* GetParent(){return this->Parent;} @@ -198,14 +199,14 @@ public: std::string& dep); ///! for existing files convert to output path and short path if spaces - std::string ConvertToOutputForExisting(const char* remote, + std::string ConvertToOutputForExisting(const std::string& remote, RelativeRoot local = START_OUTPUT, OutputFormat format = SHELL); /** For existing path identified by RelativeRoot convert to output path and short path if spaces. */ std::string ConvertToOutputForExisting(RelativeRoot remote, - const char* local = 0, + const std::string& local = "", OutputFormat format = SHELL); virtual std::string ConvertToIncludeReference(std::string const& path, @@ -309,7 +310,8 @@ public: * or quoted. */ std::string ConvertToRelativePath(const std::vector& local, - const char* remote, bool force=false); + const std::string& remote, + bool force=false); /** * Get the relative path from the generator output directory to a @@ -410,7 +412,7 @@ protected: std::ostream& os, const char* config, std::vector const& configurationTypes); - std::string& CreateSafeUniqueObjectFileName(const char* sin, + std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); void ComputeObjectMaxPath(); @@ -472,7 +474,7 @@ protected: cmIML_INT_uint64_t BackwardsCompatibility; bool BackwardsCompatibilityFinal; private: - std::string ConvertToOutputForExistingCommon(const char* remote, + std::string ConvertToOutputForExistingCommon(const std::string& remote, std::string const& result, OutputFormat format); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 8ab65bf5d..baae2b091 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -269,7 +269,7 @@ protected: //================================================================== // Convenience routines that do nothing more than forward to // implementaitons - std::string Convert(const char* source, + std::string Convert(const std::string& source, cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::OutputFormat output = cmLocalGenerator::UNCHANGED, From fabf1fbabb4fc67844d5b2210e70a9829a59ff23 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Feb 2014 17:31:47 -0500 Subject: [PATCH 112/278] stringapi: Use strings in target name --- Source/CTest/cmCTestBuildCommand.cxx | 3 +- Source/cmBuildCommand.cxx | 6 +- Source/cmComputeLinkDepends.cxx | 9 +-- Source/cmComputeLinkDepends.h | 3 +- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 15 ++-- Source/cmComputeTargetDepends.h | 8 ++- Source/cmCoreTryCompile.cxx | 11 +-- Source/cmCoreTryCompile.h | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 5 +- Source/cmExtraCodeBlocksGenerator.h | 4 +- Source/cmExtraSublimeTextGenerator.cxx | 5 +- Source/cmExtraSublimeTextGenerator.h | 4 +- Source/cmGeneratorTarget.cxx | 4 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGetPropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 24 +++---- Source/cmGlobalGenerator.h | 19 +++--- Source/cmGlobalNinjaGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 12 ++-- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 13 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 11 +-- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 13 ++-- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 6 +- Source/cmGlobalVisualStudioGenerator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 23 ++++--- Source/cmGlobalXCodeGenerator.h | 4 +- Source/cmGraphVizWriter.cxx | 8 +-- Source/cmGraphVizWriter.h | 8 +-- Source/cmLocalGenerator.cxx | 20 +++--- Source/cmLocalGenerator.h | 6 +- Source/cmLocalUnixMakefileGenerator3.cxx | 14 ++-- Source/cmLocalUnixMakefileGenerator3.h | 9 +-- Source/cmLocalVisualStudio6Generator.cxx | 22 +++--- Source/cmLocalVisualStudio6Generator.h | 12 ++-- Source/cmLocalVisualStudio7Generator.cxx | 30 ++++---- Source/cmLocalVisualStudio7Generator.h | 17 ++--- Source/cmMakefile.cxx | 68 +++++++++---------- Source/cmMakefile.h | 29 ++++---- .../cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 4 +- Source/cmMakefileTargetGenerator.cxx | 6 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmMakefileUtilityTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 14 ++-- Source/cmSetPropertyCommand.cxx | 2 +- Source/cmSetTargetPropertiesCommand.cxx | 2 +- Source/cmSetTargetPropertiesCommand.h | 2 +- Source/cmTarget.cxx | 28 ++++---- Source/cmTarget.h | 18 ++--- Source/cmXCodeObject.h | 2 +- 58 files changed, 287 insertions(+), 274 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 12ff71828..9738bded9 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -130,7 +130,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory"); std::string buildCommand = this->GlobalGenerator-> - GenerateCMakeBuildCommand(cmakeBuildTarget, cmakeBuildConfiguration, + GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", + cmakeBuildConfiguration, cmakeBuildAdditionalFlags, true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index c06b8ad1c..d8e1a2c22 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -44,7 +44,7 @@ bool cmBuildCommand // Parse remaining arguments. const char* configuration = 0; const char* project_name = 0; - const char* target = 0; + std::string target; enum Doing { DoingNone, DoingConfiguration, DoingProjectName, DoingTarget }; Doing doing = DoingNone; for(unsigned int i=1; i < args.size(); ++i) @@ -74,7 +74,7 @@ bool cmBuildCommand else if(doing == DoingTarget) { doing = DoingNone; - target = args[i].c_str(); + target = args[i]; } else { @@ -136,7 +136,7 @@ bool cmBuildCommand } std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand(0, configType.c_str(), + ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), 0, true); if(cacheValue) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 1be5980af..d51e6e63f 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -254,7 +254,8 @@ cmComputeLinkDepends::Compute() "---------------------------------------" "---------------------------------------\n"); fprintf(stderr, "Link dependency analysis for target %s, config %s\n", - this->Target->GetName(), this->Config?this->Config:"noconfig"); + this->Target->GetName().c_str(), + this->Config?this->Config:"noconfig"); this->DisplayConstraintGraph(); } @@ -620,7 +621,7 @@ cmComputeLinkDepends::AddLinkEntries(int depender_index, //---------------------------------------------------------------------------- cmTarget const* cmComputeLinkDepends::FindTargetToLink(int depender_index, - const char* name) + const std::string& name) { // Look for a target in the scope of the depender. cmMakefile* mf = this->Makefile; @@ -968,14 +969,14 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl) //---------------------------------------------------------------------------- void cmComputeLinkDepends::DisplayFinalEntries() { - fprintf(stderr, "target [%s] links to:\n", this->Target->GetName()); + fprintf(stderr, "target [%s] links to:\n", this->Target->GetName().c_str()); for(std::vector::const_iterator lei = this->FinalLinkEntries.begin(); lei != this->FinalLinkEntries.end(); ++lei) { if(lei->Target) { - fprintf(stderr, " target [%s]\n", lei->Target->GetName()); + fprintf(stderr, " target [%s]\n", lei->Target->GetName().c_str()); } else { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 9776f55d5..26bf6dbf9 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -83,7 +83,8 @@ private: void AddDirectLinkEntries(); void AddLinkEntries(int depender_index, std::vector const& libs); - cmTarget const* FindTargetToLink(int depender_index, const char* name); + cmTarget const* FindTargetToLink(int depender_index, + const std::string& name); // One entry for each unique item. std::vector EntryList; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 716eb4dff..23a6671c5 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -500,7 +500,7 @@ bool cmComputeLinkInformation::Compute() { cmSystemTools:: Error("CMake can not determine linker language for target: ", - this->Target->GetName()); + this->Target->GetName().c_str()); return false; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 6511510ca..83d1e2e3a 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -298,7 +298,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, - const char* dependee_name, + const std::string& dependee_name, bool linking, std::set &emitted) { @@ -333,7 +333,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddTargetDepend(int depender_index, - const char* dependee_name, + const std::string& dependee_name, bool linking) { // Get the depender. @@ -434,22 +434,23 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, //---------------------------------------------------------------------------- void -cmComputeTargetDepends::DisplayGraph(Graph const& graph, const char* name) +cmComputeTargetDepends::DisplayGraph(Graph const& graph, + const std::string& name) { - fprintf(stderr, "The %s target dependency graph is:\n", name); + fprintf(stderr, "The %s target dependency graph is:\n", name.c_str()); int n = static_cast(graph.size()); for(int depender_index = 0; depender_index < n; ++depender_index) { EdgeList const& nl = graph[depender_index]; cmTarget const* depender = this->Targets[depender_index]; fprintf(stderr, "target %d is [%s]\n", - depender_index, depender->GetName()); + depender_index, depender->GetName().c_str()); for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { int dependee_index = *ni; cmTarget const* dependee = this->Targets[dependee_index]; fprintf(stderr, " depends on target %d [%s] (%s)\n", dependee_index, - dependee->GetName(), ni->IsStrong()? "strong" : "weak"); + dependee->GetName().c_str(), ni->IsStrong()? "strong" : "weak"); } } fprintf(stderr, "\n"); @@ -471,7 +472,7 @@ cmComputeTargetDepends { int i = *ni; fprintf(stderr, " contains target %d [%s]\n", - i, this->Targets[i]->GetName()); + i, this->Targets[i]->GetName().c_str()); } } fprintf(stderr, "\n"); diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 6cd6da0c8..dcb450acc 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -45,12 +45,14 @@ private: void CollectTargets(); void CollectDepends(); void CollectTargetDepends(int depender_index); - void AddTargetDepend(int depender_index, const char* dependee_name, + void AddTargetDepend(int depender_index, + const std::string& dependee_name, bool linking); void AddTargetDepend(int depender_index, cmTarget const* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); - void AddInterfaceDepends(int depender_index, const char* dependee_name, + void AddInterfaceDepends(int depender_index, + const std::string& dependee_name, bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, @@ -71,7 +73,7 @@ private: typedef cmGraphAdjacencyList Graph; Graph InitialGraph; Graph FinalGraph; - void DisplayGraph(Graph const& graph, const char* name); + void DisplayGraph(Graph const& graph, const std::string& name); // Deal with connected components. void DisplayComponents(cmComputeComponentGraph const& ccg); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 1e8e4d09b..b0e2b6f42 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -28,7 +28,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; - const char* targetName = 0; + std::string targetName; std::vector cmakeFlags; std::vector compileDefs; std::string outputVariable; @@ -450,7 +450,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "add_executable(%s", targetName); + fprintf(fout, "add_executable(%s", targetName.c_str()); for(std::vector::iterator si = sources.begin(); si != sources.end(); ++si) { @@ -466,12 +466,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if (useOldLinkLibs) { fprintf(fout, - "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName); + "target_link_libraries(%s ${LINK_LIBRARIES})\n", + targetName.c_str()); } else { fprintf(fout, "target_link_libraries(%s %s)\n", - targetName, + targetName.c_str(), libsToLink.c_str()); } fclose(fout); @@ -610,7 +611,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } } -void cmCoreTryCompile::FindOutputFile(const char* targetName) +void cmCoreTryCompile::FindOutputFile(const std::string& targetName) { this->FindErrorMessage = ""; this->OutputFile = ""; diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 5c67f1355..3272462d9 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -44,7 +44,7 @@ public: TryCompileCode. The result is stored in OutputFile. If nothing is found, the error message is stored in FindErrorMessage. */ - void FindOutputFile(const char* targetName); + void FindOutputFile(const std::string& targetName); cmTypeMacro(cmCoreTryCompile, cmCommand); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 8d4cf850d..133996992 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -537,7 +537,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( // Generate the xml code for one target. void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmTarget* target, const char* make, const cmMakefile* makefile, @@ -757,7 +757,8 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target) // Create the command line for building the given target using the selected // make std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const char* target) + const std::string& make, const char* makefile, + const std::string& target) { std::string command = make; if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index e0a64ca01..1cbc3f35f 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -49,9 +49,9 @@ private: std::string GetCBCompilerId(const cmMakefile* mf); int GetCBTargetType(cmTarget* target); std::string BuildMakeCommand(const std::string& make, const char* makefile, - const char* target); + const std::string& target); void AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmTarget* target, const char* make, const cmMakefile* makefile, diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 1c9ac0260..3cfafa782 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -223,7 +223,7 @@ void cmExtraSublimeTextGenerator:: void cmExtraSublimeTextGenerator:: AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmLocalGenerator* lg, cmTarget* target, const char* make, @@ -315,7 +315,8 @@ void cmExtraSublimeTextGenerator:: // Create the command line for building the given target using the selected // make std::string cmExtraSublimeTextGenerator::BuildMakeCommand( - const std::string& make, const char* makefile, const char* target) + const std::string& make, const char* makefile, + const std::string& target) { std::string command = "\""; command += make + "\""; diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 790259372..44dfb3194 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -60,12 +60,12 @@ private: * specified target. */ std::string BuildMakeCommand(const std::string& make, const char* makefile, - const char* target); + const std::string& target); /** Appends the specified target to the generated project file as a Sublime * Text build system. */ void AppendTarget(cmGeneratedFileStream& fout, - const char* targetName, + const std::string& targetName, cmLocalGenerator* lg, cmTarget* target, const char* make, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4e7c71ef8..7f22e0053 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -228,7 +228,7 @@ int cmGeneratorTarget::GetType() const } //---------------------------------------------------------------------------- -const char *cmGeneratorTarget::GetName() const +std::string cmGeneratorTarget::GetName() const { return this->Target->GetName(); } @@ -988,7 +988,7 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const bool cmStrictTargetComparison::operator()(cmTarget const* t1, cmTarget const* t2) const { - int nameResult = strcmp(t1->GetName(), t2->GetName()); + int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); if (nameResult == 0) { return strcmp(t1->GetMakefile()->GetStartOutputDirectory(), diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6e19f7de4..b15bade37 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -27,7 +27,7 @@ public: cmGeneratorTarget(cmTarget*); int GetType() const; - const char *GetName() const; + std::string GetName() const; const char *GetProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files) const; diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 33c43caf6..30bec1604 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -295,7 +295,7 @@ bool cmGetPropertyCommand::HandleTargetMode() if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetName()); + return this->StoreResult(target->GetName().c_str()); } } return this->StoreResult((this->Variable + "-NOTFOUND").c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7e9367630..795048b7d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1616,7 +1616,7 @@ void cmGlobalGenerator::CheckLocalGenerators() int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, const char *projectName, - const char *target, bool fast, + const std::string& target, bool fast, std::string *output, cmMakefile *mf) { // if this is not set, then this is a first time configure @@ -1640,7 +1640,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, } std::string newTarget; - if (target && strlen(target)) + if (!target.empty()) { newTarget += target; #if 0 @@ -1664,7 +1664,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const char*, const char*, - const char*, const char*, bool, std::vector const&) + const std::string&, const char*, bool, std::vector const&) { makeCommand.push_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); @@ -1672,7 +1672,7 @@ void cmGlobalGenerator::GenerateBuildCommand( int cmGlobalGenerator::Build( const char *, const char *bindir, - const char *projectName, const char *target, + const char *projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, const char *config, @@ -1787,7 +1787,7 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( - const char* target, const char* config, const char* native, + const std::string& target, const char* config, const char* native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); @@ -1799,7 +1799,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( makeCommand += config; makeCommand += "\""; } - if(target && *target) + if(!target.empty()) { makeCommand += " --target \""; makeCommand += target; @@ -2041,7 +2041,7 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() ///! Find a local generator by its startdirectory cmLocalGenerator* -cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const +cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const { for(std::vector::const_iterator it = this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it) @@ -2056,20 +2056,20 @@ cmGlobalGenerator::FindLocalGenerator(const char* start_dir) const } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt) +void cmGlobalGenerator::AddAlias(const std::string& name, cmTarget *tgt) { this->AliasTargets[name] = tgt; } //---------------------------------------------------------------------------- -bool cmGlobalGenerator::IsAlias(const char *name) const +bool cmGlobalGenerator::IsAlias(const std::string& name) const { return this->AliasTargets.find(name) != this->AliasTargets.end(); } //---------------------------------------------------------------------------- cmTarget* -cmGlobalGenerator::FindTarget(const char* project, const char* name, +cmGlobalGenerator::FindTarget(const char* project, const std::string& name, bool excludeAliases) const { // if project specific @@ -2481,7 +2481,7 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf) //---------------------------------------------------------------------------- cmTarget cmGlobalGenerator::CreateGlobalTarget( - const char* name, const char* message, + const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector depends, const char* workingDirectory) @@ -2672,7 +2672,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const { return (target->GetType() == cmTarget::GLOBAL_TARGET || - strcmp(target->GetName(), this->GetAllTargetName()) == 0); + target->GetName() == this->GetAllTargetName()); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 2f23fd581..38d7f5893 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -106,7 +106,8 @@ public: * loaded commands, not as part of the usual build process. */ virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, + const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -117,7 +118,7 @@ public: * done first. */ int Build(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, const std::string& targetName, std::string *output, const char *makeProgram, const char *config, bool clean, bool fast, @@ -130,12 +131,12 @@ public: std::vector& makeCommand, const char* makeProgram, const char *projectName, const char *projectDir, - const char *targetName, const char* config, bool fast, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() ); /** Generate a "cmake --build" call for a given target and config. */ - std::string GenerateCMakeBuildCommand(const char* target, + std::string GenerateCMakeBuildCommand(const std::string& target, const char* config, const char* native, bool ignoreErrors); @@ -210,11 +211,11 @@ public: virtual void FindMakeProgram(cmMakefile*); ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const char* name, + cmTarget* FindTarget(const char* project, const std::string& name, bool excludeAliases = false) const; - void AddAlias(const char *name, cmTarget *tgt); - bool IsAlias(const char *name) const; + void AddAlias(const std::string& name, cmTarget *tgt); + bool IsAlias(const std::string& name) const; /** Determine if a name resolves to a framework on disk or a built target that is a framework. */ @@ -224,7 +225,7 @@ public: target in the project */ bool IsDependedOn(const char* project, cmTarget const* target); ///! Find a local generator by its startdirectory - cmLocalGenerator* FindLocalGenerator(const char* start_dir) const; + cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which @@ -355,7 +356,7 @@ protected: bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const; void FillLocalGeneratorToTargetMap(); void CreateDefaultGlobalTargets(cmTargets* targets); - cmTarget CreateGlobalTarget(const char* name, const char* message, + cmTarget CreateGlobalTarget(const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector depends, const char* workingDir); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 731bc00c0..b0279956b 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -554,7 +554,7 @@ void cmGlobalNinjaGenerator const char* makeProgram, const char* /*projectName*/, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* /*config*/, bool /*fast*/, std::vector const& makeOptions) @@ -565,9 +565,9 @@ void cmGlobalNinjaGenerator makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); - if(targetName && *targetName) + if(!targetName.empty()) { - if(strcmp(targetName, "clean") == 0) + if(targetName == "clean") { makeCommand.push_back("-t"); makeCommand.push_back("clean"); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 0d5fb4482..41d151026 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -196,7 +196,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0b37a07a1..74b8e987a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -568,7 +568,7 @@ void cmGlobalUnixMakefileGenerator3 const char* makeProgram, const char* /*projectName*/, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* /*config*/, bool fast, std::vector const& makeOptions) @@ -585,7 +585,7 @@ void cmGlobalUnixMakefileGenerator3 } makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); - if ( targetName && strlen(targetName)) + if (!targetName.empty()) { cmLocalUnixMakefileGenerator3 *lg; if (this->LocalGenerators.size()) @@ -649,8 +649,7 @@ cmGlobalUnixMakefileGenerator3 } // Don't emit the same rule twice (e.g. two targets with the same // simple name) - if(t->second->GetName() && - strlen(t->second->GetName()) && + if(!t->second->GetName().empty() && emitted.insert(t->second->GetName()).second && // Handle user targets here. Global targets are handled in // the local generator on a per-directory basis. @@ -746,8 +745,7 @@ cmGlobalUnixMakefileGenerator3 { continue; } - if (t->second->GetName() - && strlen(t->second->GetName()) + if (!t->second->GetName().empty() && ((t->second->GetType() == cmTarget::EXECUTABLE) || (t->second->GetType() == cmTarget::STATIC_LIBRARY) || (t->second->GetType() == cmTarget::SHARED_LIBRARY) @@ -975,7 +973,7 @@ cmGlobalUnixMakefileGenerator3::ProgressMapCompare ::operator()(cmTarget const* l, cmTarget const* r) const { // Order by target name. - if(int c = strcmp(l->GetName(), r->GetName())) + if(int c = strcmp(l->GetName().c_str(), r->GetName().c_str())) { return c < 0; } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 9173751d1..f97ae9b82 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -112,7 +112,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 6983ef912..1346e13ff 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -313,7 +313,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions) @@ -369,25 +369,26 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.push_back(makeProgramSelected); + std::string realTarget = targetName; // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD - if(!targetName || strlen(targetName) == 0) + if(realTarget.empty()) { - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } - if ( targetName && strcmp(targetName, "clean") == 0 ) + if ( realTarget == "clean" ) { makeCommand.push_back(std::string(projectName)+".sln"); makeCommand.push_back("/t:Clean"); } else { - std::string targetProject(targetName); + std::string targetProject(realTarget); targetProject += ".vcxproj"; if (targetProject.find('/') == std::string::npos) { // it might be in a subdir if (cmSlnProjectEntry const* proj = - slnData.GetProjectByName(targetName)) + slnData.GetProjectByName(realTarget)) { targetProject = proj->GetRelativePath(); cmSystemTools::ConvertToUnixSlashes(targetProject); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 976d41fa1..198e113ca 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -37,7 +37,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 6c458c367..534a493e5 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -119,7 +119,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions @@ -134,14 +134,15 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( makeCommand.push_back("/MAKE"); std::string targetArg; bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + std::string realTarget = targetName; + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - targetArg += targetName; + targetArg += realTarget; } else { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 5521410b3..40b8462d5 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -57,7 +57,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index bb6328956..5c7af0005 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -186,7 +186,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions) @@ -208,11 +208,12 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeCommand.push_back(makeProgramSelected); makeCommand.push_back(std::string(projectName) + ".sln"); + std::string realTarget = targetName; bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } if(clean) { @@ -233,9 +234,9 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( } makeCommand.push_back("/project"); - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - makeCommand.push_back(targetName); + makeCommand.push_back(realTarget); } else { @@ -381,7 +382,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( std::set allConfigurations(this->Configurations.begin(), this->Configurations.end()); this->WriteProjectConfigurations( - fout, target->GetName(), target->GetType(), + fout, target->GetName().c_str(), target->GetType(), allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); } else diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index f69bd8403..a7aca6042 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -65,7 +65,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 12c240b6e..0453333ef 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -426,7 +426,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( { continue; } - std::string guid = this->GetGUID((*i)->GetName()); + std::string guid = this->GetGUID((*i)->GetName().c_str()); fout << "\t\t{" << guid << "} = {" << guid << "}\n"; } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 0c5f35b61..d388034e3 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -870,15 +870,15 @@ cmGlobalVisualStudioGenerator::TargetCompare ::operator()(cmTarget const* l, cmTarget const* r) const { // Make sure ALL_BUILD is first so it is the default active project. - if(strcmp(r->GetName(), "ALL_BUILD") == 0) + if(r->GetName() == "ALL_BUILD") { return false; } - if(strcmp(l->GetName(), "ALL_BUILD") == 0) + if(l->GetName() == "ALL_BUILD") { return true; } - return strcmp(l->GetName(), r->GetName()) < 0; + return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 4b73118e8..b1fa838b5 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -104,8 +104,8 @@ protected: VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmTarget&); - bool CheckTargetLinks(cmTarget& target, const char* name); - std::string GetUtilityForTarget(cmTarget& target, const char*); + bool CheckTargetLinks(cmTarget& target, const std::string& name); + std::string GetUtilityForTarget(cmTarget& target, const std::string&); virtual std::string WriteUtilityDepend(cmTarget const*) = 0; std::string GetUtilityDepend(cmTarget const* target); typedef std::map UtilityDependsMap; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3f2416749..9e1e90221 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -263,7 +263,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( const char* makeProgram, const char* projectName, const char* /*projectDir*/, - const char* targetName, + const std::string& targetName, const char* config, bool /*fast*/, std::vector const& makeOptions) @@ -283,10 +283,11 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.push_back(projectArg); bool clean = false; - if ( targetName && strcmp(targetName, "clean") == 0 ) + std::string realTarget = targetName; + if ( realTarget == "clean" ) { clean = true; - targetName = "ALL_BUILD"; + realTarget = "ALL_BUILD"; } if(clean) { @@ -302,9 +303,9 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( { config = 0; } - if (targetName && strlen(targetName)) + if (!realTarget.empty()) { - makeCommand.push_back(targetName); + makeCommand.push_back(realTarget); } else { @@ -1737,7 +1738,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } @@ -2420,7 +2421,7 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXAggregateTarget); - target->SetComment(cmtarget.GetName()); + target->SetComment(cmtarget.GetName().c_str()); cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); std::vector emptyContentVector; @@ -2621,7 +2622,7 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget, fileRef->AddAttribute("refType", this->CreateString("0")); fileRef->AddAttribute("sourceTree", this->CreateString("BUILT_PRODUCTS_DIR")); - fileRef->SetComment(cmtarget.GetName()); + fileRef->SetComment(cmtarget.GetName().c_str()); target->AddAttribute("productReference", this->CreateObjectReference(fileRef)); if(const char* productType = this->GetTargetProductType(cmtarget)) @@ -2654,8 +2655,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) } //---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name, - const char* id) +std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, + const std::string& id) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -2668,7 +2669,7 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name, } this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), - id, "Stored Xcode object GUID", cmCacheManager::INTERNAL); + id.c_str(), "Stored Xcode object GUID", cmCacheManager::INTERNAL); return id; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 15f1363cc..0cb17585a 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -58,7 +58,7 @@ public: const char* makeProgram, const char* projectName, const char* projectDir, - const char* targetName, + const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() @@ -129,7 +129,7 @@ private: ); cmXCodeObject* FindXCodeTarget(cmTarget const*); - std::string GetOrCreateId(const char* name, const char* id); + std::string GetOrCreateId(const std::string& name, const std::string& id); // create cmXCodeObject from these functions so that memory can be managed // correctly. All objects created are stored in this->XCodeObjects. diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index db964a989..6173d219a 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -300,7 +300,7 @@ void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const } -void cmGraphVizWriter::WriteConnections(const char* targetName, +void cmGraphVizWriter::WriteConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const @@ -359,7 +359,7 @@ void cmGraphVizWriter::WriteConnections(const char* targetName, } -void cmGraphVizWriter::WriteDependerConnections(const char* targetName, +void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const @@ -444,7 +444,7 @@ void cmGraphVizWriter::WriteDependerConnections(const char* targetName, } -void cmGraphVizWriter::WriteNode(const char* targetName, +void cmGraphVizWriter::WriteNode(const std::string& targetName, const cmTarget* target, std::set& insertedNodes, cmGeneratedFileStream& str) const @@ -558,7 +558,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) } -bool cmGraphVizWriter::IgnoreThisTarget(const char* name) +bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name) { for(std::vector::iterator itvIt = this->TargetsToIgnoreRegex.begin(); diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 17b97f8c9..6af460b73 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -44,23 +44,23 @@ protected: void WriteHeader(cmGeneratedFileStream& str) const; - void WriteConnections(const char* targetName, + void WriteConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const; - void WriteDependerConnections(const char* targetName, + void WriteDependerConnections(const std::string& targetName, std::set& insertedNodes, std::set& insertedConnections, cmGeneratedFileStream& str) const; - void WriteNode(const char* targetName, const cmTarget* target, + void WriteNode(const std::string& targetName, const cmTarget* target, std::set& insertedNodes, cmGeneratedFileStream& str) const; void WriteFooter(cmGeneratedFileStream& str) const; - bool IgnoreThisTarget(const char* name); + bool IgnoreThisTarget(const std::string& name); bool GenerateForTargetType(cmTarget::TargetType targetType) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e1abfef99..ded4fc65e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -781,7 +781,7 @@ void cmLocalGenerator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.Target->GetName()); + target.Target->GetName().c_str()); return; } // if the language is not in the set lang then create custom @@ -1695,7 +1695,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target->Target->GetName()); + target->Target->GetName().c_str()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); @@ -2012,7 +2012,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, } //---------------------------------------------------------------------------- -bool cmLocalGenerator::GetRealDependency(const char* inName, +bool cmLocalGenerator::GetRealDependency(const std::string& inName, const char* config, std::string& dep) { @@ -2040,7 +2040,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, { // make sure it is not just a coincidence that the target name // found is part of the inName - if(cmSystemTools::FileIsFullPath(inName)) + if(cmSystemTools::FileIsFullPath(inName.c_str())) { std::string tLocation; if(target->GetType() >= cmTarget::EXECUTABLE && @@ -2088,7 +2088,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, } // The name was not that of a CMake target. It must name a file. - if(cmSystemTools::FileIsFullPath(inName)) + if(cmSystemTools::FileIsFullPath(inName.c_str())) { // This is a full path. Return it as given. dep = inName; @@ -3474,7 +3474,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, //---------------------------------------------------------------------------- void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, - const char* targetName, + const std::string& targetName, const char* fname) { // Find the Info.plist template. @@ -3503,7 +3503,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; mf->PushScope(); - mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName); + mf->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_INFO_STRING"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_BUNDLE_GUI_IDENTIFIER"); @@ -3518,8 +3518,8 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, //---------------------------------------------------------------------------- void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, - const char* targetName, - const char* fname) + const std::string& targetName, + const char* fname) { // Find the Info.plist template. const char* in = target->GetProperty("MACOSX_FRAMEWORK_INFO_PLIST"); @@ -3547,7 +3547,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, // back to the directory-level values set by the user. cmMakefile* mf = this->Makefile; mf->PushScope(); - mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName); + mf->AddDefinition("MACOSX_FRAMEWORK_NAME", targetName.c_str()); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 182b7839b..c1deb0921 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -195,7 +195,7 @@ public: * the source directory of this generator. This should only be * used for dependencies of custom commands. */ - bool GetRealDependency(const char* name, const char* config, + bool GetRealDependency(const std::string& name, const char* config, std::string& dep); ///! for existing files convert to output path and short path if spaces @@ -339,14 +339,14 @@ public: /** * Generate a Mac OS X application bundle Info.plist file. */ - void GenerateAppleInfoPList(cmTarget* target, const char* targetName, + void GenerateAppleInfoPList(cmTarget* target, const std::string& targetName, const char* fname); /** * Generate a Mac OS X framework Info.plist file. */ void GenerateFrameworkInfoPList(cmTarget* target, - const char* targetName, + const std::string& targetName, const char* fname); /** Construct a comment for a custom command. */ std::string ConstructComment(const cmCustomCommand& cc, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 11b89f464..f47ea299d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -550,14 +550,14 @@ void cmLocalUnixMakefileGenerator3 ::WriteMakeRule(std::ostream& os, const char* comment, - const char* target, + const std::string& target, const std::vector& depends, const std::vector& commands, bool symbolic, bool in_help) { // Make sure there is a target. - if(!target || !*target) + if(target.empty()) { cmSystemTools::Error("No target for WriteMakeRule! called with comment: ", comment); @@ -859,11 +859,11 @@ void cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::WriteConvenienceRule(std::ostream& ruleFileStream, - const char* realTarget, - const char* helpTarget) + const std::string& realTarget, + const std::string& helpTarget) { // A rule is only needed if the names are different. - if(strcmp(realTarget, helpTarget) != 0) + if(realTarget != helpTarget) { // The helper target depends on the real target. std::vector depends; @@ -2034,7 +2034,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::GetRecursiveMakeCall(const char *makefile, const char* tgt) +::GetRecursiveMakeCall(const char *makefile, const std::string& tgt) { // Call make on the given file. std::string cmd; @@ -2059,7 +2059,7 @@ cmLocalUnixMakefileGenerator3 } // Add the target. - if (tgt && tgt[0] != '\0') + if (!tgt.empty()) { // The make target is always relative to the top of the build tree. std::string tgt2 = this->Convert(tgt, HOME_OUTPUT); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index b0ccf52bc..2ad525037 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -55,7 +55,7 @@ public: // Write out a make rule void WriteMakeRule(std::ostream& os, const char* comment, - const char* target, + const std::string& target, const std::vector& depends, const std::vector& commands, bool symbolic, @@ -168,7 +168,8 @@ public: void WriteDivider(std::ostream& os); /** used to create a recursive make call */ - std::string GetRecursiveMakeCall(const char *makefile, const char* tgt); + std::string GetRecursiveMakeCall(const char *makefile, + const std::string& tgt); // append flags to a string virtual void AppendFlags(std::string& flags, const char* newFlags); @@ -273,8 +274,8 @@ protected: void WriteConvenienceRule(std::ostream& ruleFileStream, - const char* realTarget, - const char* helpTarget); + const std::string& realTarget, + const std::string& helpTarget); void WriteTargetDependRule(std::ostream& ruleFileStream, cmTarget& target); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index ff217c37f..88206f1c0 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -186,7 +186,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() // extern std::string GetVS6TargetName(const std::string& targetName); -void cmLocalVisualStudio6Generator::CreateSingleDSP(const char *lname, +void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname, cmTarget &target) { // add to the list of projects @@ -263,7 +263,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget &target) { // For utility targets need custom command since pre- and post- @@ -372,7 +372,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, void cmLocalVisualStudio6Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName) + std::ostream &fout, const std::string& libName) { cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); @@ -572,9 +572,9 @@ cmLocalVisualStudio6Generator { // Create a fake output that forces the rule to run. char* output = new char[(strlen(this->Makefile->GetStartOutputDirectory()) + - strlen(target.GetName()) + 30)]; + target.GetName().size() + 30)]; sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(), - target.GetName(), count); + target.GetName().c_str(), count); std::string comment = this->ConstructComment(origCommand, ""); // Add the rule with the given dependencies and commands. @@ -699,7 +699,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout) void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, - const char* libName, + const std::string& libName, cmTarget& target) { std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT"); @@ -813,8 +813,8 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, // look for custom rules on a target and collect them together std::string cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, - const char* configName, - const char * /* libName */) + const char* configName, + const std::string& /* libName */) { if (target.GetType() >= cmTarget::UTILITY ) { @@ -926,7 +926,7 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, void cmLocalVisualStudio6Generator ::WriteDSPHeader(std::ostream& fout, - const char *libName, cmTarget &target, + const std::string& libName, cmTarget &target, std::vector &) { bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE && @@ -1257,7 +1257,7 @@ void cmLocalVisualStudio6Generator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } @@ -1679,7 +1679,7 @@ void cmLocalVisualStudio6Generator { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } // if CXX is on and the target contains cxx code then add the cxx flags diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index f45bc1758..6702111ff 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -48,7 +48,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType, const char* libName, cmTarget&); + void SetBuildType(BuildType, const std::string& libName, cmTarget&); virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; @@ -56,15 +56,15 @@ private: std::string DSPHeaderTemplate; std::string DSPFooterTemplate; - void CreateSingleDSP(const char *lname, cmTarget &tgt); - void WriteDSPFile(std::ostream& fout, const char *libName, + void CreateSingleDSP(const std::string& lname, cmTarget &tgt); + void WriteDSPFile(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteDSPBeginGroup(std::ostream& fout, const char* group, const char* filter); void WriteDSPEndGroup(std::ostream& fout); - void WriteDSPHeader(std::ostream& fout, const char *libName, + void WriteDSPHeader(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); void WriteDSPFooter(std::ostream& fout); @@ -77,14 +77,14 @@ private: std::vector& depends, const cmCustomCommand& origCommand); void WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName); + std::ostream &fout, const std::string& libName); class EventWriter; friend class EventWriter; cmsys::auto_ptr MaybeCreateOutputDir(cmTarget& target, const char* config); std::string CreateTargetRules(cmTarget &target, const char* configName, - const char *libName); + const std::string& libName); void ComputeLinkOptions(cmTarget& target, const char* configName, const std::string extraOptions, std::string& options); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f93a7aace..786791cb7 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -83,7 +83,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() if(path) { this->ReadAndStoreExternalGUID( - l->second.GetName(), path); + l->second.GetName().c_str(), path); } else { @@ -334,8 +334,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() } void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout, - const char *libName, - cmTarget &target) + const std::string& libName, + cmTarget &target) { std::vector *configs = static_cast @@ -637,9 +637,9 @@ private: //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, - const char* configName, - const char *libName, - cmTarget &target) + const char* configName, + const std::string& libName, + cmTarget &target) { const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); if(!mfcFlag) @@ -694,7 +694,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { cmSystemTools::Error ("CMake can not determine linker language for target: ", - target.GetName()); + target.GetName().c_str()); return; } if(linkLanguage == "C" || linkLanguage == "CXX" @@ -1380,7 +1380,7 @@ cmLocalVisualStudio7Generator } void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget &target) { // get the configurations @@ -1627,7 +1627,7 @@ cmLocalVisualStudio7Generator bool cmLocalVisualStudio7Generator ::WriteGroup(const cmSourceGroup *sg, cmTarget& target, - std::ostream &fout, const char *libName, + std::ostream &fout, const std::string& libName, std::vector *configs) { const std::vector &sourceFiles = @@ -1906,7 +1906,7 @@ void cmLocalVisualStudio7Generator ::OutputTargetRules(std::ostream& fout, const char* configName, cmTarget &target, - const char * /*libName*/) + const std::string& /*libName*/) { if (target.GetType() > cmTarget::GLOBAL_TARGET) { @@ -1966,7 +1966,7 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, void cmLocalVisualStudio7Generator ::WriteProjectStartFortran(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget & target) { @@ -2017,7 +2017,7 @@ cmLocalVisualStudio7Generator } this->WriteProjectSCC(fout, target); fout<< "\tKeyword=\"" << keyword << "\">\n" - << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\">\n" + << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\t\n" << "\t\tPlatformName << "\"/>\n" << "\t\n"; @@ -2026,7 +2026,7 @@ cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, - const char *libName, + const std::string& libName, cmTarget & target, std::vector &) { @@ -2049,7 +2049,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, const char* projLabel = target.GetProperty("PROJECT_LABEL"); if(!projLabel) { - projLabel = libName; + projLabel = libName.c_str(); } const char* keyword = target.GetProperty("VS_KEYWORD"); if(!keyword) @@ -2061,7 +2061,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, fout << "\tName=\"" << projLabel << "\"\n"; if(this->Version >= VS8) { - fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; + fout << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\"\n"; } this->WriteProjectSCC(fout, target); if(const char* targetFrameworkVersion = diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 92e4d3c12..4d727472d 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -74,29 +74,29 @@ private: const char* configName); void FixGlobalTargets(); void WriteProjectFiles(); - void WriteVCProjHeader(std::ostream& fout, const char *libName, + void WriteVCProjHeader(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); void WriteVCProjFooter(std::ostream& fout, cmTarget &target); - void WriteVCProjFile(std::ostream& fout, const char *libName, + void WriteVCProjFile(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteConfigurations(std::ostream& fout, - const char *libName, cmTarget &tgt); + const std::string& libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, const char* configName, - const char* libName, cmTarget &tgt); + const std::string& libName, cmTarget &tgt); std::string EscapeForXML(const char* s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); void OutputTargetRules(std::ostream& fout, const char* configName, - cmTarget &target, const char *libName); + cmTarget &target, const std::string& libName); void OutputBuildTool(std::ostream& fout, const char* configName, cmTarget& t, const Options& targetOptions); void OutputLibraryDirectories(std::ostream& fout, std::vector const& dirs); void WriteProjectSCC(std::ostream& fout, cmTarget& target); - void WriteProjectStart(std::ostream& fout, const char *libName, + void WriteProjectStart(std::ostream& fout, const std::string& libName, cmTarget &tgt, std::vector &sgs); - void WriteProjectStartFortran(std::ostream& fout, const char *libName, + void WriteProjectStartFortran(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteVCProjBeginGroup(std::ostream& fout, const char* group, @@ -111,7 +111,8 @@ private: bool WriteGroup(const cmSourceGroup *sg, cmTarget& target, std::ostream &fout, - const char *libName, std::vector *configs); + const std::string& libName, + std::vector *configs); friend class cmLocalVisualStudio7GeneratorFCInfo; friend class cmLocalVisualStudio7GeneratorInternals; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8274b1377..7215e766e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -878,7 +878,7 @@ void cmMakefile::ConfigureFinalPass() //---------------------------------------------------------------------------- void -cmMakefile::AddCustomCommandToTarget(const char* target, +cmMakefile::AddCustomCommandToTarget(const std::string& target, const std::vector& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, @@ -1120,7 +1120,7 @@ cmMakefile::AddCustomCommandToOutput(const char* output, //---------------------------------------------------------------------------- void -cmMakefile::AddCustomCommandOldStyle(const char* target, +cmMakefile::AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, const char* source, @@ -1129,7 +1129,7 @@ cmMakefile::AddCustomCommandOldStyle(const char* target, { // Translate the old-style signature to one of the new-style // signatures. - if(strcmp(source, target) == 0) + if(source == target) { // In the old-style signature if the source and target were the // same then it added a post-build rule to the target. Preserve @@ -1179,7 +1179,8 @@ cmMakefile::AddCustomCommandOldStyle(const char* target, else { cmSystemTools::Error("Attempt to add a custom rule to a target " - "that does not exist yet for target ", target); + "that does not exist yet for target ", + target.c_str()); return; } } @@ -1453,7 +1454,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) return true; } -void cmMakefile::AddLinkLibrary(const char* lib, +void cmMakefile::AddLinkLibrary(const std::string& lib, cmTarget::LinkLibraryType llt) { cmTarget::LibraryID tmp; @@ -1462,8 +1463,8 @@ void cmMakefile::AddLinkLibrary(const char* lib, this->LinkLibraries.push_back(tmp); } -void cmMakefile::AddLinkLibraryForTarget(const char *target, - const char* lib, +void cmMakefile::AddLinkLibraryForTarget(const std::string& target, + const std::string& lib, cmTarget::LinkLibraryType llt) { cmTargets::iterator i = this->Targets.find(target); @@ -1500,8 +1501,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target, } } -void cmMakefile::AddLinkDirectoryForTarget(const char *target, - const char* d) +void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, + const std::string& d) { cmTargets::iterator i = this->Targets.find(target); if ( i != this->Targets.end()) @@ -1520,46 +1521,37 @@ void cmMakefile::AddLinkDirectoryForTarget(const char *target, { cmSystemTools::Error ("Attempt to add link directories to non-existent target: ", - target, " for directory ", d); + target.c_str(), " for directory ", d.c_str()); } } -void cmMakefile::AddLinkLibrary(const char* lib) +void cmMakefile::AddLinkLibrary(const std::string& lib) { this->AddLinkLibrary(lib,cmTarget::GENERAL); } -void cmMakefile::AddLinkDirectory(const char* dir) +void cmMakefile::AddLinkDirectory(const std::string& dir) { // Don't add a link directory that is already present. Yes, this // linear search results in n^2 behavior, but n won't be getting // much bigger than 20. We cannot use a set because of order // dependency of the link search path. - if(!dir) + if(dir.empty()) { return; } + std::string newdir = dir; // remove trailing slashes - if(dir[strlen(dir)-1] == '/') + if(*dir.rbegin() == '/') { - std::string newdir = dir; - newdir = newdir.substr(0, newdir.size()-1); - if(std::find(this->LinkDirectories.begin(), - this->LinkDirectories.end(), - newdir.c_str()) == this->LinkDirectories.end()) - { - this->LinkDirectories.push_back(newdir); - } + newdir = dir.substr(0, dir.size()-1); } - else + if(std::find(this->LinkDirectories.begin(), + this->LinkDirectories.end(), newdir) + == this->LinkDirectories.end()) { - if(std::find(this->LinkDirectories.begin(), - this->LinkDirectories.end(), dir) - == this->LinkDirectories.end()) - { - this->LinkDirectories.push_back(dir); - } + this->LinkDirectories.push_back(dir); } } @@ -1975,7 +1967,8 @@ void cmMakefile::SetProjectName(const char* p) } -void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) +void cmMakefile::AddGlobalLinkInformation(const std::string& name, + cmTarget& target) { // for these targets do not add anything switch(target.GetType()) @@ -1996,13 +1989,14 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) } -void cmMakefile::AddAlias(const char* lname, cmTarget *tgt) +void cmMakefile::AddAlias(const std::string& lname, cmTarget *tgt) { this->AliasTargets[lname] = tgt; this->LocalGenerator->GetGlobalGenerator()->AddAlias(lname, tgt); } -cmTarget* cmMakefile::AddLibrary(const char* lname, cmTarget::TargetType type, +cmTarget* cmMakefile::AddLibrary(const std::string& lname, + cmTarget::TargetType type, const std::vector &srcs, bool excludeFromAll) { @@ -2048,7 +2042,7 @@ cmTarget* cmMakefile::AddExecutable(const char *exeName, //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddNewTarget(cmTarget::TargetType type, const char* name) +cmMakefile::AddNewTarget(cmTarget::TargetType type, const std::string& name) { cmTargets::iterator it = this->Targets.insert(cmTargets::value_type(name, cmTarget())).first; @@ -3066,7 +3060,8 @@ void cmMakefile::ExpandSourceListArguments( } int cmMakefile::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, + const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output) @@ -4030,7 +4025,8 @@ void cmMakefile::DefineProperties(cmake *cm) //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddImportedTarget(const char* name, cmTarget::TargetType type, +cmMakefile::AddImportedTarget(const std::string& name, + cmTarget::TargetType type, bool global) { // Create the target. @@ -4087,7 +4083,7 @@ bool cmMakefile::IsAlias(const std::string& name) const //---------------------------------------------------------------------------- cmGeneratorTarget* -cmMakefile::FindGeneratorTargetToUse(const char* name) const +cmMakefile::FindGeneratorTargetToUse(const std::string& name) const { if (cmTarget *t = this->FindTargetToUse(name)) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 331a06495..aa25f0995 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -127,7 +127,7 @@ public: * loaded commands, not as part of the usual build process. */ int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + const char *projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output); @@ -168,7 +168,7 @@ public: void Print() const; /** Add a custom command to the build. */ - void AddCustomCommandToTarget(const char* target, + void AddCustomCommandToTarget(const std::string& target, const std::vector& depends, const cmCustomCommandLines& commandLines, cmTarget::CustomCommandType type, @@ -190,7 +190,7 @@ public: const char* comment, const char* workingDir, bool replace = false, bool escapeOldStyle = true); - void AddCustomCommandOldStyle(const char* target, + void AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, const char* source, @@ -205,10 +205,11 @@ public: void AddCompileOption(const char* option); /** Create a new imported target with the name and type given. */ - cmTarget* AddImportedTarget(const char* name, cmTarget::TargetType type, + cmTarget* AddImportedTarget(const std::string& name, + cmTarget::TargetType type, bool global); - cmTarget* AddNewTarget(cmTarget::TargetType type, const char* name); + cmTarget* AddNewTarget(cmTarget::TargetType type, const std::string& name); /** * Add an executable to the build. @@ -239,16 +240,16 @@ public: /** * Add a link library to the build. */ - void AddLinkLibrary(const char*); - void AddLinkLibrary(const char*, cmTarget::LinkLibraryType type); - void AddLinkLibraryForTarget(const char *tgt, const char*, + void AddLinkLibrary(const std::string&); + void AddLinkLibrary(const std::string&, cmTarget::LinkLibraryType type); + void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, cmTarget::LinkLibraryType type); - void AddLinkDirectoryForTarget(const char *tgt, const char* d); + void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); /** * Add a link directory to the build. */ - void AddLinkDirectory(const char*); + void AddLinkDirectory(const std::string&); const std::vector& GetLinkDirectories() const { @@ -323,10 +324,10 @@ public: /** * Set the name of the library. */ - cmTarget* AddLibrary(const char *libname, cmTarget::TargetType type, + cmTarget* AddLibrary(const std::string& libname, cmTarget::TargetType type, const std::vector &srcs, bool excludeFromAll = false); - void AddAlias(const char *libname, cmTarget *tgt); + void AddAlias(const std::string& libname, cmTarget *tgt); #if defined(CMAKE_BUILD_WITH_CMAKE) /** @@ -534,7 +535,7 @@ public: cmTarget* FindTargetToUse(const std::string& name, bool excludeAliases = false) const; bool IsAlias(const std::string& name) const; - cmGeneratorTarget* FindGeneratorTargetToUse(const char* name) const; + cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; /** * Mark include directories as system directories. @@ -878,7 +879,7 @@ public: protected: // add link libraries and directories to the target - void AddGlobalLinkInformation(const char* name, cmTarget& target); + void AddGlobalLinkInformation(const std::string& name, cmTarget& target); // Check for a an unused variable void CheckForUnused(const char* reason, const std::string& name) const; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index b8273630e..ca8ff060c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName(), "\"."); + this->Target->GetName().c_str(), "\"."); return; } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 96159f953..d9425e6a6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -125,7 +125,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); } //---------------------------------------------------------------------------- @@ -243,7 +243,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName(), "\"."); + this->Target->GetName().c_str(), "\"."); return; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3ba5a77e2..fb9b0451d 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1347,7 +1347,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all objects for the // target. variableName = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" @@ -1382,7 +1382,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all external objects // for the target. variableNameExternal = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), "_EXTERNAL_OBJECTS"); *this->BuildFileStream << "\n" @@ -1683,7 +1683,7 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- std::string cmMakefileTargetGenerator::GetLinkRule( - const cmStdString& linkRuleVar) + const std::string& linkRuleVar) { std::string linkRule = this->Makefile->GetRequiredDefinition(linkRuleVar); if(this->Target->HasImplibGNUtoMS()) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index baae2b091..d2cbaddb9 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -138,7 +138,7 @@ protected: void AppendLinkDepends(std::vector& depends); // Lookup the link rule for this target. - std::string GetLinkRule(const cmStdString& linkRuleVar); + std::string GetLinkRule(const std::string& linkRuleVar); /** In order to support parallel builds for custom commands with multiple outputs the outputs are given a serial order, and only diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 7751ad9b4..2066fc274 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -105,7 +105,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); // Write clean target this->WriteTargetCleanRules(); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b81fbeb40..502127e50 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -75,7 +75,7 @@ void cmNinjaNormalTargetGenerator::Generate() if (this->TargetLinkLanguage.empty()) { cmSystemTools::Error("CMake can not determine linker language for " "target: ", - this->GetTarget()->GetName()); + this->GetTarget()->GetName().c_str()); return; } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d940fe24d..e075c548b 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -772,7 +772,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, makefile->AddDefinition("_qt_uic_options_options", cmLocalGenerator::EscapeForCMake(uiFileOptions.c_str()).c_str()); - const char* targetName = target->GetName(); + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic"); @@ -791,7 +791,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!qt4Uic) { cmSystemTools::Error("Qt4::uic target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0)); @@ -799,7 +799,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, else { cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and " - "Qt 5 ", targetName); + "Qt 5 ", targetName.c_str()); } } @@ -921,14 +921,14 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) makefile->AddDefinition("_qt_rcc_options_options", cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str()); - const char* targetName = target->GetName(); + std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) { cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc"); if (!qt5Rcc) { cmSystemTools::Error("Qt5::rcc target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0)); @@ -939,7 +939,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) if (!qt4Rcc) { cmSystemTools::Error("Qt4::rcc target not found ", - targetName); + targetName.c_str()); return; } makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0)); @@ -947,7 +947,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) else { cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and " - "Qt 5 ", targetName); + "Qt 5 ", targetName.c_str()); } } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 1a6f1d63f..e561e36d3 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -203,7 +203,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str()))) + ->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index dab4180e5..fa5aafe4e 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -91,7 +91,7 @@ bool cmSetTargetPropertiesCommand } bool cmSetTargetPropertiesCommand -::SetOneTarget(const char *tname, +::SetOneTarget(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf) { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index 6221a189f..cfe35df38 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -37,7 +37,7 @@ public: /** * Used by this command and cmSetPropertiesCommand */ - static bool SetOneTarget(const char *tname, + static bool SetOneTarget(const std::string& tname, std::vector &propertyPairs, cmMakefile *mf); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6782822c5..c927a0b87 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -234,7 +234,7 @@ void cmTarget::DefineProperties(cmake *cm) "", "", true); } -void cmTarget::SetType(TargetType type, const char* name) +void cmTarget::SetType(TargetType type, const std::string& name) { this->Name = name; // only add dependency information for library targets @@ -415,7 +415,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } //---------------------------------------------------------------------------- -void cmTarget::AddUtility(const char *u, cmMakefile *makefile) +void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { this->Utilities.insert(u); if(makefile) @@ -425,7 +425,8 @@ void cmTarget::AddUtility(const char *u, cmMakefile *makefile) } //---------------------------------------------------------------------------- -cmListFileBacktrace const* cmTarget::GetUtilityBacktrace(const char *u) const +cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( + const std::string& u) const { std::map::const_iterator i = this->UtilityBacktraces.find(u); @@ -657,7 +658,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr) //---------------------------------------------------------------------------- void cmTarget::MergeLinkLibraries( cmMakefile& mf, - const char *selfname, + const std::string& selfname, const LinkLibraryVectorType& libs ) { // Only add on libraries we haven't added on before. @@ -675,7 +676,7 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf, } //---------------------------------------------------------------------------- -void cmTarget::AddLinkDirectory(const char* d) +void cmTarget::AddLinkDirectory(const std::string& d) { // Make sure we don't add unnecessary search directories. if(this->LinkDirectoriesEmmitted.insert(d).second) @@ -720,7 +721,7 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const //---------------------------------------------------------------------------- void cmTarget::ClearDependencyInformation( cmMakefile& mf, - const char* target ) + const std::string& target ) { // Clear the dependencies. The cache variable must exist iff we are // recording dependency information for this target. @@ -844,9 +845,9 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, } //---------------------------------------------------------------------------- -static std::string targetNameGenex(const char *lib) +static std::string targetNameGenex(const std::string& lib) { - return std::string("$"; + return "$"; } //---------------------------------------------------------------------------- @@ -908,7 +909,8 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, //---------------------------------------------------------------------------- void cmTarget::AddLinkLibrary(cmMakefile& mf, - const char *target, const char* lib, + const std::string& target, + const std::string& lib, LinkLibraryType llt) { cmTarget *tgt = this->Makefile->FindTargetToUse(lib); @@ -917,7 +919,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string libName = (isNonImportedTarget && llt != GENERAL) ? targetNameGenex(lib) - : std::string(lib); + : lib; this->AppendProperty("LINK_LIBRARIES", this->GetDebugGeneratorExpressions(libName, llt).c_str()); @@ -925,7 +927,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, if (cmGeneratorExpression::Find(lib) != std::string::npos || (tgt && tgt->GetType() == INTERFACE_LIBRARY) - || (strcmp( target, lib ) == 0)) + || (target == lib )) { return; } @@ -1469,7 +1471,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } //---------------------------------------------------------------------------- -const char* cmTarget::GetExportName() const +std::string cmTarget::GetExportName() const { const char *exportName = this->GetProperty("EXPORT_NAME"); @@ -2630,7 +2632,7 @@ const char *cmTarget::GetProperty(const std::string& prop, if (prop == "NAME") { - return this->GetName(); + return this->GetName().c_str(); } // Watch for special "computed" properties that are dependent on diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 205c81c56..f73b271c2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -93,13 +93,13 @@ public: /** * Set the target type */ - void SetType(TargetType f, const char* name); + void SetType(TargetType f, const std::string& name); void MarkAsImported(); ///! Set/Get the name of the target - const char* GetName() const {return this->Name.c_str();} - const char* GetExportName() const; + const std::string& GetName() const {return this->Name;} + std::string GetExportName() const; ///! Set the cmMakefile that owns this target void SetMakefile(cmMakefile *mf); @@ -168,12 +168,12 @@ public: /** * Clear the dependency information recorded for this target, if any. */ - void ClearDependencyInformation(cmMakefile& mf, const char* target); + void ClearDependencyInformation(cmMakefile& mf, const std::string& target); // Check to see if a library is a framework and treat it different on Mac bool NameResolvesToFramework(const std::string& libname) const; void AddLinkLibrary(cmMakefile& mf, - const char *target, const char* lib, + const std::string& target, const std::string& lib, LinkLibraryType llt); enum TLLSignature { KeywordTLLSignature, @@ -182,12 +182,12 @@ public: bool PushTLLCommandTrace(TLLSignature signature); void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const; - void MergeLinkLibraries( cmMakefile& mf, const char* selfname, + void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname, const LinkLibraryVectorType& libs ); const std::vector& GetLinkDirectories() const; - void AddLinkDirectory(const char* d); + void AddLinkDirectory(const std::string& d); /** * Set the path where this target should be installed. This is relative to @@ -214,10 +214,10 @@ public: * name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE * commands. It is not a full path nor does it have an extension. */ - void AddUtility(const char* u, cmMakefile *makefile = 0); + void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target std::setconst& GetUtilities() const { return this->Utilities; } - cmListFileBacktrace const* GetUtilityBacktrace(const char* u) const; + cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ void FinishConfigure(); diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index ad1533ecd..b4623a053 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -136,7 +136,7 @@ public: return this->DependLibraries; } void AddDependTarget(const char* configName, - const char* tName) + const std::string& tName) { if(!configName) { From a5996111164a4c4121e7d1fa08dbcd0983bb3589 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 4 Feb 2014 13:35:11 -0500 Subject: [PATCH 113/278] FindCUDA: Fix a typo --- Modules/FindCUDA.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 7bc8d4946..94f82f6e0 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -987,7 +987,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path) endif() endif() - # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the + # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the # CMake source. # Remove leading / From 473ca1ac4a5df336ff09ee2c666e437eabf43bc9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:02:41 -0500 Subject: [PATCH 114/278] stringapi: Use string for OS X resource names --- Source/CPack/cmCPackOSXX11Generator.cxx | 6 +++--- Source/CPack/cmCPackOSXX11Generator.h | 5 +++-- Source/CPack/cmCPackPackageMakerGenerator.cxx | 9 +++++---- Source/CPack/cmCPackPackageMakerGenerator.h | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 76e15fb84..95ffab581 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -227,7 +227,7 @@ int cmCPackOSXX11Generator::InitializeInternal() //---------------------------------------------------------------------- /* -bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) +bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -271,7 +271,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) */ //---------------------------------------------------------------------- -bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, +bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { @@ -288,7 +288,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, if ( !outputFileName ) { - outputFileName = name; + outputFileName = name.c_str(); } std::string destFileName = dir; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index b7bd24396..7a93f5a57 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -37,8 +37,9 @@ protected: virtual const char* GetPackagingInstallPrefix(); virtual const char* GetOutputExtension() { return ".dmg"; } - //bool CopyCreateResourceFile(const char* name, const char* dir); - bool CopyResourcePlistFile(const char* name, const char* dir, + //bool CopyCreateResourceFile(const std::string& name, + // const std::string& dir); + bool CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index c5b9c6f4c..69886a1b7 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -553,8 +553,9 @@ int cmCPackPackageMakerGenerator::InitializeInternal() } //---------------------------------------------------------------------- -bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, - const char* dirName) +bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( + const std::string& name, + const std::string& dirName) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -563,7 +564,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() << " not specified. It should point to " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); return false; @@ -571,7 +572,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, if ( !cmSystemTools::FileExists(inFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << " resource file: " << inFileName << std::endl); return false; } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index ba3d968f6..bebb63337 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -51,7 +51,8 @@ protected: // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased // version of name) specifies the input file to use for this file, // which will be configured via ConfigureFile. - bool CopyCreateResourceFile(const char* name, const char *dirName); + bool CopyCreateResourceFile(const std::string& name, + const std::string& dirName); bool CopyResourcePlistFile(const char* name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if From 77f60392d93f41a8828d3db1d7b76d45f1535d07 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:06:13 -0500 Subject: [PATCH 115/278] stringapi: Accept strings when MD5 hashing data --- Source/cmCryptoHash.cxx | 10 +++++----- Source/cmCryptoHash.h | 4 ++-- Source/cmSystemTools.cxx | 4 ++-- Source/cmSystemTools.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 7f4b10fbc..0d3c6bbcb 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -35,18 +35,18 @@ cmsys::auto_ptr cmCryptoHash::New(const char* algo) } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashString(const char* input) +std::string cmCryptoHash::HashString(const std::string& input) { this->Initialize(); - this->Append(reinterpret_cast(input), - static_cast(strlen(input))); + this->Append(reinterpret_cast(&input[0]), + static_cast(input.size())); return this->Finalize(); } //---------------------------------------------------------------------------- -std::string cmCryptoHash::HashFile(const char* file) +std::string cmCryptoHash::HashFile(const std::string& file) { - cmsys::ifstream fin(file, std::ios::in | cmsys_ios_binary); + cmsys::ifstream fin(file.c_str(), std::ios::in | cmsys_ios_binary); if(!fin) { return ""; diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h index 1bea9abcb..88cd240c0 100644 --- a/Source/cmCryptoHash.h +++ b/Source/cmCryptoHash.h @@ -21,8 +21,8 @@ class cmCryptoHash public: virtual ~cmCryptoHash() {} static cmsys::auto_ptr New(const char* algo); - std::string HashString(const char* input); - std::string HashFile(const char* file); + std::string HashString(const std::string& input); + std::string HashFile(const std::string& file); protected: virtual void Initialize()=0; virtual void Append(unsigned char const*, int)=0; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7cc63bbdf..18eb62e21 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -944,7 +944,7 @@ bool cmSystemTools::RenameFile(const char* oldname, const char* newname) #endif } -bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out) +bool cmSystemTools::ComputeFileMD5(const std::string& source, char* md5out) { #if defined(CMAKE_BUILD_WITH_CMAKE) cmCryptoHashMD5 md5; @@ -959,7 +959,7 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out) #endif } -std::string cmSystemTools::ComputeStringMD5(const char* input) +std::string cmSystemTools::ComputeStringMD5(const std::string& input) { #if defined(CMAKE_BUILD_WITH_CMAKE) cmCryptoHashMD5 md5; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4a5d2981b..da37cebae 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -185,10 +185,10 @@ public: static bool RenameFile(const char* oldname, const char* newname); ///! Compute the md5sum of a file - static bool ComputeFileMD5(const char* source, char* md5out); + static bool ComputeFileMD5(const std::string& source, char* md5out); /** Compute the md5sum of a string. */ - static std::string ComputeStringMD5(const char* input); + static std::string ComputeStringMD5(const std::string& input); /** * Run a single executable command From 30bc251b65e9deb39c2cb8a785bd98c8d707d508 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:32:48 -0500 Subject: [PATCH 116/278] stringapi: Use strings for output names in AddCustomCommandToOutput --- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7215e766e..8b1f0baf5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1102,7 +1102,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output, //---------------------------------------------------------------------------- cmSourceFile* -cmMakefile::AddCustomCommandToOutput(const char* output, +cmMakefile::AddCustomCommandToOutput(const std::string& output, const std::vector& depends, const char* main_dependency, const cmCustomCommandLines& commandLines, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index aa25f0995..e165fd8df 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -183,7 +183,7 @@ public: bool replace = false, bool escapeOldStyle = true); cmSourceFile* AddCustomCommandToOutput( - const char* output, + const std::string& output, const std::vector& depends, const char* main_dependency, const cmCustomCommandLines& commandLines, From adcd812917fe37798a3062bfb3a0932e128faec2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:33:35 -0500 Subject: [PATCH 117/278] stringapi: Use strings for AddSubdirectory paths --- Source/cmGlobalGenerator.h | 2 +- Source/cmMakefile.cxx | 9 +++++---- Source/cmMakefile.h | 12 +++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 38d7f5893..4779682bc 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -287,7 +287,7 @@ public: std::string const& content); /** Return whether the given binary directory is unused. */ - bool BinaryDirectoryIsNew(const char* dir) + bool BinaryDirectoryIsNew(const std::string& dir) { return this->BinaryDirectories.insert(dir).second; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8b1f0baf5..1df64dd8f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1648,7 +1648,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } } -void cmMakefile::AddSubDirectory(const char* sub, +void cmMakefile::AddSubDirectory(const std::string& sub, bool excludeFromAll, bool preorder) { // the source path must be made full if it isn't already @@ -1675,7 +1675,8 @@ void cmMakefile::AddSubDirectory(const char* sub, } -void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, +void cmMakefile::AddSubDirectory(const std::string& srcPath, + const std::string& binPath, bool excludeFromAll, bool preorder, bool immediate) { @@ -4185,8 +4186,8 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, } //---------------------------------------------------------------------------- -bool cmMakefile::EnforceUniqueDir(const char* srcPath, - const char* binPath) const +bool cmMakefile::EnforceUniqueDir(const std::string& srcPath, + const std::string& binPath) const { // Make sure the binary directory is unique. cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e165fd8df..40193729b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -263,9 +263,10 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const char*, bool excludeFromAll=false, + void AddSubDirectory(const std::string&, bool excludeFromAll=false, bool preorder = false); - void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir, + void AddSubDirectory(const std::string& fullSrcDir, + const std::string& fullBinDir, bool excludeFromAll, bool preorder, bool immediate); @@ -430,7 +431,7 @@ public: * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const char* dir) + void SetStartDirectory(const std::string& dir) { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); @@ -443,7 +444,7 @@ public: { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const char* lib) + void SetStartOutputDirectory(const std::string& lib) { this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); @@ -949,7 +950,8 @@ private: bool ParseDefineFlag(std::string const& definition, bool remove); - bool EnforceUniqueDir(const char* srcPath, const char* binPath) const; + bool EnforceUniqueDir(const std::string& srcPath, + const std::string& binPath) const; friend class cmMakeDepend; // make depend needs direct access // to the Sources array From f3efa3cd160d9957437168627689720bb953bb2b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:34:39 -0500 Subject: [PATCH 118/278] stringapi: Use strings for cache paths as arguments --- Source/cmCacheManager.cxx | 12 ++++++------ Source/cmCacheManager.h | 12 ++++++------ Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 7a71482a1..141fde598 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -82,12 +82,12 @@ bool cmCacheManager::LoadCache(cmMakefile* mf) } -bool cmCacheManager::LoadCache(const char* path) +bool cmCacheManager::LoadCache(const std::string& path) { return this->LoadCache(path,true); } -bool cmCacheManager::LoadCache(const char* path, +bool cmCacheManager::LoadCache(const std::string& path, bool internal) { std::set emptySet; @@ -178,7 +178,7 @@ bool cmCacheManager::ParseEntry(const char* entry, return flag; } -void cmCacheManager::CleanCMakeFiles(const char* path) +void cmCacheManager::CleanCMakeFiles(const std::string& path) { std::string glob = path; glob += cmake::GetCMakeFilesDirectory(); @@ -193,7 +193,7 @@ void cmCacheManager::CleanCMakeFiles(const char* path) } } -bool cmCacheManager::LoadCache(const char* path, +bool cmCacheManager::LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes) @@ -428,7 +428,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf) } -bool cmCacheManager::SaveCache(const char* path) +bool cmCacheManager::SaveCache(const std::string& path) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; @@ -578,7 +578,7 @@ bool cmCacheManager::SaveCache(const char* path) return true; } -bool cmCacheManager::DeleteCache(const char* path) +bool cmCacheManager::DeleteCache(const std::string& path) { std::string cacheFile = path; cmSystemTools::ConvertToUnixSlashes(cacheFile); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 7a6139476..14cb1d9eb 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -108,19 +108,19 @@ public: ///! Load a cache for given makefile. Loads from ouput home. bool LoadCache(cmMakefile*); ///! Load a cache for given makefile. Loads from path/CMakeCache.txt. - bool LoadCache(const char* path); - bool LoadCache(const char* path, bool internal); - bool LoadCache(const char* path, bool internal, + bool LoadCache(const std::string& path); + bool LoadCache(const std::string& path, bool internal); + bool LoadCache(const std::string& path, bool internal, std::set& excludes, std::set& includes); ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. bool SaveCache(cmMakefile*) ; ///! Save cache for given makefile. Saves to ouput path/CMakeCache.txt - bool SaveCache(const char* path) ; + bool SaveCache(const std::string& path) ; ///! Delete the cache given - bool DeleteCache(const char* path); + bool DeleteCache(const std::string& path); ///! Print the cache to a stream void PrintCache(std::ostream&) const; @@ -159,7 +159,7 @@ protected: ///! Get a cache entry object for a key CacheEntry *GetCacheEntry(const std::string& key); ///! Clean out the CMakeFiles directory if no CMakeCache.txt - void CleanCMakeFiles(const char* path); + void CleanCMakeFiles(const std::string& path); // Cache version info unsigned int CacheMajorVersion; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1df64dd8f..e059dd37d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2956,7 +2956,7 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() this->Makefile->PopFunctionBlockerBarrier(this->ReportError); } -void cmMakefile::SetHomeDirectory(const char* dir) +void cmMakefile::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); @@ -2967,7 +2967,7 @@ void cmMakefile::SetHomeDirectory(const char* dir) } } -void cmMakefile::SetHomeOutputDirectory(const char* lib) +void cmMakefile::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 40193729b..4b9c54806 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -401,12 +401,12 @@ public: * CMakeLists files by recursing up the tree starting at the StartDirectory * and going up until it reaches the HomeDirectory. */ - void SetHomeDirectory(const char* dir); + void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const char* lib); + void SetHomeOutputDirectory(const std::string& lib); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); From dddbd2c7faf0a606200d5b03c549d348eceb87d7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:35:10 -0500 Subject: [PATCH 119/278] stringapi: Accept strings when setting command errors --- Source/cmCommand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmCommand.h b/Source/cmCommand.h index e1488571f..2378ef0f8 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -166,7 +166,7 @@ public: /** * Set the error message */ - void SetError(const char* e) + void SetError(const std::string& e) { this->Error = this->GetName(); this->Error += " "; From 38c7544578f4154dfaaa0a55b118b79b11ec6ae1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:35:30 -0500 Subject: [PATCH 120/278] stringapi: Use strings for documentation names --- Source/cmDocumentation.cxx | 4 ++-- Source/cmDocumentation.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 9c27fc111..96b5f0449 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -477,9 +477,9 @@ bool cmDocumentation::CheckOptions(int argc, const char* const* argv, } //---------------------------------------------------------------------------- -void cmDocumentation::SetName(const char* name) +void cmDocumentation::SetName(const std::string& name) { - this->NameString = name?name:""; + this->NameString = name; } //---------------------------------------------------------------------------- diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index d5a7dd5eb..56a4151bd 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -56,7 +56,7 @@ public: void SetShowGenerators(bool showGen) { this->ShowGenerators = showGen; } /** Set the program name for standard document generation. */ - void SetName(const char* name); + void SetName(const std::string& name); /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ From d76a6e08d06ef0fa6d52f67e88b0cfe4d96f24d1 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:37:02 -0500 Subject: [PATCH 121/278] stringapi: Use strings for generated file stream names --- Source/cmGeneratedFileStream.cxx | 7 +------ Source/cmGeneratedFileStream.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 34efc159b..78ad4b2e5 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -249,12 +249,7 @@ int cmGeneratedFileStreamBase::RenameFile(const char* oldname, } //---------------------------------------------------------------------------- -void cmGeneratedFileStream::SetName(const char* fname) +void cmGeneratedFileStream::SetName(const std::string& fname) { - if ( !fname ) - { - this->Name = ""; - return; - } this->Name = fname; } diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index 99f3b476d..7adee7b7d 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -140,7 +140,7 @@ public: * Set name of the file that will hold the actual output. This method allows * the output file to be changed during the use of cmGeneratedFileStream. */ - void SetName(const char* fname); + void SetName(const std::string& fname); private: cmGeneratedFileStream(cmGeneratedFileStream const&); // not implemented From c3833c7da40ccb03fc80bf10f37b77398d7123f8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:40:05 -0500 Subject: [PATCH 122/278] stringapi: Use strings for VS project names --- Source/cmGlobalGenerator.cxx | 11 ++++++----- Source/cmGlobalGenerator.h | 8 ++++---- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 6 +++--- Source/cmGlobalVisualStudio6Generator.h | 7 ++++--- Source/cmGlobalVisualStudio71Generator.cxx | 8 ++++---- Source/cmGlobalVisualStudio71Generator.h | 8 ++++---- Source/cmGlobalVisualStudio7Generator.cxx | 19 ++++++++++--------- Source/cmGlobalVisualStudio7Generator.h | 14 +++++++------- Source/cmGlobalVisualStudio8Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio8Generator.h | 5 +++-- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 5 ++--- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 2 +- 22 files changed, 60 insertions(+), 57 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 795048b7d..ae9c73173 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1007,7 +1007,7 @@ void cmGlobalGenerator::ClearEnabledLanguages() this->LanguageEnabled.clear(); } -bool cmGlobalGenerator::IsDependedOn(const char* project, +bool cmGlobalGenerator::IsDependedOn(const std::string& project, cmTarget const* targetIn) { // Get all local gens for this project @@ -1615,7 +1615,7 @@ void cmGlobalGenerator::CheckLocalGenerators() } int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& target, bool fast, std::string *output, cmMakefile *mf) { @@ -1663,8 +1663,9 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, } void cmGlobalGenerator::GenerateBuildCommand( - std::vector& makeCommand, const char*, const char*, const char*, - const std::string&, const char*, bool, std::vector const&) + std::vector& makeCommand, const char*, const std::string&, + const char*, const std::string&, const char*, bool, + std::vector const&) { makeCommand.push_back( "cmGlobalGenerator::GenerateBuildCommand not implemented"); @@ -1672,7 +1673,7 @@ void cmGlobalGenerator::GenerateBuildCommand( int cmGlobalGenerator::Build( const char *, const char *bindir, - const char *projectName, const std::string& target, + const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, const char *config, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4779682bc..ce285d686 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -106,7 +106,7 @@ public: * loaded commands, not as part of the usual build process. */ virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -118,7 +118,7 @@ public: * done first. */ int Build(const char *srcdir, const char *bindir, - const char *projectName, const std::string& targetName, + const std::string& projectName, const std::string& targetName, std::string *output, const char *makeProgram, const char *config, bool clean, bool fast, @@ -130,7 +130,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char *projectName, const char *projectDir, + const std::string& projectName, const char *projectDir, const std::string& targetName, const char* config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -223,7 +223,7 @@ public: /** If check to see if the target is linked to by any other target in the project */ - bool IsDependedOn(const char* project, cmTarget const* target); + bool IsDependedOn(const std::string& project, cmTarget const* target); ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index b0279956b..954fb1708 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -552,7 +552,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, - const char* /*projectName*/, + const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, const char* /*config*/, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 41d151026..e422e36a1 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -194,7 +194,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 74b8e987a..735887e08 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -566,7 +566,7 @@ cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, - const char* /*projectName*/, + const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, const char* /*config*/, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index f97ae9b82..ffdf6fb34 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -110,7 +110,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 1346e13ff..a2991e100 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -311,7 +311,7 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 198e113ca..97ac9bc01 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -35,7 +35,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 534a493e5..214b9eaa3 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -117,7 +117,7 @@ void cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, @@ -271,7 +271,7 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile() // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& target) { @@ -316,7 +316,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const std::set& dependencies) { diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 40b8462d5..f1c70e468 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -55,7 +55,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, @@ -99,9 +99,10 @@ private: void WriteDSWFile(std::ostream& fout); void WriteDSWHeader(std::ostream& fout); void WriteProject(std::ostream& fout, - const char* name, const char* path, cmTarget const& t); + const std::string& name, const char* path, + cmTarget const& t); void WriteExternalProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, const std::set& dependencies); void WriteDSWFooter(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget const* target); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 22e4f0894..af1a5c57b 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -155,7 +155,7 @@ cmGlobalVisualStudio71Generator // the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& t) { @@ -208,7 +208,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio71Generator ::WriteProjectDepends(std::ostream& fout, - const char*, + const std::string&, const char*, cmTarget const& target) { VSDependSet const& depends = this->VSTargetDepends[&target]; @@ -234,7 +234,7 @@ cmGlobalVisualStudio71Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const char* typeGuid, const std::set& depends) @@ -277,7 +277,7 @@ void cmGlobalVisualStudio71Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType, + std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 04e3a5547..879146812 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -59,17 +59,17 @@ protected: std::vector& generators); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual void WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* path, const char* typeGuid, const std::set& depends); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 5c7af0005..cf84fe396 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -184,7 +184,7 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, @@ -654,7 +654,7 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path) // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char* dir, cmTarget const& target) { // check to see if this is a fortran build @@ -694,7 +694,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio7Generator ::WriteProjectDepends(std::ostream& fout, - const char* dspname, + const std::string& dspname, const char*, cmTarget const& target) { int depcount = 0; @@ -730,7 +730,7 @@ cmGlobalVisualStudio7Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType, + std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { @@ -758,7 +758,7 @@ void cmGlobalVisualStudio7Generator // Note, that dependencies from executables to // the libraries it uses are also done here void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* location, const char* typeGuid, const std::set&) @@ -908,7 +908,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) return pname; } -std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) +std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -919,7 +919,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const char* name) return std::string(storedGUID); } cmSystemTools::Error("Unknown Target referenced : ", - name); + name.c_str()); return ""; } @@ -975,8 +975,9 @@ cmGlobalVisualStudio7Generator } std::set -cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project, - cmTarget const* target) +cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( + const std::string& project, + cmTarget const* target) { std::set activeConfigs; // if it is a utilitiy target then only make it part of the diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index a7aca6042..6fb373102 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -63,7 +63,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, @@ -90,7 +90,7 @@ public: ///! Create a GUID or get an existing one. void CreateGUID(const char* name); - std::string GetGUID(const char* name); + std::string GetGUID(const std::string& name); /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, @@ -123,13 +123,13 @@ protected: virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); virtual void WriteProject(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const& t); virtual void WriteProjectDepends(std::ostream& fout, - const char* name, const char* path, + const std::string& name, const char* path, cmTarget const&t); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual void WriteSLNGlobalSections(std::ostream& fout, @@ -153,7 +153,7 @@ protected: void GenerateConfigurations(cmMakefile* mf); virtual void WriteExternalProject(std::ostream& fout, - const char* name, + const std::string& name, const char* path, const char* typeGuid, const std::set& @@ -161,7 +161,7 @@ protected: std::string ConvertToSolutionPath(const char* path); - std::set IsPartOfDefaultBuild(const char* project, + std::set IsPartOfDefaultBuild(const std::string& project, cmTarget const* target); std::vector Configurations; std::map GUIDMap; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 0453333ef..1ba74eb82 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -372,7 +372,7 @@ cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping) { @@ -415,7 +415,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends() //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::WriteProjectDepends( - std::ostream& fout, const char*, const char*, cmTarget const& t) + std::ostream& fout, const std::string&, const char*, cmTarget const& t) { TargetDependSet const& unordered = this->GetTargetDirectDepends(t); OrderedTargetDependSet depends(unordered); diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 5b952c4f3..bafb9eb90 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -79,11 +79,12 @@ protected: virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations( - std::ostream& fout, const char* name, cmTarget::TargetType type, + std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, const char* platformMapping = NULL); virtual bool ComputeTargetDepends(); - virtual void WriteProjectDepends(std::ostream& fout, const char* name, + virtual void WriteProjectDepends(std::ostream& fout, + const std::string& name, const char* path, cmTarget const& t); std::string Name; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9e1e90221..a1255a065 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -261,7 +261,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, const char* config, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 0cb17585a..8e2de9a75 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -56,7 +56,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const char* projectName, + const std::string& projectName, const char* projectDir, const std::string& targetName, const char* config, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 786791cb7..280320ffb 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -228,7 +228,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator -::CreateSingleVCProj(const char *lname, cmTarget &target) +::CreateSingleVCProj(const std::string& lname, cmTarget &target) { this->FortranProject = static_cast(this->GlobalGenerator) @@ -245,8 +245,7 @@ void cmLocalVisualStudio7Generator } // add to the list of projects - std::string pname = lname; - target.SetProperty("GENERATOR_FILE_NAME",lname); + target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); // create the dsp.cmake file std::string fname; fname = this->Makefile->GetStartOutputDirectory(); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 4d727472d..760716e3a 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -66,7 +66,7 @@ public: const char* path); virtual void AddCMakeListsRules(); protected: - void CreateSingleVCProj(const char *lname, cmTarget &tgt); + void CreateSingleVCProj(const std::string& lname, cmTarget &tgt); private: typedef cmVisualStudioGeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e059dd37d..8584ad854 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3061,7 +3061,7 @@ void cmMakefile::ExpandSourceListArguments( } int cmMakefile::TryCompile(const char *srcdir, const char *bindir, - const char *projectName, + const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4b9c54806..6475c0f30 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -127,7 +127,7 @@ public: * loaded commands, not as part of the usual build process. */ int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const std::string& targetName, + const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, std::string *output); From 8455dd0a9a6c766870c7ddcb186e49a8a5db1416 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:45:11 -0500 Subject: [PATCH 123/278] stringapi: Use strings for search paths --- Source/cmMakeDepend.cxx | 2 +- Source/cmMakeDepend.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 615e6f2f1..03ad37c49 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -359,7 +359,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath) } // Add a directory to the search path -void cmMakeDepend::AddSearchPath(const char* path) +void cmMakeDepend::AddSearchPath(const std::string& path) { this->IncludeDirectories.push_back(path); } diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index b6e3928e9..2419ae9a8 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -94,7 +94,7 @@ public: /** * Add a directory to the search path for include files. */ - virtual void AddSearchPath(const char*); + virtual void AddSearchPath(const std::string&); /** * Generate dependencies for the file given. Returns a pointer to From 23e9b80f585db1cc68846a54e6e5844f970215ea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:46:27 -0500 Subject: [PATCH 124/278] stringapi: Use strings for globbing parameters --- Source/cmSystemTools.cxx | 12 ++++++------ Source/cmSystemTools.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 18eb62e21..9b35e61d3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -971,13 +971,14 @@ std::string cmSystemTools::ComputeStringMD5(const std::string& input) #endif } -void cmSystemTools::Glob(const char *directory, const char *regexp, +void cmSystemTools::Glob(const std::string& directory, + const std::string& regexp, std::vector& files) { cmsys::Directory d; - cmsys::RegularExpression reg(regexp); + cmsys::RegularExpression reg(regexp.c_str()); - if (d.Load(directory)) + if (d.Load(directory.c_str())) { size_t numf; unsigned int i; @@ -994,14 +995,13 @@ void cmSystemTools::Glob(const char *directory, const char *regexp, } -void cmSystemTools::GlobDirs(const char *fullPath, +void cmSystemTools::GlobDirs(const std::string& path, std::vector& files) { - std::string path = fullPath; std::string::size_type pos = path.find("/*"); if(pos == std::string::npos) { - files.push_back(fullPath); + files.push_back(path); return; } std::string startPath = path.substr(0, pos); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index da37cebae..51c103e2b 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -158,9 +158,10 @@ public: static std::string FileExistsInParentDirectories(const char* fname, const char* directory, const char* toplevel); - static void Glob(const char *directory, const char *regexp, + static void Glob(const std::string& directory, const std::string& regexp, std::vector& files); - static void GlobDirs(const char *fullPath, std::vector& files); + static void GlobDirs(const std::string& fullPath, + std::vector& files); /** * Try to find a list of files that match the "simple" globbing From 8d60da0cb56b44815f02ece01e224e1f4eba6c80 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 11:39:22 -0500 Subject: [PATCH 125/278] cmTarget: Remove the project argument to FindTarget All callers passed 0 in, so just remove the branch. --- Source/cmExportCommand.cxx | 2 +- Source/cmExportLibraryDependenciesCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 51 ++++++------------- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmMakefile.cxx | 5 +- Source/cmTargetLinkLibrariesCommand.cxx | 2 +- Source/cmTargetPropCommandBase.cxx | 2 +- 9 files changed, 25 insertions(+), 45 deletions(-) diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index db56aaf41..bda8ddadc 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -168,7 +168,7 @@ bool cmExportCommand return false; } - if(cmTarget* target = gg->FindTarget(0, currentTarget->c_str())) + if(cmTarget* target = gg->FindTarget(currentTarget->c_str())) { if(target->GetType() == cmTarget::OBJECT_LIBRARY) { diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 5d6f09470..469a661eb 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const break; } std::string lib = li->first; - if(cmTarget* libtgt = global->FindTarget(0, lib.c_str())) + if(cmTarget* libtgt = global->FindTarget(lib.c_str())) { // Handle simple output name changes. This command is // deprecated so we do not support full target name diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ae9c73173..ba4cce8eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2070,47 +2070,28 @@ bool cmGlobalGenerator::IsAlias(const std::string& name) const //---------------------------------------------------------------------------- cmTarget* -cmGlobalGenerator::FindTarget(const char* project, const std::string& name, +cmGlobalGenerator::FindTarget(const std::string& name, bool excludeAliases) const { - // if project specific - if(project) + if (!excludeAliases) { - std::map >::const_iterator - gens = this->ProjectMap.find(project); - for(unsigned int i = 0; i < gens->second.size(); ++i) + std::map::const_iterator ai + = this->AliasTargets.find(name); + if (ai != this->AliasTargets.end()) { - cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name, - excludeAliases); - if(ret) - { - return ret; - } + return ai->second; } } - // if all projects/directories - else + std::map::const_iterator i = + this->TotalTargets.find ( name ); + if ( i != this->TotalTargets.end() ) { - if (!excludeAliases) - { - std::map::const_iterator ai - = this->AliasTargets.find(name); - if (ai != this->AliasTargets.end()) - { - return ai->second; - } - } - std::map::const_iterator i = - this->TotalTargets.find ( name ); - if ( i != this->TotalTargets.end() ) - { - return i->second; - } - i = this->ImportedTargets.find(name); - if ( i != this->ImportedTargets.end() ) - { - return i->second; - } + return i->second; + } + i = this->ImportedTargets.find(name); + if ( i != this->ImportedTargets.end() ) + { + return i->second; } return 0; } @@ -2124,7 +2105,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const return true; } - if(cmTarget* tgt = this->FindTarget(0, libname.c_str())) + if(cmTarget* tgt = this->FindTarget(libname.c_str())) { if(tgt->IsFrameworkOnApple()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce285d686..746f715de 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -211,7 +211,7 @@ public: virtual void FindMakeProgram(cmMakefile*); ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const std::string& name, + cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; void AddAlias(const std::string& name, cmTarget *tgt); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1ba74eb82..51825ee83 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -440,7 +440,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( target.GetUtilities().begin(); ui != target.GetUtilities().end(); ++ui) { - if(cmTarget* depTarget = this->FindTarget(0, ui->c_str())) + if(cmTarget* depTarget = this->FindTarget(ui->c_str())) { if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 88206f1c0..a5ac629ea 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1099,7 +1099,7 @@ void cmLocalVisualStudio6Generator // Compute the proper name to use to link this library. std::string lib; std::string libDebug; - cmTarget* tgt = this->GlobalGenerator->FindTarget(0, j->first.c_str()); + cmTarget* tgt = this->GlobalGenerator->FindTarget(j->first.c_str()); if(tgt) { lib = cmSystemTools::GetFilenameWithoutExtension diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8584ad854..a94e39cf0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1471,7 +1471,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, if ( i != this->Targets.end()) { cmTarget* tgt = - this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0,lib); + this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(lib); if(tgt) { // if it is not a static or shared library then you can not link to it @@ -4068,8 +4068,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, - name.c_str(), + return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(), excludeAliases); } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 02da933ab..b16f31149 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand // Lookup the target for which libraries are specified. this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0].c_str()); if(!this->Target) { cmake::MessageType t = cmake::FATAL_ERROR; // fail by default diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 2a20516ac..1a1cfa064 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -34,7 +34,7 @@ bool cmTargetPropCommandBase } this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(0, args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0].c_str()); if(!this->Target) { this->Target = this->Makefile->FindTargetToUse(args[0]); From 466abd846fdbe17f4cff8a6008396eb1887b70c3 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 21:36:26 -0500 Subject: [PATCH 126/278] cmTargetLinkLibrariesCommand: Use a string argument --- Source/cmTargetLinkLibrariesCommand.cxx | 10 +++++----- Source/cmTargetLinkLibrariesCommand.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index b16f31149..8dc407b5a 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -272,7 +272,7 @@ bool cmTargetLinkLibrariesCommand { // The link type was specified by the previous argument. haveLLT = false; - if (!this->HandleLibrary(args[i].c_str(), llt)) + if (!this->HandleLibrary(args[i], llt)) { return false; } @@ -301,7 +301,7 @@ bool cmTargetLinkLibrariesCommand llt = cmTarget::OPTIMIZED; } } - if (!this->HandleLibrary(args[i].c_str(), llt)) + if (!this->HandleLibrary(args[i], llt)) { return false; } @@ -352,7 +352,7 @@ cmTargetLinkLibrariesCommand //---------------------------------------------------------------------------- bool -cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, +cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt) { if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY @@ -479,13 +479,13 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - this->Target->AppendProperty(prop.c_str(), lib); + this->Target->AppendProperty(prop.c_str(), lib.c_str()); } } if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) { // Put in the non-DEBUG configuration interfaces. - this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib); + this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib.c_str()); // Make sure the DEBUG configuration interfaces exist so that the // general one will not be used as a fall-back. diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 6fbf722fa..e2f374372 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -62,7 +62,7 @@ private: ProcessingState CurrentProcessingState; - bool HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt); + bool HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt); }; From 4c53997f3880785953e3ab6c811626b85ee67510 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 23:55:28 -0500 Subject: [PATCH 127/278] stringapi: Take strings for utility command names --- Source/cmMakefile.cxx | 4 ++-- Source/cmMakefile.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a94e39cf0..71985233d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1188,7 +1188,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, } //---------------------------------------------------------------------------- -void cmMakefile::AddUtilityCommand(const char* utilityName, +void cmMakefile::AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const std::vector& depends, const char* workingDirectory, @@ -1227,7 +1227,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, //---------------------------------------------------------------------------- cmTarget* -cmMakefile::AddUtilityCommand(const char* utilityName, +cmMakefile::AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const char* workingDirectory, const std::vector& depends, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6475c0f30..39635dda1 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -222,7 +222,7 @@ public: * Add a utility to the build. A utiltity target is a command that * is run every time the target is built. */ - void AddUtilityCommand(const char* utilityName, bool excludeFromAll, + void AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const std::vector& depends, const char* workingDirectory, const char* command, @@ -230,7 +230,8 @@ public: const char* arg2=0, const char* arg3=0, const char* arg4=0); - cmTarget* AddUtilityCommand(const char* utilityName, bool excludeFromAll, + cmTarget* AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, const char* workingDirectory, const std::vector& depends, const cmCustomCommandLines& commandLines, From 215b1addf09359507281359cd7d478c61c01a9f2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 00:29:59 -0500 Subject: [PATCH 128/278] stringapi: Take strings in escaping functions --- Source/cmLocalGenerator.cxx | 52 ++++++++++++------------ Source/cmLocalGenerator.h | 9 ++-- Source/cmLocalVisualStudio7Generator.cxx | 4 +- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmLocalXCodeGenerator.cxx | 2 +- Source/cmLocalXCodeGenerator.h | 3 +- Source/cmSystemTools.cxx | 7 ++-- Source/cmSystemTools.h | 2 +- 8 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ded4fc65e..75f2130a5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2358,7 +2358,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AppendFlagEscape(std::string& flags, - const char* rawFlag) + const std::string& rawFlag) { this->AppendFlags(flags, this->EscapeForShell(rawFlag).c_str()); } @@ -3187,7 +3187,7 @@ cmLocalGenerator } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) +std::string cmLocalGenerator::EscapeForShellOldStyle(const std::string& str) { std::string result; #if defined(_WIN32) && !defined(__CYGWIN__) @@ -3203,7 +3203,7 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) } return str; #else - for(const char* ch = str; *ch != '\0'; ++ch) + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) { if(*ch == ' ') { @@ -3216,28 +3216,30 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) } //---------------------------------------------------------------------------- -static bool cmLocalGeneratorIsShellOperator(const char* str) +static bool cmLocalGeneratorIsShellOperator(const std::string& str) { - if(strcmp(str, "<") == 0 || - strcmp(str, ">") == 0 || - strcmp(str, "<<") == 0 || - strcmp(str, ">>") == 0 || - strcmp(str, "|") == 0 || - strcmp(str, "||") == 0 || - strcmp(str, "&&") == 0 || - strcmp(str, "&>") == 0 || - strcmp(str, "1>") == 0 || - strcmp(str, "2>") == 0 || - strcmp(str, "2>&1") == 0 || - strcmp(str, "1>&2") == 0) + static std::set shellOperators; + if(shellOperators.empty()) { - return true; + shellOperators.insert("<"); + shellOperators.insert(">"); + shellOperators.insert("<<"); + shellOperators.insert(">>"); + shellOperators.insert("|"); + shellOperators.insert("||"); + shellOperators.insert("&&"); + shellOperators.insert("&>"); + shellOperators.insert("1>"); + shellOperators.insert("2>"); + shellOperators.insert("2>&1"); + shellOperators.insert("1>&2"); } - return false; + return shellOperators.count(str) > 0; } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, +std::string cmLocalGenerator::EscapeForShell(const std::string& str, + bool makeVars, bool forEcho) { // Do not escape shell operators. @@ -3279,28 +3281,28 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars, // Compute the buffer size needed. int size = (this->WindowsShell ? - cmsysSystem_Shell_GetArgumentSizeForWindows(str, flags) : - cmsysSystem_Shell_GetArgumentSizeForUnix(str, flags)); + cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) : + cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags)); // Compute the shell argument itself. std::vector arg(size); if(this->WindowsShell) { - cmsysSystem_Shell_GetArgumentForWindows(str, &arg[0], flags); + cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags); } else { - cmsysSystem_Shell_GetArgumentForUnix(str, &arg[0], flags); + cmsysSystem_Shell_GetArgumentForUnix(str.c_str(), &arg[0], flags); } return std::string(&arg[0]); } //---------------------------------------------------------------------------- -std::string cmLocalGenerator::EscapeForCMake(const char* str) +std::string cmLocalGenerator::EscapeForCMake(const std::string& str) { // Always double-quote the argument to take care of most escapes. std::string result = "\""; - for(const char* c = str; *c; ++c) + for(const char* c = str.c_str(); *c; ++c) { if(*c == '"') { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index c1deb0921..633be5d9b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -150,7 +150,8 @@ public: const char* config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); - virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void AppendFlagEscape(std::string& flags, + const std::string& rawFlag); ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector &includes, cmGeneratorTarget* target, @@ -285,14 +286,14 @@ public: system to replace make variable references. Optionally adjust escapes for the special case of passing to the native echo command. */ - std::string EscapeForShell(const char* str, bool makeVars = false, + std::string EscapeForShell(const std::string& str, bool makeVars = false, bool forEcho = false); /** Backwards-compatibility version of EscapeForShell. */ - std::string EscapeForShellOldStyle(const char* str); + std::string EscapeForShellOldStyle(const std::string& str); /** Escape the given string as an argument in a CMake script. */ - static std::string EscapeForCMake(const char* str); + static std::string EscapeForCMake(const std::string& str); enum FortranFormat { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 280320ffb..7b921a3d0 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2100,7 +2100,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout, << "\n"; } -std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s) +std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s) { std::string ret = s; cmSystemTools::ReplaceString(ret, "&", "&"); @@ -2111,7 +2111,7 @@ std::string cmLocalVisualStudio7GeneratorEscapeForXML(const char* s) return ret; } -std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s) +std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) { return cmLocalVisualStudio7GeneratorEscapeForXML(s); } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 760716e3a..2823a2cc3 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -84,7 +84,7 @@ private: void WriteConfiguration(std::ostream& fout, const char* configName, const std::string& libName, cmTarget &tgt); - std::string EscapeForXML(const char* s); + std::string EscapeForXML(const std::string& s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); void OutputTargetRules(std::ostream& fout, const char* configName, diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index a9a27b90c..fb8c2d15e 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -37,7 +37,7 @@ cmLocalXCodeGenerator::GetTargetDirectory(cmTarget const&) const //---------------------------------------------------------------------------- void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags, - const char* rawFlag) + const std::string& rawFlag) { cmGlobalXCodeGenerator* gg = static_cast(this->GlobalGenerator); diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index edd2f5ba2..3bfe3a30a 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -28,7 +28,8 @@ public: virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; - virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void AppendFlagEscape(std::string& flags, + const std::string& rawFlag); virtual void Generate(); virtual void GenerateInstallRules(); private: diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9b35e61d3..2b17fba73 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -179,10 +179,11 @@ void cmSystemTools::ExpandRegistryValues(std::string& source, KeyWOW64) } #endif -std::string cmSystemTools::EscapeQuotes(const char* str) +std::string cmSystemTools::EscapeQuotes(const std::string& str) { - std::string result = ""; - for(const char* ch = str; *ch != '\0'; ++ch) + std::string result; + result.reserve(str.size()); + for(const char* ch = str.c_str(); *ch != '\0'; ++ch) { if(*ch == '"') { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 51c103e2b..4a212c266 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -47,7 +47,7 @@ public: KeyWOW64 view = KeyWOW64_Default); ///! Escape quotes in a string. - static std::string EscapeQuotes(const char* str); + static std::string EscapeQuotes(const std::string& str); /** Map help document name to file name. */ static std::string HelpFileName(std::string); From 270eb96df05b93023cdd3d3a186b44b4ece1d655 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 10 Feb 2014 00:21:34 -0500 Subject: [PATCH 129/278] strings: Remove cmStdString references Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited. --- Source/CPack/cmCPackGeneratorFactory.h | 4 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBZR.cxx | 4 +- Source/CTest/cmCTestBuildAndTestHandler.h | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 12 +-- Source/CTest/cmCTestBuildHandler.h | 14 +-- Source/CTest/cmCTestCVS.cxx | 6 +- Source/CTest/cmCTestCVS.h | 4 +- Source/CTest/cmCTestCoverageCommand.h | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 24 ++--- Source/CTest/cmCTestCoverageHandler.h | 12 +-- Source/CTest/cmCTestGIT.cxx | 4 +- Source/CTest/cmCTestGenericHandler.h | 2 +- Source/CTest/cmCTestGlobalVC.cxx | 2 +- Source/CTest/cmCTestGlobalVC.h | 4 +- Source/CTest/cmCTestHG.cxx | 4 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestLaunch.h | 2 +- Source/CTest/cmCTestMemCheckHandler.cxx | 34 +++---- Source/CTest/cmCTestMemCheckHandler.h | 10 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/CTest/cmCTestMultiProcessHandler.h | 10 +- Source/CTest/cmCTestP4.cxx | 8 +- Source/CTest/cmCTestSVN.cxx | 8 +- Source/CTest/cmCTestScriptHandler.cxx | 4 +- Source/CTest/cmCTestScriptHandler.h | 28 +++--- Source/CTest/cmCTestSubmitCommand.cxx | 6 +- Source/CTest/cmCTestSubmitHandler.cxx | 98 +++++++++---------- Source/CTest/cmCTestSubmitHandler.h | 54 +++++----- Source/CTest/cmCTestTestHandler.cxx | 30 +++--- Source/CTest/cmCTestTestHandler.h | 18 ++-- Source/CTest/cmCTestUploadCommand.cxx | 2 +- Source/CTest/cmCTestVC.cxx | 4 +- Source/CTest/cmParseGTMCoverage.cxx | 2 +- Source/CTest/cmParseMumpsCoverage.cxx | 2 +- Source/CTest/cmParseMumpsCoverage.h | 2 +- Source/CTest/cmParsePHPCoverage.cxx | 4 +- Source/CTest/cmParsePHPCoverage.h | 2 +- Source/CursesDialog/cmCursesPathWidget.cxx | 2 +- Source/cmCTest.cxx | 22 ++--- Source/cmCTest.h | 20 ++-- Source/cmCacheManager.cxx | 10 +- Source/cmCacheManager.h | 8 +- Source/cmCommandArgumentParserHelper.h | 4 +- Source/cmComputeLinkDepends.cxx | 10 +- Source/cmComputeLinkDepends.h | 4 +- Source/cmComputeLinkInformation.cxx | 8 +- Source/cmComputeLinkInformation.h | 10 +- Source/cmComputeTargetDepends.cxx | 16 +-- Source/cmComputeTargetDepends.h | 4 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmCustomCommand.h | 2 +- Source/cmDefinitions.cxx | 20 ++-- Source/cmDefinitions.h | 23 +++-- Source/cmDependsC.cxx | 16 +-- Source/cmDependsC.h | 16 +-- Source/cmDependsFortran.cxx | 40 ++++---- Source/cmDependsJavaParserHelper.cxx | 24 ++--- Source/cmDependsJavaParserHelper.h | 20 ++-- Source/cmDynamicLoader.cxx | 8 +- Source/cmExportFileGenerator.h | 2 +- Source/cmExportInstallFileGenerator.h | 4 +- Source/cmExportLibraryDependenciesCommand.cxx | 12 +-- Source/cmExprParserHelper.h | 4 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraCodeLiteGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmFileTimeComparison.cxx | 4 +- Source/cmFindBase.h | 6 +- Source/cmFindCommon.h | 4 +- Source/cmFindLibraryCommand.cxx | 4 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindPackageCommand.h | 12 +-- Source/cmFindPathCommand.cxx | 10 +- Source/cmGeneratorExpression.cxx | 2 +- Source/cmGeneratorExpression.h | 4 +- Source/cmGeneratorExpressionDAGChecker.cxx | 6 +- Source/cmGeneratorExpressionDAGChecker.h | 2 +- Source/cmGeneratorExpressionEvaluator.h | 2 +- Source/cmGeneratorTarget.cxx | 8 +- Source/cmGetCMakePropertyCommand.cxx | 4 +- Source/cmGlobalGenerator.cxx | 38 +++---- Source/cmGlobalGenerator.h | 46 ++++----- Source/cmGlobalKdevelopGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 12 +-- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 6 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio71Generator.cxx | 4 +- Source/cmGlobalVisualStudio71Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 4 +- Source/cmGlobalVisualStudio7Generator.h | 4 +- Source/cmGlobalVisualStudio8Generator.cxx | 4 +- Source/cmGlobalVisualStudioGenerator.cxx | 8 +- Source/cmGlobalVisualStudioGenerator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 82 ++++++++-------- Source/cmGlobalXCodeGenerator.h | 16 +-- Source/cmGraphVizWriter.cxx | 24 ++--- Source/cmGraphVizWriter.h | 12 +-- Source/cmIDEOptions.cxx | 4 +- Source/cmIDEOptions.h | 4 +- Source/cmIncludeDirectoryCommand.cxx | 2 +- Source/cmInstallCommand.cxx | 2 +- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 4 +- Source/cmLoadCacheCommand.cxx | 4 +- Source/cmLoadCacheCommand.h | 2 +- Source/cmLocalGenerator.cxx | 20 ++-- Source/cmLocalGenerator.h | 6 +- Source/cmLocalUnixMakefileGenerator3.cxx | 16 +-- Source/cmLocalUnixMakefileGenerator3.h | 18 ++-- Source/cmLocalVisualStudio6Generator.cxx | 6 +- Source/cmLocalVisualStudio7Generator.cxx | 6 +- Source/cmMakeDepend.h | 6 +- Source/cmMakefile.cxx | 46 ++++----- Source/cmMakefile.h | 18 ++-- Source/cmMakefileTargetGenerator.cxx | 12 +-- Source/cmMakefileTargetGenerator.h | 12 +-- Source/cmNinjaNormalTargetGenerator.cxx | 4 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.h | 4 +- Source/cmOrderDirectories.cxx | 20 ++-- Source/cmOrderDirectories.h | 10 +- Source/cmPropertyDefinitionMap.cxx | 6 +- Source/cmPropertyDefinitionMap.h | 8 +- Source/cmPropertyMap.h | 2 +- Source/cmQtAutoGenerators.cxx | 14 +-- Source/cmRST.cxx | 4 +- Source/cmRST.h | 4 +- Source/cmSetPropertyCommand.cxx | 12 +-- Source/cmSetPropertyCommand.h | 2 +- Source/cmSourceGroup.cxx | 2 +- Source/cmSourceGroup.h | 2 +- Source/cmStandardIncludes.h | 4 +- Source/cmSystemTools.cxx | 50 ++-------- Source/cmSystemTools.h | 17 +--- Source/cmTarget.cxx | 80 +++++++-------- Source/cmTarget.h | 24 ++--- Source/cmTest.h | 2 +- Source/cmVariableWatch.h | 2 +- Source/cmVisualStudio10TargetGenerator.h | 4 +- Source/cmVisualStudioGeneratorOptions.cxx | 4 +- Source/cmXCodeObject.cxx | 6 +- Source/cmXCodeObject.h | 20 ++-- Source/cmake.cxx | 2 +- Source/cmake.h | 8 +- Source/cmcldeps.cxx | 2 +- Source/cmcmd.cxx | 18 ++-- Source/cmcmd.h | 4 +- Tests/CMakeLib/run_compile_commands.cxx | 8 +- 152 files changed, 805 insertions(+), 841 deletions(-) diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index e6f74f9e8..010777f25 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -42,7 +42,7 @@ public: void SetLogger(cmCPackLog* logger) { this->Logger = logger; } - typedef std::map DescriptionsMap; + typedef std::map DescriptionsMap; const DescriptionsMap& GetGeneratorsList() const { return this->GeneratorDescriptions; } @@ -50,7 +50,7 @@ private: cmCPackGenerator* NewGeneratorInternal(const std::string& name); std::vector Generators; - typedef std::map t_GeneratorCreatorsMap; + typedef std::map t_GeneratorCreatorsMap; t_GeneratorCreatorsMap GeneratorCreators; DescriptionsMap GeneratorDescriptions; cmCPackLog* Logger; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a19b778ac..d74c38d04 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -68,7 +68,7 @@ int cpackUnknownArgument(const char*, void*) //---------------------------------------------------------------------------- struct cpackDefinitions { - typedef std::map MapType; + typedef std::map MapType; MapType Map; cmCPackLog *Log; }; diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 381c70ce5..840ebc93f 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -409,7 +409,7 @@ bool cmCTestBZR::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("BZRUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // TODO: if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -418,7 +418,7 @@ bool cmCTestBZR::UpdateImpl() bzr_update.push_back(this->CommandLineTool.c_str()); bzr_update.push_back("pull"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { bzr_update.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index ca50c6452..d1e9a4d19 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -54,7 +54,7 @@ protected: std::string &cmakeOutString, std::string &cwd, cmake *cm); - cmStdString Output; + std::string Output; std::string BuildGenerator; std::string BuildGeneratorToolset; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index c5deb964a..291c70a6f 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -380,7 +380,7 @@ int cmCTestBuildHandler::ProcessHandler() // Create lists of regular expression strings for errors, error exceptions, // warnings and warning exceptions. - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cmCTestErrorMatches[cc]; cc ++ ) { this->CustomErrorMatches.push_back(cmCTestErrorMatches[cc]); @@ -400,7 +400,7 @@ int cmCTestBuildHandler::ProcessHandler() } // Pre-compile regular expressions objects for all regular expressions - std::vector::iterator it; + std::vector::iterator it; #define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \ regexes.clear(); \ @@ -602,7 +602,7 @@ void cmCTestBuildHandler::GenerateXMLLaunched(std::ostream& os) // Sort XML fragments in chronological order. cmFileTimeComparison ftc; FragmentCompare fragmentCompare(&ftc); - typedef std::set Fragments; + typedef std::set Fragments; Fragments fragments(fragmentCompare); // Identify fragments on disk. @@ -889,7 +889,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, const char* dir, int timeout, std::ostream& ofs) { // First generate the command and arguments - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -897,7 +897,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); @@ -1133,7 +1133,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length, errorwarning.PostContext = ""; // Copy pre-context to report - std::deque::iterator pcit; + std::deque::iterator pcit; for ( pcit = this->PreContext.begin(); pcit != this->PreContext.end(); ++pcit ) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index ff7cfd680..09346f949 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -97,10 +97,10 @@ private: double StartBuildTime; double EndBuildTime; - std::vector CustomErrorMatches; - std::vector CustomErrorExceptions; - std::vector CustomWarningMatches; - std::vector CustomWarningExceptions; + std::vector CustomErrorMatches; + std::vector CustomErrorExceptions; + std::vector CustomWarningMatches; + std::vector CustomWarningExceptions; std::vector ReallyCustomWarningMatches; std::vector ReallyCustomWarningExceptions; std::vector ErrorWarningFileLineRegex; @@ -121,8 +121,8 @@ private: size_t BuildOutputLogSize; std::vector CurrentProcessingLine; - cmStdString SimplifySourceDir; - cmStdString SimplifyBuildDir; + std::string SimplifySourceDir; + std::string SimplifyBuildDir; size_t OutputLineCounter; typedef std::vector t_ErrorsAndWarningsVector; t_ErrorsAndWarningsVector ErrorsAndWarnings; @@ -130,7 +130,7 @@ private: size_t PostContextCount; size_t MaxPreContext; size_t MaxPostContext; - std::deque PreContext; + std::deque PreContext; int TotalErrors; int TotalWarnings; diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 17dbb5556..ab363d016 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -99,7 +99,7 @@ bool cmCTestCVS::UpdateImpl() opts = "-dP"; } } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // Specify the start time for nightly testing. if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -112,7 +112,7 @@ bool cmCTestCVS::UpdateImpl() cvs_update.push_back(this->CommandLineTool.c_str()); cvs_update.push_back("-z3"); cvs_update.push_back("update"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { cvs_update.push_back(ai->c_str()); @@ -308,7 +308,7 @@ bool cmCTestCVS::WriteXMLUpdates(std::ostream& xml) " Gathering version information (one . per updated file):\n" " " << std::flush); - for(std::map::const_iterator + for(std::map::const_iterator di = this->Dirs.begin(); di != this->Dirs.end(); ++di) { this->WriteXMLDirectory(xml, di->first, di->second); diff --git a/Source/CTest/cmCTestCVS.h b/Source/CTest/cmCTestCVS.h index b7fe567d8..64e1747d1 100644 --- a/Source/CTest/cmCTestCVS.h +++ b/Source/CTest/cmCTestCVS.h @@ -32,8 +32,8 @@ private: virtual bool WriteXMLUpdates(std::ostream& xml); // Update status for files in each directory. - class Directory: public std::map {}; - std::map Dirs; + class Directory: public std::map {}; + std::map Dirs; std::string ComputeBranchFlag(std::string const& dir); void LoadRevisions(std::string const& file, const char* branchFlag, diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 11bb4112d..37315922c 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -56,7 +56,7 @@ protected: }; bool LabelsMentioned; - std::set Labels; + std::set Labels; }; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 0503d941a..2e35b7575 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -363,7 +363,7 @@ int cmCTestCoverageHandler::ProcessHandler() // setup the regex exclude stuff this->CustomCoverageExcludeRegex.clear(); - std::vector::iterator rexIt; + std::vector::iterator rexIt; for ( rexIt = this->CustomCoverageExclude.begin(); rexIt != this->CustomCoverageExclude.end(); ++ rexIt ) @@ -713,7 +713,7 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) this->CustomCoverageExclude); this->CTest->PopulateCustomVector(mf, "CTEST_EXTRA_COVERAGE_GLOB", this->ExtraCoverageGlobs); - std::vector::iterator it; + std::vector::iterator it; for ( it = this->CustomCoverageExclude.begin(); it != this->CustomCoverageExclude.end(); ++ it ) @@ -989,8 +989,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( << "--------------------------------------------------------------" << std::endl); - std::vector lines; - std::vector::iterator line; + std::vector lines; + std::vector::iterator line; cmSystemTools::Split(output.c_str(), lines); @@ -1504,7 +1504,7 @@ namespace //---------------------------------------------------------------------- int cmCTestCoverageHandler::RunBullseyeCoverageBranch( cmCTestCoverageHandlerContainer* cont, - std::set& coveredFileNames, + std::set& coveredFileNames, std::vector& files, std::vector& filesFullPath) { @@ -1545,7 +1545,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( outputFile.c_str() << std::endl); return 0; } - std::map fileMap; + std::map fileMap; std::vector::iterator fp = filesFullPath.begin(); for(std::vector::iterator f = files.begin(); f != files.end(); ++f, ++fp) @@ -1558,7 +1558,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( std::string lineIn; bool valid = false; // are we in a valid output file int line = 0; // line of the current file - cmStdString file; + std::string file; while(cmSystemTools::GetLineFromStream(fin, lineIn)) { bool startFile = false; @@ -1593,7 +1593,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( } count++; // move on one } - std::map::iterator + std::map::iterator i = fileMap.find(file); // if the file should be covered write out the header for that file if(i != fileMap.end()) @@ -1758,7 +1758,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( outputFile.c_str() << std::endl); return 0; } - std::set coveredFileNames; + std::set coveredFileNames; while(cmSystemTools::GetLineFromStream(fin, stdline)) { // if we have a line of output from stdout @@ -2105,10 +2105,10 @@ void cmCTestCoverageHandler::WriteXMLLabels(std::ostream& os, //---------------------------------------------------------------------------- void -cmCTestCoverageHandler::SetLabelFilter(std::set const& labels) +cmCTestCoverageHandler::SetLabelFilter(std::set const& labels) { this->LabelFilter.clear(); - for(std::set::const_iterator li = labels.begin(); + for(std::set::const_iterator li = labels.begin(); li != labels.end(); ++li) { this->LabelFilter.insert(this->GetLabelId(*li)); @@ -2158,7 +2158,7 @@ std::set cmCTestCoverageHandler::FindUncoveredFiles( { std::set extraMatches; - for(std::vector::iterator i = this->ExtraCoverageGlobs.begin(); + for(std::vector::iterator i = this->ExtraCoverageGlobs.begin(); i != this->ExtraCoverageGlobs.end(); ++i) { cmsys::Glob gl; diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 660f501b2..6a8f55def 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -55,7 +55,7 @@ public: void PopulateCustomVectors(cmMakefile *mf); /** Report coverage only for sources with these labels. */ - void SetLabelFilter(std::set const& labels); + void SetLabelFilter(std::set const& labels); private: bool ShouldIDoCoverage(const char* file, const char* srcDir, @@ -81,7 +81,7 @@ private: int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont); int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont); int RunBullseyeCoverageBranch(cmCTestCoverageHandlerContainer* cont, - std::set& coveredFileNames, + std::set& coveredFileNames, std::vector& files, std::vector& filesFullPath); @@ -112,19 +112,19 @@ private: std::set FindUncoveredFiles( cmCTestCoverageHandlerContainer* cont); - std::vector CustomCoverageExclude; + std::vector CustomCoverageExclude; std::vector CustomCoverageExcludeRegex; - std::vector ExtraCoverageGlobs; + std::vector ExtraCoverageGlobs; // Map from source file to label ids. class LabelSet: public std::set {}; - typedef std::map LabelMapType; + typedef std::map LabelMapType; LabelMapType SourceLabels; LabelMapType TargetDirs; // Map from label name to label id. - typedef std::map LabelIdMapType; + typedef std::map LabelIdMapType; LabelIdMapType LabelIdMap; std::vector Labels; int GetLabelId(std::string const& label); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 0e0e797b5..aaa01b2d0 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -179,8 +179,8 @@ bool cmCTestGIT::UpdateByFetchAndReset() { opts = this->CTest->GetCTestConfiguration("GITUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { git_fetch.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index d05e23023..2788cba57 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -71,7 +71,7 @@ public: cmCTestGenericHandler(); virtual ~cmCTestGenericHandler(); - typedef std::map t_StringToString; + typedef std::map t_StringToString; void SetPersistentOption(const std::string& op, const char* value); diff --git a/Source/CTest/cmCTestGlobalVC.cxx b/Source/CTest/cmCTestGlobalVC.cxx index 8c51102e5..5f570b5d3 100644 --- a/Source/CTest/cmCTestGlobalVC.cxx +++ b/Source/CTest/cmCTestGlobalVC.cxx @@ -132,7 +132,7 @@ bool cmCTestGlobalVC::WriteXMLUpdates(std::ostream& xml) this->WriteXMLGlobal(xml); - for(std::map::const_iterator + for(std::map::const_iterator di = this->Dirs.begin(); di != this->Dirs.end(); ++di) { this->WriteXMLDirectory(xml, di->first, di->second); diff --git a/Source/CTest/cmCTestGlobalVC.h b/Source/CTest/cmCTestGlobalVC.h index a648a5982..cb0d16560 100644 --- a/Source/CTest/cmCTestGlobalVC.h +++ b/Source/CTest/cmCTestGlobalVC.h @@ -39,8 +39,8 @@ protected: }; // Update status for files in each directory. - class Directory: public std::map {}; - std::map Dirs; + class Directory: public std::map {}; + std::map Dirs; // Old and new repository revisions. std::string OldRevision; diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 86a7617f1..5bf994989 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -149,8 +149,8 @@ bool cmCTestHG::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("HGUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { hg_update.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index cd3bd5746..c9f9e9e50 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -567,7 +567,7 @@ void cmCTestLaunch::WriteXMLLabels(std::ostream& fxml) fxml << "\n"; fxml << "\t\t\n"; fxml << "\t\t\n"; - for(std::set::const_iterator li = this->Labels.begin(); + for(std::set::const_iterator li = this->Labels.begin(); li != this->Labels.end(); ++li) { fxml << "\t\t\t\n"; diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index f680d19d9..bc90d28cf 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -73,7 +73,7 @@ private: bool HaveErr; // Labels associated with the build rule. - std::set Labels; + std::set Labels; void LoadLabels(); bool SourceMatches(std::string const& lhs, std::string const& rhs); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index fdce04d39..f2982a4f2 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -246,8 +246,8 @@ int cmCTestMemCheckHandler::PostProcessHandler() void cmCTestMemCheckHandler::GenerateTestCommand( std::vector& args, int test) { - std::vector::size_type pp; - cmStdString index; + std::vector::size_type pp; + std::string index; cmOStringStream stream; std::string memcheckcommand = cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str()); @@ -255,9 +255,9 @@ void cmCTestMemCheckHandler::GenerateTestCommand( index = stream.str(); for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ ) { - cmStdString arg = this->MemoryTesterDynamicOptions[pp]; - cmStdString::size_type pos = arg.find("??"); - if (pos != cmStdString::npos) + std::string arg = this->MemoryTesterDynamicOptions[pp]; + std::string::size_type pos = arg.find("??"); + if (pos != std::string::npos) { arg.replace(pos, 2, index); } @@ -580,7 +580,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) { this->MemoryTesterGlobalResults[cc] = 0; @@ -627,7 +627,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( const std::string& str, std::string& log, int* results) { - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); cmOStringStream ostr; log = ""; @@ -636,7 +636,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( int defects = 0; - for( std::vector::iterator i = lines.begin(); + for( std::vector::iterator i = lines.begin(); i != lines.end(); ++i) { int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT; @@ -681,7 +681,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( const std::string& str, std::string& log, int* results) { - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); bool unlimitedOutput = false; if(str.find("CTEST_FULL_OUTPUT") != str.npos || @@ -864,10 +864,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( { log = ""; double sttime = cmSystemTools::GetTime(); - std::vector lines; + std::vector lines; cmSystemTools::Split(str.c_str(), lines); cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl); - std::vector::size_type cc; + std::vector::size_type cc; for ( cc = 0; cc < lines.size(); cc ++ ) { if(lines[cc] == BOUNDS_CHECKER_MARKER) @@ -923,7 +923,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " << res.Name.c_str() << std::endl); - cmStdString ofile = testOutputFileName(test); + std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { return; @@ -979,7 +979,7 @@ void cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, int test) { - cmStdString ofile = testOutputFileName(test); + std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { @@ -1000,15 +1000,15 @@ cmCTestMemCheckHandler::appendMemTesterOutput(cmCTestTestResult& res, } } -cmStdString +std::string cmCTestMemCheckHandler::testOutputFileName(int test) { - cmStdString index; + std::string index; cmOStringStream stream; stream << test; index = stream.str(); - cmStdString ofile = this->MemoryTesterOutputFile; - cmStdString::size_type pos = ofile.find("??"); + std::string ofile = this->MemoryTesterOutputFile; + std::string::size_type pos = ofile.find("??"); ofile.replace(pos, 2, index); if ( !cmSystemTools::FileExists(ofile.c_str()) ) diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 040d2e092..0521a4841 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -89,8 +89,8 @@ private: std::string BoundsCheckerDPBDFile; std::string BoundsCheckerXMLFile; std::string MemoryTester; - std::vector MemoryTesterDynamicOptions; - std::vector MemoryTesterOptions; + std::vector MemoryTesterDynamicOptions; + std::vector MemoryTesterOptions; int MemoryTesterStyle; std::string MemoryTesterOutputFile; int MemoryTesterGlobalResults[NO_MEMORY_FAULT]; @@ -103,8 +103,8 @@ private: */ void GenerateDartOutput(std::ostream& os); - std::vector CustomPreMemCheck; - std::vector CustomPostMemCheck; + std::vector CustomPreMemCheck; + std::vector CustomPostMemCheck; //! Parse Valgrind/Purify/Bounds Checker result out of the output //string. After running, log holds the output and results hold the @@ -127,7 +127,7 @@ private: int test); ///! generate the output filename for the given test index - cmStdString testOutputFileName(int test); + std::string testOutputFileName(int test); }; #endif diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index ddd1707bc..c979be3f3 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -369,7 +369,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() // Write list of failed tests fout << "---\n"; - for(std::vector::iterator i = this->Failed->begin(); + for(std::vector::iterator i = this->Failed->begin(); i != this->Failed->end(); ++i) { fout << i->c_str() << "\n"; diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 1b53ec7c2..605de3134 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -41,8 +41,8 @@ public: void PrintTestList(); void PrintLabels(); - void SetPassFailVectors(std::vector* passed, - std::vector* failed) + void SetPassFailVectors(std::vector* passed, + std::vector* failed) { this->Passed = passed; this->Failed = failed; @@ -107,9 +107,9 @@ protected: PropertiesMap Properties; std::map TestRunningMap; std::map TestFinishMap; - std::map TestOutput; - std::vector* Passed; - std::vector* Failed; + std::map TestOutput; + std::vector* Passed; + std::vector* Failed; std::vector LastTestsFailed; std::set LockedResources; std::vector* TestResults; diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index b09d6f5a3..1ad94bc40 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -346,10 +346,10 @@ void cmCTestP4::SetP4Options(std::vector &CommandOptions) //The CTEST_P4_OPTIONS variable adds additional Perforce command line //options before the main command std::string opts = this->CTest->GetCTestConfiguration("P4Options"); - std::vector args = + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { P4Options.push_back(ai->c_str()); @@ -538,8 +538,8 @@ bool cmCTestP4::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("P4UpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); - for(std::vector::const_iterator ai = args.begin(); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { p4_sync.push_back(ai->c_str()); diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 2668c8eef..89592dd8e 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -277,7 +277,7 @@ bool cmCTestSVN::UpdateImpl() { opts = this->CTest->GetCTestConfiguration("SVNUpdateOptions"); } - std::vector args = cmSystemTools::ParseArguments(opts.c_str()); + std::vector args = cmSystemTools::ParseArguments(opts.c_str()); // Specify the start time for nightly testing. if(this->CTest->GetTestModel() == cmCTest::NIGHTLY) @@ -287,7 +287,7 @@ bool cmCTestSVN::UpdateImpl() std::vector svn_update; svn_update.push_back("update"); - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { svn_update.push_back(ai->c_str()); @@ -314,9 +314,9 @@ bool cmCTestSVN::RunSVNCommand(std::vector const& parameters, std::string userOptions = this->CTest->GetCTestConfiguration("SVNOptions"); - std::vector parsedUserOptions = + std::vector parsedUserOptions = cmSystemTools::ParseArguments(userOptions.c_str()); - for(std::vector::iterator i = parsedUserOptions.begin(); + for(std::vector::iterator i = parsedUserOptions.begin(); i != parsedUserOptions.end(); ++i) { args.push_back(i->c_str()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 00a0a097c..7f13855b7 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -231,7 +231,7 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) cmSystemTools::GetCTestCommand() << "\n"); // now pass through all the other arguments - std::vector &initArgs = + std::vector &initArgs = this->CTest->GetInitialCommandLineArguments(); //*** need to make sure this does not have the current script *** for(size_t i=1; i < initArgs.size(); ++i) @@ -766,7 +766,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() // do an initial cvs update as required command = this->UpdateCmd; - std::vector::iterator it; + std::vector::iterator it; for (it = this->ExtraUpdates.begin(); it != this->ExtraUpdates.end(); ++ it ) diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 44e9dd0f5..42c2f209b 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -138,26 +138,26 @@ private: // Try to remove the binary directory once static bool TryToRemoveBinaryDirectoryOnce(const std::string& directoryPath); - std::vector ConfigurationScripts; + std::vector ConfigurationScripts; std::vector ScriptProcessScope; bool Backup; bool EmptyBinDir; bool EmptyBinDirOnce; - cmStdString SourceDir; - cmStdString BinaryDir; - cmStdString BackupSourceDir; - cmStdString BackupBinaryDir; - cmStdString CTestRoot; - cmStdString CVSCheckOut; - cmStdString CTestCmd; - cmStdString UpdateCmd; - cmStdString CTestEnv; - cmStdString InitialCache; - cmStdString CMakeCmd; - cmStdString CMOutFile; - std::vector ExtraUpdates; + std::string SourceDir; + std::string BinaryDir; + std::string BackupSourceDir; + std::string BackupBinaryDir; + std::string CTestRoot; + std::string CVSCheckOut; + std::string CTestCmd; + std::string UpdateCmd; + std::string CTestEnv; + std::string InitialCache; + std::string CMakeCmd; + std::string CMOutFile; + std::vector ExtraUpdates; double MinimumInterval; double ContinuousDuration; diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 24974e3bc..07a994de6 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -72,7 +72,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() if (notesFilesVariable) { std::vector notesFiles; - std::vector newNotesFiles; + cmCTest::VectorOfStrings newNotesFiles; cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles); std::vector::iterator it; for ( it = notesFiles.begin(); @@ -89,7 +89,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() if (extraFilesVariable) { std::vector extraFiles; - std::vector newExtraFiles; + cmCTest::VectorOfStrings newExtraFiles; cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles); std::vector::iterator it; for ( it = extraFiles.begin(); @@ -222,7 +222,7 @@ bool cmCTestSubmitCommand::CheckArgumentValue(std::string const& arg) if(this->ArgumentDoing == ArgumentDoingFiles) { - cmStdString filename(arg); + std::string filename(arg); if(cmSystemTools::FileExists(filename.c_str())) { this->Files.insert(filename); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 139f515af..1cd8fc76f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -170,10 +170,10 @@ void cmCTestSubmitHandler::Initialize() } //---------------------------------------------------------------------------- -bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; CURLcode res; @@ -217,12 +217,12 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, ::curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; } - cmStdString upload_as + std::string upload_as = url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file); struct stat st; @@ -324,10 +324,10 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, //---------------------------------------------------------------------------- // Uploading files is simpler -bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; CURLcode res; @@ -336,8 +336,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, /* In windows, this will init the winsock stuff */ ::curl_global_init(CURL_GLOBAL_ALL); - cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); - cmStdString curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); + std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); + std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector args; cmSystemTools::ExpandListArgument(curlopt.c_str(), args); bool verifyPeerOff = false; @@ -354,7 +354,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, verifyHostOff = true; } } - cmStdString::size_type kk; + std::string::size_type kk; cmCTest::SetOfStrings::const_iterator file; for ( file = files.begin(); file != files.end(); ++file ) { @@ -414,18 +414,18 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, ::curl_easy_setopt(curl, CURLOPT_PUT, 1); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; } - cmStdString remote_file + std::string remote_file = remoteprefix + cmSystemTools::GetFilenameName(*file); *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " << remote_file.c_str() << std::endl; - cmStdString ofile = ""; + std::string ofile = ""; for ( kk = 0; kk < remote_file.size(); kk ++ ) { char c = remote_file[kk]; @@ -448,8 +448,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const cmStdString& localprefix, ofile.append(hexCh); } } - cmStdString upload_as - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + std::string upload_as + = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "FileName=" + ofile; upload_as += "&MD5="; @@ -666,9 +666,9 @@ void cmCTestSubmitHandler //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::TriggerUsingHTTP( - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { CURL *curl; char error_buffer[1024]; @@ -721,10 +721,10 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk); ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug); - cmStdString rfile + std::string rfile = remoteprefix + cmSystemTools::GetFilenameName(*file); - cmStdString ofile = ""; - cmStdString::iterator kk; + std::string ofile = ""; + std::string::iterator kk; for ( kk = rfile.begin(); kk < rfile.end(); ++ kk) { char c = *kk; @@ -747,8 +747,8 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( ofile.append(hexCh); } } - cmStdString turl - = url + ((url.find("?",0) == cmStdString::npos) ? "?" : "&") + std::string turl + = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; *this->LogFile << "Trigger url: " << turl.c_str() << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " @@ -805,11 +805,11 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::SubmitUsingSCP( - const cmStdString& scp_command, - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) + const std::string& scp_command, + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { if ( !scp_command.size() || !localprefix.size() || !files.size() || !remoteprefix.size() || !url.size() ) @@ -906,10 +906,10 @@ bool cmCTestSubmitHandler::SubmitUsingSCP( //---------------------------------------------------------------------------- bool cmCTestSubmitHandler::SubmitUsingCP( - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& destination) + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& destination) { if ( !localprefix.size() || !files.size() || !remoteprefix.size() || !destination.size() ) @@ -947,17 +947,17 @@ bool cmCTestSubmitHandler::SubmitUsingCP( //---------------------------------------------------------------------------- #if defined(CTEST_USE_XMLRPC) -bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url) +bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url) { xmlrpc_env env; char ctestString[] = "CTest"; std::string ctestVersionString = cmVersion::GetCMakeVersion(); char* ctestVersion = const_cast(ctestVersionString.c_str()); - cmStdString realURL = url + "/" + remoteprefix + "/Command/"; + std::string realURL = url + "/" + remoteprefix + "/Command/"; /* Start up our XML-RPC client library. */ xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, ctestString, ctestVersion); @@ -973,7 +973,7 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, { xmlrpc_value *result; - cmStdString local_file = *file; + std::string local_file = *file; if ( !cmSystemTools::FileExists(local_file.c_str()) ) { local_file = localprefix + "/" + *file; @@ -1045,10 +1045,10 @@ bool cmCTestSubmitHandler::SubmitUsingXMLRPC(const cmStdString& localprefix, return true; } #else -bool cmCTestSubmitHandler::SubmitUsingXMLRPC(cmStdString const&, - std::set const&, - cmStdString const&, - cmStdString const&) +bool cmCTestSubmitHandler::SubmitUsingXMLRPC(std::string const&, + std::set const&, + std::string const&, + std::string const&) { return false; } @@ -1085,7 +1085,7 @@ int cmCTestSubmitHandler::ProcessHandler() } if ( getenv("HTTP_PROXY_TYPE") ) { - cmStdString type = getenv("HTTP_PROXY_TYPE"); + std::string type = getenv("HTTP_PROXY_TYPE"); // HTTP/SOCKS4/SOCKS5 if ( type == "HTTP" ) { @@ -1122,7 +1122,7 @@ int cmCTestSubmitHandler::ProcessHandler() } if ( getenv("FTP_PROXY_TYPE") ) { - cmStdString type = getenv("FTP_PROXY_TYPE"); + std::string type = getenv("FTP_PROXY_TYPE"); // HTTP/SOCKS4/SOCKS5 if ( type == "HTTP" ) { @@ -1178,7 +1178,7 @@ int cmCTestSubmitHandler::ProcessHandler() this->CTest->AddIfExists(cmCTest::PartTest, "Test.xml"); if(this->CTest->AddIfExists(cmCTest::PartCoverage, "Coverage.xml")) { - cmCTest::VectorOfStrings gfiles; + std::vector gfiles; std::string gpath = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; @@ -1247,7 +1247,7 @@ int cmCTestSubmitHandler::ProcessHandler() } this->SetLogFile(&ofs); - cmStdString dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); + std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); if ( dropMethod == "" || dropMethod == "ftp" ) { diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 14eac80b5..accabd1c5 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -47,33 +47,33 @@ private: /** * Submit file using various ways */ - bool SubmitUsingFTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingHTTP(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); - bool SubmitUsingSCP(const cmStdString& scp_command, - const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); + bool SubmitUsingFTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + bool SubmitUsingHTTP(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); + bool SubmitUsingSCP(const std::string& scp_command, + const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); - bool SubmitUsingCP( const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); + bool SubmitUsingCP( const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); - bool TriggerUsingHTTP(const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); + bool TriggerUsingHTTP(const std::set& files, + const std::string& remoteprefix, + const std::string& url); - bool SubmitUsingXMLRPC(const cmStdString& localprefix, - const std::set& files, - const cmStdString& remoteprefix, - const cmStdString& url); + bool SubmitUsingXMLRPC(const std::string& localprefix, + const std::set& files, + const std::string& remoteprefix, + const std::string& url); typedef std::vector cmCTestSubmitHandlerVectorOfChar; @@ -82,10 +82,10 @@ private: std::string GetSubmitResultsPrefix(); class ResponseParser; - cmStdString HTTPProxy; + std::string HTTPProxy; int HTTPProxyType; - cmStdString HTTPProxyAuth; - cmStdString FTPProxy; + std::string HTTPProxyAuth; + std::string FTPProxy; int FTPProxyType; std::ostream* LogFile; bool SubmitPart[cmCTest::PartCount]; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 3a04b332d..b1dddcb03 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -540,8 +540,8 @@ int cmCTestTestHandler::ProcessHandler() this->StartLogFile((this->MemCheck ? "DynamicAnalysis" : "Test"), mLogFile); this->LogFile = &mLogFile; - std::vector passed; - std::vector failed; + std::vector passed; + std::vector failed; int total; //start the real time clock @@ -569,7 +569,7 @@ int cmCTestTestHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << "The following tests passed:" << std::endl); - for(std::vector::iterator j = passed.begin(); + for(std::vector::iterator j = passed.begin(); j != passed.end(); ++j) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "\t" << *j @@ -661,8 +661,8 @@ void cmCTestTestHandler::PrintLabelSummary() cmCTestTestHandler::ListOfTests::iterator it = this->TestList.begin(); cmCTestTestHandler::TestResultsVector::iterator ri = this->TestResults.begin(); - std::map labelTimes; - std::set labels; + std::map labelTimes; + std::set labels; // initialize maps std::string::size_type maxlen = 0; for(; it != this->TestList.end(); ++it) @@ -702,7 +702,7 @@ void cmCTestTestHandler::PrintLabelSummary() { cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:"); } - for(std::set::const_iterator i = labels.begin(); + for(std::set::const_iterator i = labels.begin(); i != labels.end(); ++i) { std::string label = *i; @@ -1050,8 +1050,8 @@ bool cmCTestTestHandler::GetValue(const char* tag, } //--------------------------------------------------------------------- -void cmCTestTestHandler::ProcessDirectory(std::vector &passed, - std::vector &failed) +void cmCTestTestHandler::ProcessDirectory(std::vector &passed, + std::vector &failed) { this->ComputeTestList(); this->StartTest = this->CTest->CurrentTime(); @@ -1216,7 +1216,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) << "name=\"Command Line\">" << cmXMLSafe(result->FullCommandLine) << "\n"; - std::map::iterator measureIt; + std::map::iterator measureIt; for ( measureIt = result->Properties->Measurements.begin(); measureIt != result->Properties->Measurements.end(); ++ measureIt ) @@ -1328,9 +1328,9 @@ void cmCTestTestHandler::AttachFiles(std::ostream& os, } //---------------------------------------------------------------------- -int cmCTestTestHandler::ExecuteCommands(std::vector& vec) +int cmCTestTestHandler::ExecuteCommands(std::vector& vec) { - std::vector::iterator it; + std::vector::iterator it; for ( it = vec.begin(); it != vec.end(); ++it ) { int retVal = 0; @@ -2112,7 +2112,7 @@ bool cmCTestTestHandler::SetTestsProperties( const std::vector& args) { std::vector::const_iterator it; - std::vector tests; + std::vector tests; bool found = false; for ( it = args.begin(); it != args.end(); ++ it ) { @@ -2137,7 +2137,7 @@ bool cmCTestTestHandler::SetTestsProperties( break; } std::string val = *it; - std::vector::const_iterator tit; + std::vector::const_iterator tit; for ( tit = tests.begin(); tit != tests.end(); ++ tit ) { cmCTestTestHandler::ListOfTests::iterator rtit; @@ -2319,7 +2319,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } if ( this->MemCheck ) { - std::vector::iterator it; + std::vector::iterator it; bool found = false; for ( it = this->CustomTestsIgnore.begin(); it != this->CustomTestsIgnore.end(); ++ it ) @@ -2339,7 +2339,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) } else { - std::vector::iterator it; + std::vector::iterator it; bool found = false; for ( it = this->CustomTestsIgnore.begin(); it != this->CustomTestsIgnore.end(); ++ it ) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 63f9c9368..fe43bb893 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -87,8 +87,8 @@ public: // ctest -j N will break for that feature struct cmCTestTestProperties { - cmStdString Name; - cmStdString Directory; + std::string Name; + std::string Directory; std::vector Args; std::vector RequiredFiles; std::vector Depends; @@ -98,7 +98,7 @@ public: std::string> > ErrorRegularExpressions; std::vector > RequiredRegularExpressions; - std::map Measurements; + std::map Measurements; bool IsInBasedOnREOptions; bool WillFail; float Cost; @@ -162,7 +162,7 @@ protected: virtual int PreProcessHandler(); virtual int PostProcessHandler(); virtual void GenerateTestCommand(std::vector& args, int test); - int ExecuteCommands(std::vector& vec); + int ExecuteCommands(std::vector& vec); void WriteTestResultHeader(std::ostream& os, cmCTestTestResult* result); void WriteTestResultFooter(std::ostream& os, cmCTestTestResult* result); @@ -177,7 +177,7 @@ protected: typedef std::vector TestResultsVector; TestResultsVector TestResults; - std::vector CustomTestsIgnore; + std::vector CustomTestsIgnore; std::string StartTest; std::string EndTest; unsigned int StartTestTime; @@ -210,8 +210,8 @@ private: /** * Run the tests for a directory and any subdirectories */ - void ProcessDirectory(std::vector &passed, - std::vector &failed); + void ProcessDirectory(std::vector &passed, + std::vector &failed); /** * Get the list of tests in directory and subdirectories. @@ -251,8 +251,8 @@ private: void ExpandTestsToRunInformation(size_t numPossibleTests); void ExpandTestsToRunInformationForRerunFailed(); - std::vector CustomPreTest; - std::vector CustomPostTest; + std::vector CustomPreTest; + std::vector CustomPostTest; std::vector TestsToRun; diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index 731c1c7a3..f7de29471 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -47,7 +47,7 @@ bool cmCTestUploadCommand::CheckArgumentValue(std::string const& arg) { if(this->ArgumentDoing == ArgumentDoingFiles) { - cmStdString filename(arg); + std::string filename(arg); if(cmSystemTools::FileExists(filename.c_str())) { this->Files.insert(filename); diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index fbee2272e..f89fa2ba5 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -63,9 +63,9 @@ bool cmCTestVC::InitialCheckout(const char* command) } // Construct the initial checkout command line. - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); std::vector vc_co; - for(std::vector::const_iterator ai = args.begin(); + for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { vc_co.push_back(ai->c_str()); diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 528d0dbaa..5bcfeaca4 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -182,7 +182,7 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, // ( file , entry ) = "number_executed:timing_info" // ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1 // ( file , entry, line, IGNORE ) =number_executed - std::vector args; + std::vector args; std::string::size_type pos = line.find('(', 0); // if no ( is found, then return line has no coverage if(pos == std::string::npos) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 6226febfd..fe98964c5 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -140,7 +140,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine, std::string& filepath) { - std::map::iterator i = + std::map::iterator i = this->RoutineToDirectory.find(routine); if(i != this->RoutineToDirectory.end()) { diff --git a/Source/CTest/cmParseMumpsCoverage.h b/Source/CTest/cmParseMumpsCoverage.h index c1effa79b..bc7189168 100644 --- a/Source/CTest/cmParseMumpsCoverage.h +++ b/Source/CTest/cmParseMumpsCoverage.h @@ -44,7 +44,7 @@ protected: bool FindMumpsFile(std::string const& routine, std::string& filepath); protected: - std::map RoutineToDirectory; + std::map RoutineToDirectory; cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; }; diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index 1c26c1c59..3b7f968f6 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -34,7 +34,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until) return true; } bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in, - cmStdString const& fileName) + std::string const& fileName) { cmCTestCoverageHandlerContainer::SingleFileCoverageVector& coverageVector = this->Coverage.TotalCoverage[fileName]; @@ -166,7 +166,7 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in) // read the string data in.read(s, size-1); s[size-1] = 0; - cmStdString fileName = s; + std::string fileName = s; delete [] s; // read close quote if(in.get(c) && c != '"') diff --git a/Source/CTest/cmParsePHPCoverage.h b/Source/CTest/cmParsePHPCoverage.h index 035a093c9..92a76347f 100644 --- a/Source/CTest/cmParsePHPCoverage.h +++ b/Source/CTest/cmParsePHPCoverage.h @@ -35,7 +35,7 @@ private: bool ReadArraySize(std::istream& in, int& size); bool ReadFileInformation(std::istream& in); bool ReadInt(std::istream& in, int& v); - bool ReadCoverageArray(std::istream& in, cmStdString const&); + bool ReadCoverageArray(std::istream& in, std::string const&); bool ReadUntil(std::istream& in, char until); cmCTestCoverageHandlerContainer& Coverage; cmCTest* CTest; diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 14c325bcb..893ca9914 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -57,7 +57,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) { glob = cstr + "*"; } - std::vector dirs; + std::vector dirs; cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 72bb7fd76..ee9b664d6 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1153,7 +1153,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output, int* retVal, const char* dir, int timeout, std::ostream& ofs) { // First generate the command and arguments - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -1161,7 +1161,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output, } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); @@ -1637,7 +1637,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, } //---------------------------------------------------------------------- -int cmCTest::GenerateNotesFile(const std::vector &files) +int cmCTest::GenerateNotesFile(const VectorOfStrings &files) { cmGeneratedFileStream ofs; if ( !this->OpenOutputFile(this->CurrentTag, "Notes.xml", ofs) ) @@ -1658,7 +1658,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles) return 1; } - std::vector files; + VectorOfStrings files; cmCTestLog(this, OUTPUT, "Create notes file" << std::endl); @@ -1675,7 +1675,7 @@ int cmCTest::GenerateNotesFile(const char* cfiles) std::string cmCTest::Base64GzipEncodeFile(std::string file) { std::string tarFile = file + "_temp.tar.gz"; - std::vector files; + std::vector files; files.push_back(file); if(!cmSystemTools::CreateTar(tarFile.c_str(), files, true, false, false)) @@ -1722,9 +1722,9 @@ std::string cmCTest::Base64EncodeFile(std::string file) //---------------------------------------------------------------------- -bool cmCTest::SubmitExtraFiles(const std::vector &files) +bool cmCTest::SubmitExtraFiles(const VectorOfStrings &files) { - std::vector::const_iterator it; + VectorOfStrings::const_iterator it; for ( it = files.begin(); it != files.end(); ++ it ) @@ -1749,7 +1749,7 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) return 1; } - std::vector files; + VectorOfStrings files; cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl); @@ -2594,7 +2594,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) //---------------------------------------------------------------------- void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, - VectorOfStrings& vec) + std::vector& vec) { const char* dval = mf->GetDefinition(def); if ( !dval ) @@ -2892,7 +2892,7 @@ bool cmCTest::RunCommand( const char* dir, double timeout) { - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -2900,7 +2900,7 @@ bool cmCTest::RunCommand( } std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 1eb0e01a8..836e41d27 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -101,8 +101,8 @@ public: if the string does not name a valid part. */ Part GetPartFromName(const char* name); - typedef std::vector VectorOfStrings; - typedef std::set SetOfStrings; + typedef std::vector VectorOfStrings; + typedef std::set SetOfStrings; ///! Process Command line arguments int Run(std::vector &, std::string* output = 0); @@ -186,7 +186,7 @@ public: void SetNotesFiles(const char* notes); void PopulateCustomVector(cmMakefile* mf, const std::string& definition, - VectorOfStrings& vec); + std::vector& vec); void PopulateCustomInteger(cmMakefile* mf, const std::string& def, int& val); @@ -352,11 +352,11 @@ public: void AddCTestConfigurationOverwrite(const std::string& encstr); //! Create XML file that contains all the notes specified - int GenerateNotesFile(const std::vector &files); + int GenerateNotesFile(const VectorOfStrings &files); //! Submit extra files to the server bool SubmitExtraFiles(const char* files); - bool SubmitExtraFiles(const std::vector &files); + bool SubmitExtraFiles(const VectorOfStrings &files); //! Set the output log file name void SetOutputLogFileName(const char* name); @@ -391,7 +391,7 @@ public: //! Read the custom configuration files and apply them to the current ctest int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf); - std::vector &GetInitialCommandLineArguments() + std::vector &GetInitialCommandLineArguments() { return this->InitialCommandLineArguments; }; //! Set the track to submit to @@ -447,13 +447,13 @@ private: void DetermineNextDayStop(); // these are helper classes - typedef std::map t_TestingHandlers; + typedef std::map t_TestingHandlers; t_TestingHandlers TestingHandlers; bool ShowOnly; //! Map of configuration properties - typedef std::map CTestConfigurationMap; + typedef std::map CTestConfigurationMap; std::string CTestConfigFile; // TODO: The ctest configuration should be a hierarchy of @@ -463,7 +463,7 @@ private: CTestConfigurationMap CTestConfiguration; CTestConfigurationMap CTestConfigurationOverwrites; PartInfo Parts[PartCount]; - typedef std::map PartMapType; + typedef std::map PartMapType; PartMapType PartMap; std::string CurrentTag; @@ -556,7 +556,7 @@ private: int DartVersion; bool DropSiteCDash; - std::vector InitialCommandLineArguments; + std::vector InitialCommandLineArguments; int SubmitIndex; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 141fde598..39b9ae53c 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -90,7 +90,7 @@ bool cmCacheManager::LoadCache(const std::string& path) bool cmCacheManager::LoadCache(const std::string& path, bool internal) { - std::set emptySet; + std::set emptySet; return this->LoadCache(path, internal, emptySet, emptySet); } @@ -195,8 +195,8 @@ void cmCacheManager::CleanCMakeFiles(const std::string& path) bool cmCacheManager::LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes) + std::set& excludes, + std::set& includes) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; @@ -500,7 +500,7 @@ bool cmCacheManager::SaveCache(const std::string& path) fout << "########################\n"; fout << "\n"; - for( std::map::const_iterator i = + for( std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; @@ -693,7 +693,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const { out << "=================================================" << std::endl; out << "CMakeCache Contents:" << std::endl; - for(std::map::const_iterator i = + for(std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { if((*i).second.Type != INTERNAL) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 14cb1d9eb..573f828f1 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -72,7 +72,7 @@ public: void SetType(CacheEntryType ty) { this->GetEntry().Type = ty; } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager &Container; - std::map::iterator Position; + std::map::iterator Position; CacheIterator(cmCacheManager &cm) : Container(cm) { this->Begin(); } @@ -111,8 +111,8 @@ public: bool LoadCache(const std::string& path); bool LoadCache(const std::string& path, bool internal); bool LoadCache(const std::string& path, bool internal, - std::set& excludes, - std::set& includes); + std::set& excludes, + std::set& includes); ///! Save cache for given makefile. Saves to ouput home CMakeCache.txt. bool SaveCache(cmMakefile*) ; @@ -166,7 +166,7 @@ protected: unsigned int CacheMinorVersion; private: cmake* CMakeInstance; - typedef std::map CacheEntryMap; + typedef std::map CacheEntryMap; static void OutputHelpString(std::ostream& fout, const std::string& helpString); static void OutputKey(std::ostream& fout, std::string const& key); diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index da00124ef..d375ae624 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -77,8 +77,8 @@ public: char BSLASHVariable[3]; private: - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; int CurrentLine; int Verbose; diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index d51e6e63f..6c1c1de22 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -279,12 +279,12 @@ cmComputeLinkDepends::Compute() } //---------------------------------------------------------------------------- -std::map::iterator +std::map::iterator cmComputeLinkDepends::AllocateLinkEntry(std::string const& item) { - std::map::value_type + std::map::value_type index_entry(item, static_cast(this->EntryList.size())); - std::map::iterator + std::map::iterator lei = this->LinkEntryIndex.insert(index_entry).first; this->EntryList.push_back(LinkEntry()); this->InferredDependSets.push_back(0); @@ -297,7 +297,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, std::string const& item) { // Check if the item entry has already been added. - std::map::iterator lei = this->LinkEntryIndex.find(item); + std::map::iterator lei = this->LinkEntryIndex.find(item); if(lei != this->LinkEntryIndex.end()) { // Yes. We do not need to follow the item's dependencies again. @@ -423,7 +423,7 @@ cmComputeLinkDepends void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) { // Check if the target already has an entry. - std::map::iterator lei = + std::map::iterator lei = this->LinkEntryIndex.find(dep.Item); if(lei == this->LinkEntryIndex.end()) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 26bf6dbf9..ac5e368ae 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -76,7 +76,7 @@ private: typedef cmTarget::LinkLibraryVectorType LinkLibraryVectorType; - std::map::iterator + std::map::iterator AllocateLinkEntry(std::string const& item); int AddLinkEntry(int depender_index, std::string const& item); void AddVarLinkEntries(int depender_index, const char* value); @@ -88,7 +88,7 @@ private: // One entry for each unique item. std::vector EntryList; - std::map LinkEntryIndex; + std::map LinkEntryIndex; // BFS of initial dependencies. struct BFSEntry diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 23a6671c5..32b23b8e4 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -902,7 +902,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo() // be the library name. Match index 3 will be the library // extension. reg = "^("; - for(std::set::iterator p = this->LinkPrefixes.begin(); + for(std::set::iterator p = this->LinkPrefixes.begin(); p != this->LinkPrefixes.end(); ++p) { reg += *p; @@ -1640,7 +1640,7 @@ void cmComputeLinkInformation::PrintLinkPolicyDiagnosis(std::ostream& os) // List the paths old behavior is adding. os << "and other libraries with known full path:\n"; - std::set emitted; + std::set emitted; for(std::vector::const_iterator i = this->OldLinkDirItems.begin(); i != this->OldLinkDirItems.end(); ++i) @@ -1856,7 +1856,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath) //---------------------------------------------------------------------------- static void cmCLI_ExpandListUnique(const char* str, std::vector& out, - std::set& emitted) + std::set& emitted) { std::vector tmp; cmSystemTools::ExpandListArgument(str, tmp); @@ -1894,7 +1894,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); // Construct the RPATH. - std::set emitted; + std::set emitted; if(use_install_rpath) { const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH"); diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 26ee8f044..b5a8bec6b 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -126,7 +126,7 @@ private: std::vector StaticLinkExtensions; std::vector SharedLinkExtensions; std::vector LinkExtensions; - std::set LinkPrefixes; + std::set LinkPrefixes; cmsys::RegularExpression ExtractStaticLibraryName; cmsys::RegularExpression ExtractSharedLibraryName; cmsys::RegularExpression ExtractAnyLibraryName; @@ -153,7 +153,7 @@ private: // Framework info. void ComputeFrameworkInfo(); void AddFrameworkPath(std::string const& p); - std::set FrameworkPathsEmmitted; + std::set FrameworkPathsEmmitted; cmsys::RegularExpression SplitFramework; // Linker search path computation. @@ -165,14 +165,14 @@ private: void LoadImplicitLinkInfo(); void AddImplicitLinkInfo(); void AddImplicitLinkInfo(std::string const& lang); - std::set ImplicitLinkDirs; - std::set ImplicitLinkLibs; + std::set ImplicitLinkDirs; + std::set ImplicitLinkLibs; // Additional paths configured by the runtime linker std::vector RuntimeLinkDirs; // Linker search path compatibility mode. - std::set OldLinkDirMask; + std::set OldLinkDirMask; std::vector OldLinkDirItems; std::vector OldUserFlagItems; bool OldLinkDirMode; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 83d1e2e3a..405643e1b 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -211,7 +211,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // dependencies in all targets, because the generated build-systems can't // deal with config-specific dependencies. { - std::set emitted; + std::set emitted; { std::vector tlibs; depender->GetDirectLinkLibraries(0, tlibs, depender); @@ -255,11 +255,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Loop over all utility dependencies. { - std::set const& tutils = depender->GetUtilities(); - std::set emitted; + std::set const& tutils = depender->GetUtilities(); + std::set emitted; // A target should not depend on itself. emitted.insert(depender->GetName()); - for(std::set::const_iterator util = tutils.begin(); + for(std::set::const_iterator util = tutils.begin(); util != tutils.end(); ++util) { // Don't emit the same utility twice for this target. @@ -275,7 +275,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, - std::set &emitted) + std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; if(cmTarget::LinkInterface const* iface = @@ -300,7 +300,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, const std::string& dependee_name, bool linking, - std::set &emitted) + std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; cmTarget const* dependee = @@ -406,8 +406,8 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(dependee->IsImported()) { // Skip imported targets but follow their utility dependencies. - std::set const& utils = dependee->GetUtilities(); - for(std::set::const_iterator i = utils.begin(); + std::set const& utils = dependee->GetUtilities(); + for(std::set::const_iterator i = utils.begin(); i != utils.end(); ++i) { if(cmTarget const* transitive_dependee = diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index dcb450acc..db76a1803 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -53,10 +53,10 @@ private: bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); void AddInterfaceDepends(int depender_index, const std::string& dependee_name, - bool linking, std::set &emitted); + bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, const char *config, - std::set &emitted); + std::set &emitted); cmGlobalGenerator* GlobalGenerator; bool DebugMode; bool NoCycles; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index b0e2b6f42..ea3e81462 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -566,7 +566,7 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) cmsys::Directory dir; dir.Load(binDir); size_t fileNum; - std::set deletedFiles; + std::set deletedFiles; for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) { if (strcmp(dir.GetFile(static_cast(fileNum)),".") && diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 6851105d6..67c305e55 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -72,7 +72,7 @@ public: /** Backtrace of the command that created this custom command. */ cmListFileBacktrace const& GetBacktrace() const; - typedef std::pair ImplicitDependsPair; + typedef std::pair ImplicitDependsPair; class ImplicitDependsList: public std::vector {}; void SetImplicitDepends(ImplicitDependsList const&); void AppendImplicitDepends(ImplicitDependsList const&); diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx index 5fa387750..babf1c4e8 100644 --- a/Source/cmDefinitions.cxx +++ b/Source/cmDefinitions.cxx @@ -85,9 +85,9 @@ const char* cmDefinitions::Set(const std::string& key, const char* value) } //---------------------------------------------------------------------------- -std::set cmDefinitions::LocalKeys() const +std::set cmDefinitions::LocalKeys() const { - std::set keys; + std::set keys; // Consider local definitions. for(MapType::const_iterator mi = this->Map.begin(); mi != this->Map.end(); ++mi) @@ -110,12 +110,12 @@ cmDefinitions cmDefinitions::Closure() const cmDefinitions::cmDefinitions(ClosureTag const&, cmDefinitions const* root): Up(0) { - std::set undefined; + std::set undefined; this->ClosureImpl(undefined, root); } //---------------------------------------------------------------------------- -void cmDefinitions::ClosureImpl(std::set& undefined, +void cmDefinitions::ClosureImpl(std::set& undefined, cmDefinitions const* defs) { // Consider local definitions. @@ -145,17 +145,17 @@ void cmDefinitions::ClosureImpl(std::set& undefined, } //---------------------------------------------------------------------------- -std::set cmDefinitions::ClosureKeys() const +std::set cmDefinitions::ClosureKeys() const { - std::set defined; - std::set undefined; + std::set defined; + std::set undefined; this->ClosureKeys(defined, undefined); return defined; } //---------------------------------------------------------------------------- -void cmDefinitions::ClosureKeys(std::set& defined, - std::set& undefined) const +void cmDefinitions::ClosureKeys(std::set& defined, + std::set& undefined) const { // Consider local definitions. for(MapType::const_iterator mi = this->Map.begin(); @@ -165,7 +165,7 @@ void cmDefinitions::ClosureKeys(std::set& defined, if(defined.find(mi->first) == defined.end() && undefined.find(mi->first) == undefined.end()) { - std::set& m = mi->second.Exists? defined : undefined; + std::set& m = mi->second.Exists? defined : undefined; m.insert(mi->first); } } diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 24dad29d5..4c1ad0afe 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -41,22 +41,25 @@ public: const char* Set(const std::string& key, const char* value); /** Get the set of all local keys. */ - std::set LocalKeys() const; + std::set LocalKeys() const; /** Compute the closure of all defined keys with values. This flattens the scope. The result has no parent. */ cmDefinitions Closure() const; /** Compute the set of all defined keys. */ - std::set ClosureKeys() const; + std::set ClosureKeys() const; private: // String with existence boolean. - struct Def: public cmStdString + struct Def: public std::string { - Def(): cmStdString(), Exists(false) {} - Def(const char* v): cmStdString(v?v:""), Exists(v?true:false) {} - Def(Def const& d): cmStdString(d), Exists(d.Exists) {} + private: + typedef std::string std_string; + public: + Def(): std_string(), Exists(false) {} + Def(const char* v): std_string(v?v:""), Exists(v?true:false) {} + Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; static Def NoDef; @@ -65,7 +68,7 @@ private: cmDefinitions* Up; // Local definitions, set or unset. - typedef std::map MapType; + typedef std::map MapType; MapType Map; // Internal query and update methods. @@ -75,12 +78,12 @@ private: // Implementation of Closure() method. struct ClosureTag {}; cmDefinitions(ClosureTag const&, cmDefinitions const* root); - void ClosureImpl(std::set& undefined, + void ClosureImpl(std::set& undefined, cmDefinitions const* defs); // Implementation of ClosureKeys() method. - void ClosureKeys(std::set& defined, - std::set& undefined) const; + void ClosureKeys(std::set& defined, + std::set& undefined) const; }; #endif diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 585f959da..57a66da31 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -91,7 +91,7 @@ cmDependsC::~cmDependsC() { this->WriteCacheFile(); - for (std::map::iterator it= + for (std::map::iterator it= this->FileCache.begin(); it!=this->FileCache.end(); ++it) { delete it->second; @@ -116,7 +116,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, return false; } - std::set dependencies; + std::set dependencies; bool haveDeps = false; if (this->ValidDeps != 0) @@ -149,7 +149,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, this->Encountered.insert(*srcIt); } - std::set scanned; + std::set scanned; // Use reserve to allocate enough memory for tempPathStr // so that during the loops no memory is allocated or freed @@ -182,7 +182,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, } else { - std::map::iterator + std::map::iterator headerLocationIt=this->HeaderLocationCache.find(current.FileName); if (headerLocationIt!=this->HeaderLocationCache.end()) { @@ -224,7 +224,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, scanned.insert(fullName); // Check whether this file is already in the cache - std::map::iterator fileIt= + std::map::iterator fileIt= this->FileCache.find(fullName); if (fileIt!=this->FileCache.end()) { @@ -270,7 +270,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // convert the dependencies to paths relative to the home output // directory. We must do the same here. internalDepends << obj << std::endl; - for(std::set::const_iterator i=dependencies.begin(); + for(std::set::const_iterator i=dependencies.begin(); i != dependencies.end(); ++i) { makeDepends << obj << ": " << @@ -392,7 +392,7 @@ void cmDependsC::WriteCacheFile() const cacheOut << this->IncludeRegexComplainString << "\n\n"; cacheOut << this->IncludeRegexTransformString << "\n\n"; - for (std::map::const_iterator fileIt= + for (std::map::const_iterator fileIt= this->FileCache.begin(); fileIt!=this->FileCache.end(); ++fileIt) { @@ -421,7 +421,7 @@ void cmDependsC::WriteCacheFile() const //---------------------------------------------------------------------------- void cmDependsC::Scan(std::istream& is, const char* directory, - const cmStdString& fullName) + const std::string& fullName) { cmIncludeLines* newCacheEntry=new cmIncludeLines; newCacheEntry->Used=true; diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h index cd1e7a4bd..07d3c21f3 100644 --- a/Source/cmDependsC.h +++ b/Source/cmDependsC.h @@ -41,7 +41,7 @@ protected: // Method to scan a single file. void Scan(std::istream& is, const char* directory, - const cmStdString& fullName); + const std::string& fullName); // Regular expression to identify C preprocessor include directives. cmsys::RegularExpression IncludeRegexLine; @@ -57,7 +57,7 @@ protected: // Regex to transform #include lines. std::string IncludeRegexTransformString; cmsys::RegularExpression IncludeRegexTransform; - typedef std::map TransformRulesType; + typedef std::map TransformRulesType; TransformRulesType TransformRules; void SetupTransforms(); void ParseTransform(std::string const& xform); @@ -67,8 +67,8 @@ public: // Data structures for dependency graph walk. struct UnscannedEntry { - cmStdString FileName; - cmStdString QuotedLocation; + std::string FileName; + std::string QuotedLocation; }; struct cmIncludeLines @@ -79,13 +79,13 @@ public: }; protected: const std::map* ValidDeps; - std::set Encountered; + std::set Encountered; std::queue Unscanned; - std::map FileCache; - std::map HeaderLocationCache; + std::map FileCache; + std::map HeaderLocationCache; - cmStdString CacheFileName; + std::string CacheFileName; void WriteCacheFile() const; void ReadCacheFile(); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d5472a19c..b3fbaa230 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -34,11 +34,11 @@ public: std::string Source; // Set of provided and required modules. - std::set Provides; - std::set Requires; + std::set Provides; + std::set Requires; // Set of files included in the translation unit. - std::set Includes; + std::set Includes; }; //---------------------------------------------------------------------------- @@ -98,24 +98,24 @@ class cmDependsFortranInternals { public: // The set of modules provided by this target. - std::set TargetProvides; + std::set TargetProvides; // Map modules required by this target to locations. - typedef std::map TargetRequiresMap; + typedef std::map TargetRequiresMap; TargetRequiresMap TargetRequires; // Information about each object file. - typedef std::map ObjectInfoMap; + typedef std::map ObjectInfoMap; ObjectInfoMap ObjectInfo; cmDependsFortranSourceInfo& CreateObjectInfo(const char* obj, const char* src) { - std::map::iterator i = + std::map::iterator i = this->ObjectInfo.find(obj); if(i == this->ObjectInfo.end()) { - std::map::value_type + std::map::value_type entry(obj, cmDependsFortranSourceInfo()); i = this->ObjectInfo.insert(entry).first; i->second.Source = src; @@ -260,8 +260,8 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fiStream(fiName.c_str()); fiStream << "# The fortran modules provided by this target.\n"; fiStream << "provides\n"; - std::set const& provides = this->Internal->TargetProvides; - for(std::set::const_iterator i = provides.begin(); + std::set const& provides = this->Internal->TargetProvides; + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { fiStream << " " << *i << "\n"; @@ -275,7 +275,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, cmGeneratedFileStream fcStream(fcName.c_str()); fcStream << "# Remove fortran modules provided by this target.\n"; fcStream << "FILE(REMOVE"; - for(std::set::const_iterator i = provides.begin(); + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { std::string mod_upper = mod_dir; @@ -319,14 +319,14 @@ void cmDependsFortran::LocateModules() infoI != objInfo.end(); ++infoI) { cmDependsFortranSourceInfo const& info = infoI->second; - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. this->Internal->TargetProvides.insert(*i); } - for(std::set::const_iterator i = info.Requires.begin(); + for(std::set::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Include this module in the set required by this target. @@ -368,8 +368,8 @@ void cmDependsFortran::LocateModules() void cmDependsFortran::MatchLocalModules() { const char* stampDir = this->TargetDirectory.c_str(); - std::set const& provides = this->Internal->TargetProvides; - for(std::set::const_iterator i = provides.begin(); + std::set const& provides = this->Internal->TargetProvides; + for(std::set::const_iterator i = provides.begin(); i != provides.end(); ++i) { this->ConsiderModule(i->c_str(), stampDir); @@ -445,7 +445,7 @@ cmDependsFortran // Write the include dependencies to the output stream. internalDepends << obj << std::endl; internalDepends << " " << src << std::endl; - for(std::set::const_iterator i = info.Includes.begin(); + for(std::set::const_iterator i = info.Includes.begin(); i != info.Includes.end(); ++i) { makeDepends << obj << ": " << @@ -458,11 +458,11 @@ cmDependsFortran makeDepends << std::endl; // Write module requirements to the output stream. - for(std::set::const_iterator i = info.Requires.begin(); + for(std::set::const_iterator i = info.Requires.begin(); i != info.Requires.end(); ++i) { // Require only modules not provided in the same source. - if(std::set::const_iterator(info.Provides.find(*i)) != + if(std::set::const_iterator(info.Provides.find(*i)) != info.Provides.end()) { continue; @@ -519,7 +519,7 @@ cmDependsFortran } // Write provided modules to the output stream. - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { std::string proxy = stamp_dir; @@ -538,7 +538,7 @@ cmDependsFortran // Create a target to copy the module after the object file // changes. makeDepends << obj << ".provides.build:\n"; - for(std::set::const_iterator i = info.Provides.begin(); + for(std::set::const_iterator i = info.Provides.begin(); i != info.Provides.end(); ++i) { // Include this module in the set provided by this target. diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index c30d4bd05..e23e4b7ff 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -36,10 +36,10 @@ cmDependsJavaParserHelper::~cmDependsJavaParserHelper() } void cmDependsJavaParserHelper::CurrentClass -::AddFileNamesForPrinting(std::vector *files, +::AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep) { - cmStdString rname = ""; + std::string rname = ""; if ( prefix ) { rname += prefix; @@ -76,7 +76,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) { return; } - std::vector::iterator it; + std::vector::iterator it; for ( it = this->ClassesFound.begin(); it != this->ClassesFound.end(); it ++ ) @@ -91,7 +91,7 @@ void cmDependsJavaParserHelper::AddClassFound(const char* sclass) void cmDependsJavaParserHelper::AddPackagesImport(const char* sclass) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->PackagesImport.begin(); it != this->PackagesImport.end(); it ++ ) @@ -256,8 +256,8 @@ void cmDependsJavaParserHelper::PrintClasses() std::cerr << "Error when parsing. No classes on class stack" << std::endl; abort(); } - std::vector files = this->GetFilesProduced(); - std::vector::iterator sit; + std::vector files = this->GetFilesProduced(); + std::vector::iterator sit; for ( sit = files.begin(); sit != files.end(); ++ sit ) @@ -266,9 +266,9 @@ void cmDependsJavaParserHelper::PrintClasses() } } -std::vector cmDependsJavaParserHelper::GetFilesProduced() +std::vector cmDependsJavaParserHelper::GetFilesProduced() { - std::vector files; + std::vector files; CurrentClass* toplevel = &(*(this->ClassStack.begin())); std::vector::iterator it; for ( it = toplevel->NestedClasses->begin(); @@ -313,7 +313,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) std::cout << "Imports packages:"; if ( this->PackagesImport.size() > 0 ) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->PackagesImport.begin(); it != this->PackagesImport.end(); ++ it ) @@ -325,7 +325,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) std::cout << "Depends on:"; if ( this->ClassesFound.size() > 0 ) { - std::vector::iterator it; + std::vector::iterator it; for ( it = this->ClassesFound.begin(); it != this->ClassesFound.end(); ++ it ) @@ -419,8 +419,8 @@ int cmDependsJavaParserHelper::ParseFile(const char* file) return 0; } - cmStdString fullfile = ""; - cmStdString line; + std::string fullfile = ""; + std::string line; while ( cmSystemTools::GetLineFromStream(ifs, line) ) { fullfile += line + "\n"; diff --git a/Source/cmDependsJavaParserHelper.h b/Source/cmDependsJavaParserHelper.h index 9807a048c..554201894 100644 --- a/Source/cmDependsJavaParserHelper.h +++ b/Source/cmDependsJavaParserHelper.h @@ -59,15 +59,15 @@ public: const char* GetCurrentCombine() { return this->CurrentCombine.c_str(); } void UpdateCombine(const char* str1, const char* str2); - std::vector& GetClassesFound() { return this->ClassesFound; } + std::vector& GetClassesFound() { return this->ClassesFound; } - std::vector GetFilesProduced(); + std::vector GetFilesProduced(); private: class CurrentClass { public: - cmStdString Name; + std::string Name; std::vector* NestedClasses; CurrentClass() { @@ -93,16 +93,16 @@ private: { (*this) = c; } - void AddFileNamesForPrinting(std::vector *files, + void AddFileNamesForPrinting(std::vector *files, const char* prefix, const char* sep); }; - cmStdString CurrentPackage; - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string CurrentPackage; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; - std::vector ClassesFound; - std::vector PackagesImport; - cmStdString CurrentCombine; + std::vector ClassesFound; + std::vector PackagesImport; + std::string CurrentCombine; std::vector ClassStack; diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 6a0ab7b1b..944a00072 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -23,7 +23,7 @@ public: static cmDynamicLoaderCache* GetInstance(); private: - std::map CacheMap; + std::map CacheMap; static cmDynamicLoaderCache* Instance; }; @@ -47,7 +47,7 @@ void cmDynamicLoaderCache::CacheFile(const char* path, bool cmDynamicLoaderCache::GetCacheFile(const char* path, cmsys::DynamicLoader::LibraryHandle& p) { - std::map::iterator it + std::map::iterator it = this->CacheMap.find(path); if ( it != this->CacheMap.end() ) { @@ -59,7 +59,7 @@ bool cmDynamicLoaderCache::GetCacheFile(const char* path, bool cmDynamicLoaderCache::FlushCache(const char* path) { - std::map::iterator it + std::map::iterator it = this->CacheMap.find(path); bool ret = false; if ( it != this->CacheMap.end() ) @@ -73,7 +73,7 @@ bool cmDynamicLoaderCache::FlushCache(const char* path) void cmDynamicLoaderCache::FlushCache() { - for ( std::map::iterator it = this->CacheMap.begin(); it != this->CacheMap.end(); it++ ) diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index f93e72a2a..9e3ce0b49 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -63,7 +63,7 @@ public: bool GenerateImportFile(); protected: - typedef std::map ImportPropertyMap; + typedef std::map ImportPropertyMap; // Generate per-configuration target information to the given output // stream. diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 7c634a4d8..5ee2a7802 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -41,7 +41,7 @@ public: /** Get the per-config file generated for each configuraiton. This maps from the configuration name to the file temporary location for installation. */ - std::map const& GetConfigImportFiles() + std::map const& GetConfigImportFiles() { return this->ConfigImportFiles; } /** Compute the globbing expression used to load per-config import @@ -92,7 +92,7 @@ protected: std::string ImportPrefix; // The import file generated for each configuration. - std::map ConfigImportFiles; + std::map ConfigImportFiles; }; #endif diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 469a661eb..b04b93799 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -83,9 +83,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const cmake* cm = this->Makefile->GetCMakeInstance(); cmGlobalGenerator* global = cm->GetGlobalGenerator(); const std::vector& locals = global->GetLocalGenerators(); - std::map libDepsOld; - std::map libDepsNew; - std::map libTypes; + std::map libDepsOld; + std::map libDepsNew; + std::map libTypes; for(std::vector::const_iterator i = locals.begin(); i != locals.end(); ++i) { @@ -175,7 +175,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; - for(std::map::const_iterator + for(std::map::const_iterator i = libDepsNew.begin(); i != libDepsNew.end(); ++i) { @@ -186,7 +186,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const } fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; - for(std::map::const_iterator + for(std::map::const_iterator i = libDepsOld.begin(); i != libDepsOld.end(); ++i) { @@ -195,7 +195,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - for(std::map::const_iterator i = libTypes.begin(); + for(std::map::const_iterator i = libTypes.begin(); i != libTypes.end(); ++i) { if(i->second != "general") diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index 4b76b3322..8d6b2cd47 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -49,8 +49,8 @@ public: const char* GetError() { return this->ErrorString.c_str(); } private: - cmStdString::size_type InputBufferPos; - cmStdString InputBuffer; + std::string::size_type InputBufferPos; + std::string InputBuffer; std::vector OutputBuffer; int CurrentLine; int Verbose; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 133996992..01d115505 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -61,7 +61,7 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator() void cmExtraCodeBlocksGenerator::Generate() { // for each sub project in the project create a codeblocks project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -243,7 +243,7 @@ void cmExtraCodeBlocksGenerator Tree tree; // build tree of virtual folders - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it != this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 028d3d5b5..1e34fe043 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -60,7 +60,7 @@ void cmExtraCodeLiteGenerator::Generate() // loop projects and locate the root project. // and extract the information for creating the worspace - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -85,7 +85,7 @@ void cmExtraCodeLiteGenerator::Generate() } // for each sub project in the workspace create a codelite project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 74ba9a6b8..38a247034 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -624,7 +624,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( this->AppendLinkedResource(fout, "[Subprojects]", "virtual:/virtual", VirtualFolder); - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it != this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 3cfafa782..9c2849c01 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -64,7 +64,7 @@ cmExtraSublimeTextGenerator::cmExtraSublimeTextGenerator() void cmExtraSublimeTextGenerator::Generate() { // for each sub project in the project create a sublime text 2 project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 02f10c005..57274708b 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -43,13 +43,13 @@ private: class HashString { public: - size_t operator()(const cmStdString& s) const + size_t operator()(const std::string& s) const { return h(s.c_str()); } cmsys::hash h; }; - typedef cmsys::hash_map FileStatsMap; FileStatsMap Files; #endif diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h index e590d6e69..42d9bc1c0 100644 --- a/Source/cmFindBase.h +++ b/Source/cmFindBase.h @@ -42,14 +42,14 @@ protected: bool CheckForVariableInCache(); // use by command during find - cmStdString VariableDocumentation; - cmStdString VariableName; + std::string VariableDocumentation; + std::string VariableName; std::vector Names; bool NamesPerDir; bool NamesPerDirAllowed; // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM - cmStdString EnvironmentPath; // LIB,INCLUDE + std::string EnvironmentPath; // LIB,INCLUDE bool AlreadyInCache; bool AlreadyInCacheWithoutMetaInfo; diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index ba90a8498..5a905cd20 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -56,7 +56,7 @@ protected: /** Compute the current default bundle/framework search policy. */ void SelectDefaultMacMode(); - cmStdString CMakePathName; + std::string CMakePathName; RootPathMode FindRootPathMode; bool CheckCommonArgument(std::string const& arg); @@ -81,7 +81,7 @@ protected: std::vector UserPaths; std::vector UserHints; std::vector SearchPaths; - std::set SearchPathsEmitted; + std::set SearchPathsEmitted; bool SearchFrameworkFirst; bool SearchFrameworkOnly; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index de52df7a0..9345d157e 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -368,8 +368,8 @@ bool cmFindLibraryHelper::CheckDirectoryForName(std::string const& path, // Search for a file matching the library name regex. std::string dir = path; cmSystemTools::ConvertToUnixSlashes(dir); - std::set const& files = this->GG->GetDirectoryContent(dir); - for(std::set::const_iterator fi = files.begin(); + std::set const& files = this->GG->GetDirectoryContent(dir); + for(std::set::const_iterator fi = files.begin(); fi != files.end(); ++fi) { std::string const& origName = *fi; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index d557fba4a..7a4e7f453 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -553,7 +553,7 @@ void cmFindPackageCommand::AddFindDefinition(const std::string& var, //---------------------------------------------------------------------------- void cmFindPackageCommand::RestoreFindDefinitions() { - for(std::map::iterator + for(std::map::iterator i = this->OriginalDefs.begin(); i != this->OriginalDefs.end(); ++i) { OriginalDef const& od = i->second; diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 9819d4f54..72c1e3c9e 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -96,19 +96,19 @@ private: friend class cmFindPackageFileList; struct OriginalDef { bool exists; std::string value; }; - std::map OriginalDefs; + std::map OriginalDefs; - cmStdString Name; - cmStdString Variable; - cmStdString Version; + std::string Name; + std::string Variable; + std::string Version; unsigned int VersionMajor; unsigned int VersionMinor; unsigned int VersionPatch; unsigned int VersionTweak; unsigned int VersionCount; bool VersionExact; - cmStdString FileFound; - cmStdString VersionFound; + std::string FileFound; + std::string VersionFound; unsigned int VersionFoundMajor; unsigned int VersionFoundMinor; unsigned int VersionFoundPatch; diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 845999575..caaf1d3b2 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -89,9 +89,9 @@ std::string cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::string const& dir) { - cmStdString fileName = file; - cmStdString frameWorkName; - cmStdString::size_type pos = fileName.find("/"); + std::string fileName = file; + std::string frameWorkName; + std::string::size_type pos = fileName.find("/"); // if there is a / in the name try to find the header as a framework // For example bar/foo.h would look for: // bar.framework/Headers/foo.h @@ -128,7 +128,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, } // if it is not found yet or not a framework header, then do a glob search // for all frameworks in the directory: dir/*.framework/Headers/ - cmStdString glob = dir; + std::string glob = dir; glob += "*.framework/Headers/"; glob += file; cmsys::Glob globIt; @@ -136,7 +136,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file, std::vector files = globIt.GetFiles(); if(files.size()) { - cmStdString fheader = cmSystemTools::CollapseFullPath(files[0].c_str()); + std::string fheader = cmSystemTools::CollapseFullPath(files[0].c_str()); if(this->IncludeFileInPath) { return fheader; diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index cd3054614..3ebb1b600 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -97,7 +97,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( { this->Output += (*it)->Evaluate(&context, dagChecker); - for(std::set::const_iterator + for(std::set::const_iterator p = context.SeenTargetProperties.begin(); p != context.SeenTargetProperties.end(); ++p) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 4992e9379..58abf1407 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -92,7 +92,7 @@ public: std::set const& GetTargets() const { return this->DependTargets; } - std::set const& GetSeenTargetProperties() const + std::set const& GetSeenTargetProperties() const { return this->SeenTargetProperties; } std::set const& GetAllTargetsSeen() const @@ -130,7 +130,7 @@ private: mutable std::set DependTargets; mutable std::set AllTargetsSeen; - mutable std::set SeenTargetProperties; + mutable std::set SeenTargetProperties; mutable std::string Output; mutable bool HadContextSensitiveCondition; }; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index e7e1d34c8..04f36b473 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -42,12 +42,12 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker( ) #undef TEST_TRANSITIVE_PROPERTY_METHOD { - std::map >::const_iterator it + std::map >::const_iterator it = top->Seen.find(target); if (it != top->Seen.end()) { - const std::set &propSet = it->second; - const std::set::const_iterator i = propSet.find(property); + const std::set &propSet = it->second; + const std::set::const_iterator i = propSet.find(property); if (i != propSet.end()) { this->CheckResult = ALREADY_SEEN; diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index b6effa185..6cbbd2a07 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -77,7 +77,7 @@ private: const cmGeneratorExpressionDAGChecker * const Parent; const std::string Target; const std::string Property; - std::map > Seen; + std::map > Seen; const GeneratorExpressionContent * const Content; const cmListFileBacktrace Backtrace; Result CheckResult; diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 49e52df77..0c8a9cf59 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -25,7 +25,7 @@ struct cmGeneratorExpressionContext cmListFileBacktrace Backtrace; std::set DependTargets; std::set AllTargets; - std::set SeenTargetProperties; + std::set SeenTargetProperties; cmMakefile *Makefile; const char *Config; cmTarget const* HeadTarget; // The target whose property is being evaluated. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 7f22e0053..a7b2efa0a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -422,7 +422,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, = this->Target->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED"); std::vector result; - for (std::set::const_iterator + for (std::set::const_iterator it = this->Target->GetSystemIncludeDirectories().begin(); it != this->Target->GetSystemIncludeDirectories().end(); ++it) { @@ -462,7 +462,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, } } } - std::set unique; + std::set unique; for(std::vector::iterator li = result.begin(); li != result.end(); ++li) { @@ -470,7 +470,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, unique.insert(*li); } result.clear(); - for(std::set::iterator li = unique.begin(); + for(std::set::iterator li = unique.begin(); li != unique.end(); ++li) { result.push_back(*li); @@ -594,7 +594,7 @@ private: SourceEntry* CurrentEntry; std::queue SourceQueue; std::set SourcesQueued; - typedef std::map NameMapType; + typedef std::map NameMapType; NameMapType NameMap; void QueueSource(cmSourceFile* sf); diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index e7ad91a36..5aaf1c63c 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -49,10 +49,10 @@ bool cmGetCMakePropertyCommand } else if ( args[1] == "COMPONENTS" ) { - const std::set* components + const std::set* components = this->Makefile->GetLocalGenerator()->GetGlobalGenerator() ->GetInstallComponents(); - std::set::const_iterator compIt; + std::set::const_iterator compIt; output = ""; for (compIt = components->begin(); compIt != components->end(); ++compIt) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ba4cce8eb..9748c6147 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -432,8 +432,8 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMakeSystem.cmake"; mf->ReadListFile(0,fpath.c_str()); } - std::map needTestLanguage; - std::map needSetLanguageEnabledMaps; + std::map needTestLanguage; + std::map needSetLanguageEnabledMaps; // foreach language // load the CMakeDetermine(LANG)Compiler.cmake file to find // the compiler @@ -823,7 +823,7 @@ cmGlobalGenerator::GetLanguageOutputExtension(cmSourceFile const& source) const const std::string& lang = source.GetLanguage(); if(!lang.empty()) { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToOutputExtension.find(lang); if(it != this->LanguageToOutputExtension.end()) @@ -857,7 +857,7 @@ std::string cmGlobalGenerator::GetLanguageFromExtension(const char* ext) const { ++ext; } - std::map::const_iterator it + std::map::const_iterator it = this->ExtensionToLanguage.find(ext); if(it != this->ExtensionToLanguage.end()) { @@ -1011,7 +1011,7 @@ bool cmGlobalGenerator::IsDependedOn(const std::string& project, cmTarget const* targetIn) { // Get all local gens for this project - std::map >::const_iterator it = + std::map >::const_iterator it = this->ProjectMap.find(project); if (it == this->ProjectMap.end()) { @@ -1516,8 +1516,8 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const void cmGlobalGenerator::CheckLocalGenerators() { - std::map notFoundMap; -// std::set notFoundMap; + std::map notFoundMap; +// std::set notFoundMap; // after it is all done do a ConfigureFinalPass cmCacheManager* manager = 0; for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) @@ -1597,7 +1597,7 @@ void cmGlobalGenerator::CheckLocalGenerators() if(notFoundMap.size()) { std::string notFoundVars; - for(std::map::const_iterator + for(std::map::const_iterator ii = notFoundMap.begin(); ii != notFoundMap.end(); ++ii) @@ -1956,7 +1956,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, void cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const { - for(std::map::const_iterator i = + for(std::map::const_iterator i = this->LanguageEnabled.begin(); i != this->LanguageEnabled.end(); ++i) { lang.push_back(i->first); @@ -1965,7 +1965,7 @@ cmGlobalGenerator::GetEnabledLanguages(std::vector& lang) const int cmGlobalGenerator::GetLinkerPreference(const std::string& lang) const { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToLinkerPreference.find(lang); if (it != this->LanguageToLinkerPreference.end()) { @@ -2075,14 +2075,14 @@ cmGlobalGenerator::FindTarget(const std::string& name, { if (!excludeAliases) { - std::map::const_iterator ai + std::map::const_iterator ai = this->AliasTargets.find(name); if (ai != this->AliasTargets.end()) { return ai->second; } } - std::map::const_iterator i = + std::map::const_iterator i = this->TotalTargets.find ( name ); if ( i != this->TotalTargets.end() ) { @@ -2294,7 +2294,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { if(!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.') { - std::set* componentsSet = &this->InstallComponents; + std::set* componentsSet = &this->InstallComponents; cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end()); depends.erase(depends.begin(), depends.end()); @@ -2302,7 +2302,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) if ( componentsSet->size() > 0 ) { ostr << "Available install components are:"; - std::set::iterator it; + std::set::iterator it; for ( it = componentsSet->begin(); it != componentsSet->end(); @@ -2516,7 +2516,7 @@ cmGlobalGenerator::GenerateRuleFile(std::string const& output) const std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( std::string const& l) const { - std::map::const_iterator it = + std::map::const_iterator it = this->LanguageToOriginalSharedLibFlags.find(l); if(it != this->LanguageToOriginalSharedLibFlags.end()) { @@ -2690,7 +2690,7 @@ void cmGlobalGenerator::AddToManifest(const char* config, } //---------------------------------------------------------------------------- -std::set const& +std::set const& cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk) { DirectoryContent& dc = this->DirectoryContentMap[dir]; @@ -2796,7 +2796,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, fname = line.substr(33, line.npos); // Look for a hash for this file's rule. - std::map::const_iterator rhi = + std::map::const_iterator rhi = this->RuleHashes.find(fname); if(rhi != this->RuleHashes.end()) { @@ -2841,7 +2841,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) { cmGeneratedFileStream fout(pfile.c_str()); fout << "# Hashes of file build rules.\n"; - for(std::map::const_iterator + for(std::map::const_iterator rhi = this->RuleHashes.begin(); rhi != this->RuleHashes.end(); ++rhi) { fout.write(rhi->second.Data, 32); @@ -2862,7 +2862,7 @@ void cmGlobalGenerator::WriteSummary() cmGeneratedFileStream fout(fname.c_str()); // Generate summary information files for each target. - for(std::map::const_iterator ti = + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { if ((ti->second)->GetType() == cmTarget::INTERFACE_LIBRARY) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 746f715de..f06162c84 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -167,7 +167,7 @@ public: void AddInstallComponent(const char* component); - const std::set* GetInstallComponents() const + const std::set* GetInstallComponents() const { return &this->InstallComponents; } cmExportSetMap& GetExportSets() {return this->ExportSets;} @@ -244,7 +244,7 @@ public: from disk at most once and cached. During the generation step the content will include the target files to be built even if they do not yet exist. */ - std::set const& GetDirectoryContent(std::string const& dir, + std::set const& GetDirectoryContent(std::string const& dir, bool needDisk = true); void AddTarget(cmTarget* t); @@ -276,7 +276,7 @@ public: /** Get per-target generator information. */ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; - const std::map >& GetProjectMap() + const std::map >& GetProjectMap() const {return this->ProjectMap;} // track files replaced during a Generate @@ -364,18 +364,18 @@ protected: bool UseLinkScript; bool ForceUnixPaths; bool ToolSupportsColor; - cmStdString FindMakeProgramFile; - cmStdString ConfiguredFilesPath; + std::string FindMakeProgramFile; + std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector LocalGenerators; cmLocalGenerator* CurrentLocalGenerator; // map from project name to vector of local generators in that project - std::map > ProjectMap; + std::map > ProjectMap; std::map > LocalGeneratorToTargetMap; // Set of named installation components requested by the project. - std::set InstallComponents; + std::set InstallComponents; bool InstallTargetEnabled; // Sets of named target exports cmExportSetMap ExportSets; @@ -387,9 +387,9 @@ protected: cmTargetManifest TargetManifest; // All targets in the entire project. - std::map TotalTargets; - std::map AliasTargets; - std::map ImportedTargets; + std::map TotalTargets; + std::map AliasTargets; + std::map ImportedTargets; std::vector EvaluationFiles; virtual const char* GetPredefinedTargetsFolder(); @@ -401,18 +401,18 @@ private: float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator - std::map IgnoreExtensions; - std::map LanguageEnabled; - std::set LanguagesReady; // Ready for try_compile - std::map OutputExtensions; - std::map LanguageToOutputExtension; - std::map ExtensionToLanguage; - std::map LanguageToLinkerPreference; - std::map LanguageToOriginalSharedLibFlags; + std::map IgnoreExtensions; + std::map LanguageEnabled; + std::set LanguagesReady; // Ready for try_compile + std::map OutputExtensions; + std::map LanguageToOutputExtension; + std::map ExtensionToLanguage; + std::map LanguageToLinkerPreference; + std::map LanguageToOriginalSharedLibFlags; // Record hashes for rules and outputs. struct RuleHash { char Data[32]; }; - std::map RuleHashes; + std::map RuleHashes; void CheckRuleHashes(); void CheckRuleHashes(std::string const& pfile, std::string const& home); void WriteRuleHashes(std::string const& pfile); @@ -448,18 +448,18 @@ private: virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; } // Cache directory content and target files to be built. - struct DirectoryContent: public std::set + struct DirectoryContent: public std::set { - typedef std::set derived; + typedef std::set derived; bool LoadedFromDisk; DirectoryContent(): LoadedFromDisk(false) {} DirectoryContent(DirectoryContent const& dc): derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {} }; - std::map DirectoryContentMap; + std::map DirectoryContentMap; // Set of binary directories on disk. - std::set BinaryDirectories; + std::set BinaryDirectories; // track targets to issue CMP0042 warning for. std::set CMP0042WarnTargets; diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index ed0e15ba9..25df953d5 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -44,7 +44,7 @@ void cmGlobalKdevelopGenerator::Generate() { // for each sub project in the project create // a kdevelop project - for (std::map >::const_iterator + for (std::map >::const_iterator it = this->GlobalGenerator->GetProjectMap().begin(); it!= this->GlobalGenerator->GetProjectMap().end(); ++it) @@ -103,7 +103,7 @@ bool cmGlobalKdevelopGenerator std::string projectDir = projectDirIn + "/"; std::string filename = outputDir+ "/" + projectname +".kdevelop.filelist"; - std::set files; + std::set files; std::string tmp; for (std::vector::const_iterator it=lgs.begin(); @@ -217,7 +217,7 @@ bool cmGlobalKdevelopGenerator } fileToOpen=""; - for (std::set::const_iterator it=files.begin(); + for (std::set::const_iterator it=files.begin(); it!=files.end(); it++) { // get the full path to the file diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 954fb1708..977b3a1c8 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -886,7 +886,7 @@ cmGlobalNinjaGenerator if (target->GetType() == cmTarget::GLOBAL_TARGET) { // Global targets only depend on other utilities, which may not appear in // the TargetDepends set (e.g. "all"). - std::set const& utils = target->GetUtilities(); + std::set const& utils = target->GetUtilities(); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); } else { cmTargetDependSet const& targetDeps = diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 735887e08..a392aa6fd 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -624,7 +624,7 @@ void cmGlobalUnixMakefileGenerator3 void cmGlobalUnixMakefileGenerator3 ::WriteConvenienceRules(std::ostream& ruleFileStream, - std::set &emitted) + std::set &emitted) { std::vector depends; std::vector commands; @@ -1049,7 +1049,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule lg->AppendEcho(commands,"... depend"); // Keep track of targets already listed. - std::set emittedTargets; + std::set emittedTargets; // for each local generator unsigned int i; @@ -1084,8 +1084,8 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } - std::vector const& localHelp = lg->GetLocalHelp(); - for(std::vector::const_iterator o = localHelp.begin(); + std::vector const& localHelp = lg->GetLocalHelp(); + for(std::vector::const_iterator o = localHelp.begin(); o != localHelp.end(); ++o) { path = "... "; @@ -1102,9 +1102,9 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule bool cmGlobalUnixMakefileGenerator3 ::NeedRequiresStep(cmTarget const& target) { - std::set languages; + std::set languages; target.GetLanguages(languages); - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { std::string var = "CMAKE_NEEDS_REQUIRES_STEP_"; diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index ffdf6fb34..b61619d41 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -96,7 +96,7 @@ public: // write the top level target rules void WriteConvenienceRules(std::ostream& ruleFileStream, - std::set &emitted); + std::set &emitted); /** Get the command to use for a target that has no rule. This is used for multiple output dependencies and for cmake_force. */ diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 214b9eaa3..a7f65872b 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator // output the DSW file void cmGlobalVisualStudio6Generator::OutputDSWFile() { - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { this->OutputDSWFile(it->second[0], it->second); @@ -318,7 +318,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, const std::string& name, const char* location, - const std::set& dependencies) + const std::set& dependencies) { fout << "#########################################################" "######################\n\n"; @@ -329,7 +329,7 @@ void cmGlobalVisualStudio6Generator::WriteExternalProject(std::ostream& fout, fout << "{{{\n"; - std::set::const_iterator i, end; + std::set::const_iterator i, end; // write dependencies. i = dependencies.begin(); end = dependencies.end(); diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index f1c70e468..3665f7b78 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -103,7 +103,7 @@ private: cmTarget const& t); void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, - const std::set& dependencies); + const std::set& dependencies); void WriteDSWFooter(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget const* target); std::string MSDevCommand; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index af1a5c57b..08bcc5b71 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -237,7 +237,7 @@ void cmGlobalVisualStudio71Generator const std::string& name, const char* location, const char* typeGuid, - const std::set& depends) + const std::set& depends) { fout << "Project(\"{" << (typeGuid ? typeGuid : this->ExternalProjectType(location)) @@ -252,7 +252,7 @@ void cmGlobalVisualStudio71Generator if(!depends.empty()) { fout << "\tProjectSection(ProjectDependencies) = postProject\n"; - std::set::const_iterator it; + std::set::const_iterator it; for(it = depends.begin(); it != depends.end(); ++it) { if(it->size() > 0) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 879146812..75cc6aeb9 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -72,7 +72,7 @@ protected: const std::string& name, const char* path, const char* typeGuid, - const std::set& depends); + const std::set& depends); virtual void WriteSLNHeader(std::ostream& fout); std::string ProjectConfigurationSectionName; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index cf84fe396..2a97edc80 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -353,7 +353,7 @@ void cmGlobalVisualStudio7Generator // output the SLN file void cmGlobalVisualStudio7Generator::OutputSLNFile() { - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { this->OutputSLNFile(it->second[0], it->second); @@ -761,7 +761,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, const std::string& name, const char* location, const char* typeGuid, - const std::set&) + const std::set&) { std::string d = cmSystemTools::ConvertToOutputPath(location); fout << "Project(" diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 6fb373102..2e58f6c15 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -156,7 +156,7 @@ protected: const std::string& name, const char* path, const char* typeGuid, - const std::set& + const std::set& dependencies); std::string ConvertToSolutionPath(const char* path); @@ -164,7 +164,7 @@ protected: std::set IsPartOfDefaultBuild(const std::string& project, cmTarget const* target); std::vector Configurations; - std::map GUIDMap; + std::map GUIDMap; virtual void WriteFolders(std::ostream& fout); virtual void WriteFoldersContent(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 51825ee83..2ae1bbc17 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -338,7 +338,7 @@ void cmGlobalVisualStudio8Generator::Generate() if(this->AddCheckTarget()) { // All targets depend on the build-system check target. - for(std::map::const_iterator + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { @@ -436,7 +436,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( cmTarget& target) { // Look for utility dependencies that magically link. - for(std::set::const_iterator ui = + for(std::set::const_iterator ui = target.GetUtilities().begin(); ui != target.GetUtilities().end(); ++ui) { diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d388034e3..b2a705ecc 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -53,7 +53,7 @@ void cmGlobalVisualStudioGenerator::Generate() const char* no_working_dir = 0; std::vector no_depends; cmCustomCommandLines no_commands; - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { std::vector& gen = it->second; @@ -128,7 +128,7 @@ cmGlobalVisualStudioGenerator // Count the number of object files with each name. Note that // windows file names are not case sensitive. - std::map counts; + std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); for(std::vector::const_iterator @@ -380,7 +380,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() { return false; } - std::map >::iterator it; + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { std::vector& gen = it->second; @@ -852,7 +852,7 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) { // check to see if this is a fortran build - std::set languages; + std::set languages; target.GetLanguages(languages); if(languages.size() == 1) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index b1fa838b5..dc0f9c71e 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -99,7 +99,7 @@ protected: virtual void AddPlatformDefinitions(cmMakefile* mf); virtual bool ComputeTargetDepends(); - class VSDependSet: public std::set {}; + class VSDependSet: public std::set {}; class VSDependMap: public std::map {}; VSDependMap VSTargetDepends; void ComputeVSTargetDepends(cmTarget&); @@ -108,7 +108,7 @@ protected: std::string GetUtilityForTarget(cmTarget& target, const std::string&); virtual std::string WriteUtilityDepend(cmTarget const*) = 0; std::string GetUtilityDepend(cmTarget const* target); - typedef std::map UtilityDependsMap; + typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; const char* AdditionalPlatformDefinition; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index a1255a065..08e9adf43 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -337,7 +337,7 @@ cmLocalGenerator *cmGlobalXCodeGenerator::CreateLocalGenerator() //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::Generate() { - std::map >::iterator it; + std::map >::iterator it; // make sure extra targets are added before calling // the parent generate which will call trace depends for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) @@ -570,7 +570,7 @@ void cmGlobalXCodeGenerator::addObject(cmXCodeObject *obj) { if(obj->GetType() == cmXCodeObject::OBJECT) { - cmStdString id = obj->GetId(); + std::string id = obj->GetId(); // If this is a duplicate id, it's an error: // @@ -631,17 +631,17 @@ cmXCodeObject* cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- -cmStdString +std::string GetGroupMapKeyFromPath(cmTarget& cmtarget, const std::string& fullpath) { - cmStdString key(cmtarget.GetName()); + std::string key(cmtarget.GetName()); key += "-"; key += fullpath; return key; } //---------------------------------------------------------------------------- -cmStdString +std::string GetGroupMapKey(cmTarget& cmtarget, cmSourceFile* sf) { return GetGroupMapKeyFromPath(cmtarget, sf->GetFullPath()); @@ -844,7 +844,7 @@ cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath( fileRef->SetComment(fname.c_str()); this->FileRefs[fname] = fileRef; } - cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath); + std::string key = GetGroupMapKeyFromPath(cmtarget, fullpath); cmXCodeObject* group = this->GroupMap[key]; cmXCodeObject* children = group->GetObject("children"); if (!children->HasObject(fileRef)) @@ -1127,7 +1127,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, std::vector contentBuildPhases; if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map > + typedef std::map > mapOfVectorOfSourceFiles; mapOfVectorOfSourceFiles bundleFiles; for(std::vector::const_iterator i = classes.begin(); @@ -1216,7 +1216,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, void cmGlobalXCodeGenerator::ForceLinkerLanguages() { // This makes sure all targets link using the proper language. - for(std::map::const_iterator + for(std::map::const_iterator ti = this->TotalTargets.begin(); ti != this->TotalTargets.end(); ++ti) { this->ForceLinkerLanguage(*ti->second); @@ -1477,7 +1477,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, // collect multiple outputs of custom commands into a set // which will be used for every configuration - std::map multipleOutputPairs; + std::map multipleOutputPairs; for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { @@ -1548,8 +1548,8 @@ void cmGlobalXCodeGenerator std::vector const & commands, const char* configName, - const std::map& multipleOutputPairs + const std::map& multipleOutputPairs ) { std::string makefileName=makefileBasename; @@ -1571,7 +1571,7 @@ void cmGlobalXCodeGenerator // have all depend on all outputs makefileStream << "all: "; - std::map tname; + std::map tname; int count = 0; for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) @@ -1669,7 +1669,7 @@ void cmGlobalXCodeGenerator makefileStream << "\n# Dependencies of multiple outputs to their primary outputs \n"; - for(std::map::const_iterator o = + for(std::map::const_iterator o = multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o) { makefileStream << o->first << ": " << o->second << "\n"; @@ -1678,7 +1678,7 @@ void cmGlobalXCodeGenerator makefileStream << "\n" "cmake_check_multiple_outputs:\n"; - for(std::map::const_iterator o = + for(std::map::const_iterator o = multipleOutputPairs.begin(); o != multipleOutputPairs.end(); ++o) { makefileStream << "\t@if [ ! -f " @@ -2088,7 +2088,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, std::vector includes; this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", configName); - std::set emitted; + std::set emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) @@ -2357,18 +2357,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, { if(i->first.find("XCODE_ATTRIBUTE_") == 0) { - cmStdString attribute = i->first.substr(16); + std::string attribute = i->first.substr(16); // Handle [variant=] condition explicitly here. - cmStdString::size_type beginVariant = + std::string::size_type beginVariant = attribute.find("[variant="); - if (beginVariant != cmStdString::npos) + if (beginVariant != std::string::npos) { - cmStdString::size_type endVariant = + std::string::size_type endVariant = attribute.find("]", beginVariant+9); - if (endVariant != cmStdString::npos) + if (endVariant != std::string::npos) { // Compare the variant to the configuration. - cmStdString variant = + std::string variant = attribute.substr(beginVariant+9, endVariant-beginVariant-9); if (variant == configName) { @@ -2969,7 +2969,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, mf->FindSourceGroup(source.c_str(), sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, sourceGroup); - cmStdString key = GetGroupMapKey(cmtarget, sf); + std::string key = GetGroupMapKey(cmtarget, sf); this->GroupMap[key] = pbxgroup; } @@ -2984,7 +2984,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, mf->FindSourceGroup(source.c_str(), sourceGroups); cmXCodeObject* pbxgroup = this->CreateOrGetPBXGroup(cmtarget, sourceGroup); - cmStdString key = GetGroupMapKeyFromPath(cmtarget, source); + std::string key = GetGroupMapKeyFromPath(cmtarget, source); this->GroupMap[key] = pbxgroup; } } @@ -2992,7 +2992,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, } cmXCodeObject *cmGlobalXCodeGenerator -::CreatePBXGroup(cmXCodeObject *parent, cmStdString name) +::CreatePBXGroup(cmXCodeObject *parent, std::string name) { cmXCodeObject* parentChildren = NULL; if(parent) @@ -3016,8 +3016,8 @@ cmXCodeObject *cmGlobalXCodeGenerator cmXCodeObject* cmGlobalXCodeGenerator ::CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg) { - cmStdString s; - cmStdString target; + std::string s; + std::string target; const char *targetFolder= cmtarget.GetProperty("FOLDER"); if(targetFolder) { target = targetFolder; @@ -3026,7 +3026,7 @@ cmXCodeObject* cmGlobalXCodeGenerator target += cmtarget.GetName(); s = target + "/"; s += sg->GetFullName(); - std::map::iterator it = + std::map::iterator it = this->GroupNameMap.find(s); if(it != this->GroupNameMap.end()) { @@ -3043,7 +3043,7 @@ cmXCodeObject* cmGlobalXCodeGenerator { std::vector tgt_folders = cmSystemTools::tokenize(target, "/"); - cmStdString curr_tgt_folder; + std::string curr_tgt_folder; for(std::vector::size_type i = 0; i < tgt_folders.size();i++) { if (i != 0) @@ -3070,7 +3070,7 @@ cmXCodeObject* cmGlobalXCodeGenerator // If it's the default source group (empty name) then put the source file // directly in the tgroup... // - if (cmStdString(sg->GetFullName()) == "") + if (std::string(sg->GetFullName()) == "") { this->GroupNameMap[s] = tgroup; return tgroup; @@ -3081,12 +3081,12 @@ cmXCodeObject* cmGlobalXCodeGenerator { std::vector folders = cmSystemTools::tokenize(sg->GetFullName(), "\\"); - cmStdString curr_folder = target; + std::string curr_folder = target; curr_folder += "/"; for(std::vector::size_type i = 0; i < folders.size();i++) { curr_folder += folders[i]; - std::map::iterator i_folder = + std::map::iterator i_folder = this->GroupNameMap.find(curr_folder); //Create new folder if(i_folder == this->GroupNameMap.end()) @@ -3466,14 +3466,14 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << "# For each target create a dummy rule " "so the target does not have to exist\n"; - std::set emitted; + std::set emitted; for(std::vector::iterator i = targets.begin(); i != targets.end(); ++i) { cmXCodeObject* target = *i; - std::map const& deplibs = + std::map const& deplibs = target->GetDependLibraries(); - for(std::map::const_iterator ci + for(std::map::const_iterator ci = deplibs.begin(); ci != deplibs.end(); ++ci) { for(cmXCodeObject::StringVec::const_iterator d = ci->second.begin(); @@ -3529,12 +3529,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::string trel = this->ConvertToRelativeForMake(tfull.c_str()); // Add this target to the post-build phases of its dependencies. - std::map::const_iterator + std::map::const_iterator y = target->GetDependTargets().find(*ct); if(y != target->GetDependTargets().end()) { - std::vector const& deptgts = y->second; - for(std::vector::const_iterator d = deptgts.begin(); + std::vector const& deptgts = y->second; + for(std::vector::const_iterator d = deptgts.begin(); d != deptgts.end(); ++d) { makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": " @@ -3546,12 +3546,12 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( makefileStream << trel << ":"; // List dependencies if any exist. - std::map::const_iterator + std::map::const_iterator x = target->GetDependLibraries().find(*ct); if(x != target->GetDependLibraries().end()) { - std::vector const& deplibs = x->second; - for(std::vector::const_iterator d = deplibs.begin(); + std::vector const& deplibs = x->second; + for(std::vector::const_iterator d = deplibs.begin(); d != deplibs.end(); ++d) { makefileStream << "\\\n\t" << @@ -3960,7 +3960,7 @@ cmGlobalXCodeGenerator // names since Xcode names them uniquely automatically with a numeric suffix // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. - std::map counts; + std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); for(std::vector::const_iterator diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 8e2de9a75..d2dd491f3 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -95,7 +95,7 @@ private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmSourceGroup* sg); cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent, - cmStdString name); + std::string name); void CreateGroups(cmLocalGenerator* root, std::vector& generators); @@ -124,7 +124,7 @@ private: cmTarget& target, std::vector const & commands, const char* configName, - const std::map& + const std::map& multipleOutputPairs ); @@ -211,7 +211,7 @@ protected: unsigned int XcodeVersion; std::string VersionString; - std::set XCodeObjectIDs; + std::set XCodeObjectIDs; std::vector XCodeObjects; cmXCodeObject* RootObject; private: @@ -236,14 +236,14 @@ private: std::string CurrentReRunCMakeMakefile; std::string CurrentXCodeHackMakefile; std::string CurrentProject; - std::set TargetDoneSet; + std::set TargetDoneSet; std::vector CurrentOutputDirectoryComponents; std::vector ProjectSourceDirectoryComponents; std::vector ProjectOutputDirectoryComponents; - std::map GroupMap; - std::map GroupNameMap; - std::map TargetGroup; - std::map FileRefs; + std::map GroupMap; + std::map GroupNameMap; + std::map TargetGroup; + std::map FileRefs; std::vector Architectures; std::string PlatformToolset; }; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 6173d219a..22cba899b 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -121,7 +121,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, __set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET"); __set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS"); - cmStdString ignoreTargetsRegexes; + std::string ignoreTargetsRegexes; __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); this->TargetsToIgnoreRegex.clear(); @@ -135,7 +135,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, itvIt != ignoreTargetsRegExVector.end(); ++ itvIt ) { - cmStdString currentRegexString(*itvIt); + std::string currentRegexString(*itvIt); cmsys::RegularExpression currentRegex; if (!currentRegex.compile(currentRegexString.c_str())) { @@ -160,7 +160,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) this->CollectTargetsAndLibs(); - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -211,7 +211,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) this->CollectTargetsAndLibs(); - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -265,7 +265,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) std::set insertedConnections; std::set insertedNodes; - for(std::map::const_iterator ptrIt = + for(std::map::const_iterator ptrIt = this->TargetPtrs.begin(); ptrIt != this->TargetPtrs.end(); ++ptrIt) @@ -305,7 +305,7 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, std::set& insertedConnections, cmGeneratedFileStream& str) const { - std::map::const_iterator targetPtrIt = + std::map::const_iterator targetPtrIt = this->TargetPtrs.find(targetName); if (targetPtrIt == this->TargetPtrs.end()) // not found at all @@ -331,7 +331,7 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, ++ llit ) { const char* libName = llit->first.c_str(); - std::map::const_iterator libNameIt = + std::map::const_iterator libNameIt = this->TargetNamesNodes.find(libName); // can happen e.g. if GRAPHVIZ_TARGET_IGNORE_REGEX is used @@ -364,7 +364,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::set& insertedConnections, cmGeneratedFileStream& str) const { - std::map::const_iterator targetPtrIt = + std::map::const_iterator targetPtrIt = this->TargetPtrs.find(targetName); if (targetPtrIt == this->TargetPtrs.end()) // not found at all @@ -383,7 +383,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; // now search who links against me - for(std::map::const_iterator dependerIt = + for(std::map::const_iterator dependerIt = this->TargetPtrs.begin(); dependerIt != this->TargetPtrs.end(); ++dependerIt) @@ -411,7 +411,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, if (libName == targetName) { // So this target links against targetName. - std::map::const_iterator dependerNodeNameIt = + std::map::const_iterator dependerNodeNameIt = this->TargetNamesNodes.find(dependerIt->first); if(dependerNodeNameIt != this->TargetNamesNodes.end()) @@ -452,7 +452,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName, if (insertedNodes.find(targetName) == insertedNodes.end()) { insertedNodes.insert(targetName); - std::map::const_iterator nameIt = + std::map::const_iterator nameIt = this->TargetNamesNodes.find(targetName); str << " \"" << nameIt->second.c_str() << "\" [ label=\"" @@ -540,7 +540,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) continue; } - std::map::const_iterator tarIt = + std::map::const_iterator tarIt = this->TargetPtrs.find(libName); if ( tarIt == this->TargetPtrs.end() ) { diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 6af460b73..a7acd0e54 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -64,10 +64,10 @@ protected: bool GenerateForTargetType(cmTarget::TargetType targetType) const; - cmStdString GraphType; - cmStdString GraphName; - cmStdString GraphHeader; - cmStdString GraphNodePrefix; + std::string GraphType; + std::string GraphName; + std::string GraphHeader; + std::string GraphNodePrefix; bool GenerateForExecutables; bool GenerateForStaticLibs; @@ -81,9 +81,9 @@ protected: const std::vector& LocalGenerators; - std::map TargetPtrs; + std::map TargetPtrs; // maps from the actual target names to node names in dot: - std::map TargetNamesNodes; + std::map TargetNamesNodes; bool HaveTargetsAndLibs; }; diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index 34a9c7c78..e03223f76 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -108,7 +108,7 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table, { const char *new_value = flag+1+n; - std::map::iterator itr; + std::map::iterator itr; itr = this->FlagMap.find(entry->IDEName); if(itr != this->FlagMap.end()) { @@ -186,7 +186,7 @@ void cmIDEOptions::RemoveFlag(const char* flag) //---------------------------------------------------------------------------- const char* cmIDEOptions::GetFlag(const char* flag) { - std::map::iterator i = this->FlagMap.find(flag); + std::map::iterator i = this->FlagMap.find(flag); if(i != this->FlagMap.end()) { return i->second.c_str(); diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index e78af3ee4..691893f6d 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -40,13 +40,13 @@ protected: // Then parse the command line flags specified in CMAKE_CXX_FLAGS // and CMAKE_C_FLAGS // and overwrite or add new values to this map - std::map FlagMap; + std::map FlagMap; // Preprocessor definitions. std::vector Defines; // Unrecognized flags that get no special handling. - cmStdString FlagString; + std::string FlagString; bool DoingDefine; bool AllowDefine; diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index e20fe022d..df5508e5d 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -38,7 +38,7 @@ bool cmIncludeDirectoryCommand std::vector beforeIncludes; std::vector afterIncludes; - std::set systemIncludes; + std::set systemIncludes; for(; i != args.end(); ++i) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 0878aae59..94d20913f 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -97,7 +97,7 @@ bool cmInstallCommand::InitialPass(std::vector const& args, } // Unknown mode. - cmStdString e = "called with unknown mode "; + std::string e = "called with unknown mode "; e += args[0]; this->SetError(e.c_str()); return false; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 1287ea659..045cff649 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -177,7 +177,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, // Now create a configuration-specific install rule for the import // file of each configuration. std::vector files; - for(std::map::const_iterator + for(std::map::const_iterator i = this->EFGen->GetConfigImportFiles().begin(); i != this->EFGen->GetConfigImportFiles().end(); ++i) { diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 7a39f457d..5df6e4bcd 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -513,7 +513,7 @@ cmInstallTargetGenerator // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. - std::map install_name_remap; + std::map install_name_remap; if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) { std::set const& sharedLibs @@ -590,7 +590,7 @@ cmInstallTargetGenerator { os << "\n" << indent << " -id \"" << new_id << "\""; } - for(std::map::const_iterator + for(std::map::const_iterator i = install_name_remap.begin(); i != install_name_remap.end(); ++i) { diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index dfd98fa5f..806d8212f 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -33,7 +33,7 @@ bool cmLoadCacheCommand // and they can not be overridden. bool excludeFiles=false; unsigned int i; - std::set excludes; + std::set excludes; for(i=0; i includes; + std::set includes; for(i=0; i VariablesToRead; + std::set VariablesToRead; std::string Prefix; bool ReadWithPrefix(std::vector const& args); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 75f2130a5..e36266a7f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -617,8 +617,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector::iterator a = cmd.begin(); + std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); + for(std::vector::iterator a = cmd.begin(); a != cmd.end(); ++a) { commandLine.push_back(*a); @@ -656,7 +656,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmGeneratorTarget& target) { - cmStdString objs; + std::string objs; std::vector objVector; // Add all the sources outputs to the depends of the target std::vector classes; @@ -728,8 +728,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->ExpandRuleVariables(*i, vars); // Parse the string to get the custom command line. cmCustomCommandLine commandLine; - std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector::iterator a = cmd.begin(); + std::vector cmd = cmSystemTools::ParseArguments(i->c_str()); + for(std::vector::iterator a = cmd.begin(); a != cmd.end(); ++a) { commandLine.push_back(*a); @@ -758,7 +758,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, void cmLocalGenerator -::CreateCustomTargetsAndCommands(std::set const& lang) +::CreateCustomTargetsAndCommands(std::set const& lang) { cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); for(cmGeneratorTargetsType::iterator l = tgts.begin(); @@ -1344,7 +1344,7 @@ std::string cmLocalGenerator::GetIncludeFlags( this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); bool flagUsed = false; - std::set emitted; + std::set emitted; #ifdef __APPLE__ emitted.insert("/System/Library/Frameworks"); #endif @@ -1488,7 +1488,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, } // Do not repeat an include path. - std::set emitted; + std::set emitted; // Store the automatic include paths. if(includeBinaryDir) @@ -2988,7 +2988,7 @@ cmLocalGenerator std::string const& dir_max) { // Look for an existing mapped name for this object file. - std::map::iterator it = + std::map::iterator it = this->UniqueObjectNamesMap.find(sin); // If no entry exists create one. @@ -3071,7 +3071,7 @@ cmLocalGenerator #endif // Insert the newly mapped object file name. - std::map::value_type e(sin, ssin); + std::map::value_type e(sin, ssin); it = this->UniqueObjectNamesMap.insert(e).first; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 633be5d9b..3fe6a26de 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -406,7 +406,7 @@ protected: // generator directly. Any targets containing files that are not // of the types listed will be compiled as custom commands and added // to a custom target. - void CreateCustomTargetsAndCommands(std::set const&); + void CreateCustomTargetsAndCommands(std::set const&); // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( @@ -443,9 +443,9 @@ protected: std::vector StartOutputDirectoryComponents; cmLocalGenerator* Parent; std::vector Children; - std::map UniqueObjectNamesMap; + std::map UniqueObjectNamesMap; std::string::size_type ObjectPathMax; - std::set ObjectMaxPathViolations; + std::set ObjectMaxPathViolations; bool WindowsShell; bool WindowsVSIDE; bool WatcomWMake; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f47ea299d..251661391 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -190,7 +190,7 @@ void cmLocalUnixMakefileGenerator3::AddLocalObjectFile( void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets (std::vector& targets) { - for (std::map::iterator lo = + for (std::map::iterator lo = this->LocalObjectFiles.begin(); lo != this->LocalObjectFiles.end(); ++lo) { @@ -235,7 +235,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // only write local targets unless at the top Keep track of targets already // listed. - std::set emittedTargets; + std::set emittedTargets; if (this->Parent) { // write our targets, and while doing it collect up the object @@ -256,7 +256,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // now write out the object rules // for each object file name - for (std::map::iterator lo = + for (std::map::iterator lo = this->LocalObjectFiles.begin(); lo != this->LocalObjectFiles.end(); ++lo) { @@ -371,7 +371,7 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3 ::WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::set &emitted) + std::set &emitted) { std::vector depends; std::vector commands; @@ -1196,12 +1196,12 @@ cmLocalUnixMakefileGenerator3 if(!filename) { // Get the set of source languages in the target. - std::set languages; + std::set languages; target.GetLanguages(languages); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" << "foreach(lang"; - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { fout << " " << *l; @@ -1317,7 +1317,7 @@ cmLocalUnixMakefileGenerator3 // see if the variable has been defined before and return // the modified version of the variable - std::map::iterator i = + std::map::iterator i = this->MakeVariableMap.find(unmodified); if(i != this->MakeVariableMap.end()) { @@ -1721,7 +1721,7 @@ void cmLocalUnixMakefileGenerator3 { text = "Running external command ..."; } - std::set::const_iterator dit; + std::set::const_iterator dit; for ( dit = glIt->second.GetUtilities().begin(); dit != glIt->second.GetUtilities().end(); ++ dit ) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 2ad525037..37ee87474 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -211,11 +211,11 @@ public: // File pairs for implicit dependency scanning. The key of the map // is the depender and the value is the explicit dependee. struct ImplicitDependFileMap: - public std::map {}; + public std::map {}; struct ImplicitDependLanguageMap: - public std::map {}; + public std::map {}; struct ImplicitDependTargetMap: - public std::map {}; + public std::map {}; ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt); void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, @@ -231,7 +231,7 @@ public: std::string objNoTargetDir, bool hasSourceExtension); - std::vector const& GetLocalHelp() { return this->LocalHelp; } + std::vector const& GetLocalHelp() { return this->LocalHelp; } /** Get whether to create rules to generate preprocessed and assembly sources. This could be converted to a variable lookup @@ -256,7 +256,7 @@ protected: // write the target rules for the local Makefile into the stream void WriteLocalMakefileTargets(std::ostream& ruleFileStream, - std::set &emitted); + std::set &emitted); // this method Writes the Directory information files void WriteDirectoryInformationFile(); @@ -370,16 +370,16 @@ private: LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), HasAssembleRule(false) {} }; - std::map LocalObjectFiles; + std::map LocalObjectFiles; void WriteObjectConvenienceRule(std::ostream& ruleFileStream, const char* comment, const char* output, LocalObjectInfo const& info); - std::vector LocalHelp; + std::vector LocalHelp; /* does the work for each target */ - std::map MakeVariableMap; - std::map ShortMakeVariableMap; + std::map MakeVariableMap; + std::map ShortMakeVariableMap; }; #endif diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index a5ac629ea..b0c577ecb 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -80,7 +80,7 @@ private: void cmLocalVisualStudio6Generator::AddHelperCommands() { - std::set lang; + std::set lang; lang.insert("C"); lang.insert("CXX"); this->CreateCustomTargetsAndCommands(lang); @@ -426,7 +426,7 @@ void cmLocalVisualStudio6Generator } // Add per-source and per-configuration preprocessor definitions. - std::map cdmap; + std::map cdmap; { std::set targetCompileDefinitions; @@ -526,7 +526,7 @@ void cmLocalVisualStudio6Generator { fout << "\n# ADD CPP " << compileFlags << "\n\n"; } - std::map::iterator cdi = + std::map::iterator cdi = cdmap.find(cmSystemTools::UpperCase(config)); if(cdi != cdmap.end() && !cdi->second.empty()) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7b921a3d0..6ad5e04e9 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -59,7 +59,7 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator() void cmLocalVisualStudio7Generator::AddHelperCommands() { - std::set lang; + std::set lang; lang.insert("C"); lang.insert("CXX"); lang.insert("RC"); @@ -1468,7 +1468,7 @@ public: cmTarget& target, cmSourceFile const& sf, std::vector* configs); - std::map FileConfigMap; + std::map FileConfigMap; }; cmLocalVisualStudio7GeneratorFCInfo @@ -1712,7 +1712,7 @@ bool cmLocalVisualStudio7Generator aCompilerTool = "VFCustomBuildTool"; } } - for(std::map::const_iterator + for(std::map::const_iterator fci = fcinfo.FileConfigMap.begin(); fci != fcinfo.FileConfigMap.end(); ++fci) { diff --git a/Source/cmMakeDepend.h b/Source/cmMakeDepend.h index 2419ae9a8..2c9d51541 100644 --- a/Source/cmMakeDepend.h +++ b/Source/cmMakeDepend.h @@ -138,10 +138,10 @@ protected: cmsys::RegularExpression IncludeFileRegularExpression; cmsys::RegularExpression ComplainFileRegularExpression; std::vector IncludeDirectories; - typedef std::map FileToPathMapType; - typedef std::map + typedef std::map FileToPathMapType; + typedef std::map DirectoryToFileToPathMapType; - typedef std::map + typedef std::map DependInformationMapType; DependInformationMapType DependInformationMap; DirectoryToFileToPathMapType DirectoryToFileToPathMap; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 71985233d..d107ddf97 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,8 +45,8 @@ class cmMakefile::Internals { public: std::stack > VarStack; - std::stack > VarInitStack; - std::stack > VarUsageStack; + std::stack > VarInitStack; + std::stack > VarUsageStack; bool IsSourceFileTryCompile; }; @@ -54,7 +54,7 @@ public: cmMakefile::cmMakefile(): Internal(new Internals) { const cmDefinitions& defs = cmDefinitions(); - const std::set globalKeys = defs.LocalKeys(); + const std::set globalKeys = defs.LocalKeys(); this->Internal->VarStack.push(defs); this->Internal->VarInitStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys); @@ -203,7 +203,7 @@ cmMakefile::~cmMakefile() { delete *i; } - for(std::map::iterator i = this->Tests.begin(); + for(std::map::iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { delete i->second; @@ -247,10 +247,10 @@ void cmMakefile::PrintStringVector(const char* s, void cmMakefile ::PrintStringVector(const char* s, - const std::vector >& v) const + const std::vector >& v) const { std::cout << s << ": ( \n"; - for(std::vector >::const_iterator i + for(std::vector >::const_iterator i = v.begin(); i != v.end(); ++i) { std::cout << i->first.c_str() << " " << i->second; @@ -1746,9 +1746,9 @@ void cmMakefile::AddIncludeDirectories(const std::vector &incs, //---------------------------------------------------------------------------- void -cmMakefile::AddSystemIncludeDirectories(const std::set &incs) +cmMakefile::AddSystemIncludeDirectories(const std::set &incs) { - for(std::set::const_iterator li = incs.begin(); + for(std::set::const_iterator li = incs.begin(); li != incs.end(); ++li) { this->SystemIncludeDirectories.insert(*li); @@ -1865,8 +1865,8 @@ void cmMakefile::CheckForUnusedVariables() const return; } const cmDefinitions& defs = this->Internal->VarStack.top(); - const std::set& locals = defs.LocalKeys(); - std::set::const_iterator it = locals.begin(); + const std::set& locals = defs.LocalKeys(); + std::set::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { this->CheckForUnused("out of scope", it->c_str()); @@ -1903,7 +1903,7 @@ void cmMakefile::CheckForUnused(const char* reason, { if (this->WarnUnused && !this->VariableUsed(name)) { - cmStdString path; + std::string path; cmListFileBacktrace bt; if (this->CallStack.size()) { @@ -2487,7 +2487,7 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const std::vector cmMakefile ::GetDefinitions(int cacheonly /* = 0 */) const { - std::set definitions; + std::set definitions; if ( !cacheonly ) { definitions = this->Internal->VarStack.top().ClosureKeys(); @@ -2501,7 +2501,7 @@ std::vector cmMakefile std::vector res; - std::set::iterator fit; + std::set::iterator fit; for ( fit = definitions.begin(); fit != definitions.end(); fit ++ ) { res.push_back(*fit); @@ -3679,7 +3679,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, } else if (prop == "LISTFILE_STACK") { - for (std::deque::const_iterator + for (std::deque::const_iterator i = this->ListFileStack.begin(); i != this->ListFileStack.end(); ++i) { @@ -3864,7 +3864,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName) //---------------------------------------------------------------------------- cmTest* cmMakefile::GetTest(const std::string& testName) const { - std::map::const_iterator + std::map::const_iterator mi = this->Tests.find(testName); if(mi != this->Tests.end()) { @@ -3903,7 +3903,7 @@ std::string cmMakefile::GetListFileStack() const size_t depth = this->ListFileStack.size(); if (depth > 0) { - std::deque::const_iterator it = this->ListFileStack.end(); + std::deque::const_iterator it = this->ListFileStack.end(); do { if (depth != this->ListFileStack.size()) @@ -3926,8 +3926,8 @@ std::string cmMakefile::GetListFileStack() const void cmMakefile::PushScope() { cmDefinitions* parent = &this->Internal->VarStack.top(); - const std::set& init = this->Internal->VarInitStack.top(); - const std::set& usage = this->Internal->VarUsageStack.top(); + const std::set& init = this->Internal->VarInitStack.top(); + const std::set& usage = this->Internal->VarUsageStack.top(); this->Internal->VarStack.push(cmDefinitions(parent)); this->Internal->VarInitStack.push(init); this->Internal->VarUsageStack.push(usage); @@ -3936,12 +3936,12 @@ void cmMakefile::PushScope() void cmMakefile::PopScope() { cmDefinitions* current = &this->Internal->VarStack.top(); - std::set init = this->Internal->VarInitStack.top(); - std::set usage = this->Internal->VarUsageStack.top(); - const std::set& locals = current->LocalKeys(); + std::set init = this->Internal->VarInitStack.top(); + std::set usage = this->Internal->VarUsageStack.top(); + const std::set& locals = current->LocalKeys(); // Remove initialization and usage information for variables in the local // scope. - std::set::const_iterator it = locals.begin(); + std::set::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { init.erase(*it); @@ -4054,7 +4054,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, { // Look for an imported target. These take priority because they // are more local in scope and do not have to be globally unique. - std::map::const_iterator + std::map::const_iterator imported = this->ImportedTargets.find(name); if(imported != this->ImportedTargets.end()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 39635dda1..86cedb030 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -542,7 +542,7 @@ public: /** * Mark include directories as system directories. */ - void AddSystemIncludeDirectories(const std::set &incs); + void AddSystemIncludeDirectories(const std::set &incs); /** Expand out any arguements in the vector that have ; separated * strings into multiple arguements. A new vector is created @@ -876,7 +876,7 @@ public: void AddQtUiFileWithOptions(cmSourceFile *sf); std::vector GetQtUiFilesWithOptions() const; - std::set const & GetSystemIncludeDirectories() const + std::set const & GetSystemIncludeDirectories() const { return this->SystemIncludeDirectories; } protected: @@ -904,14 +904,14 @@ protected: std::vector SourceFiles; // Tests - std::map Tests; + std::map Tests; // The link-library paths. Order matters, use std::vector (not std::set). std::vector LinkDirectories; // The set of include directories that are marked as system include // directories. - std::set SystemIncludeDirectories; + std::set SystemIncludeDirectories; std::vector ListFiles; // list of command files loaded std::vector OutputFiles; // list of command files loaded @@ -957,7 +957,7 @@ private: friend class cmMakeDepend; // make depend needs direct access // to the Sources array void PrintStringVector(const char* s, const - std::vector >& v) const; + std::vector >& v) const; void PrintStringVector(const char* s, const std::vector& v) const; @@ -968,10 +968,10 @@ private: void PushFunctionBlockerBarrier(); void PopFunctionBlockerBarrier(bool reportError = true); - typedef std::map StringStringMap; + typedef std::map StringStringMap; StringStringMap MacrosMap; - std::map SubDirectoryOrder; + std::map SubDirectoryOrder; mutable cmsys::RegularExpression cmDefineRegex; mutable cmsys::RegularExpression cmDefine01Regex; @@ -987,7 +987,7 @@ private: bool CheckSystemVars; // stack of list files being read - std::deque ListFileStack; + std::deque ListFileStack; // stack of commands being invoked. struct CallStackEntry @@ -1000,7 +1000,7 @@ private: friend class cmMakefileCall; std::vector ImportedTargetsOwned; - std::map ImportedTargets; + std::map ImportedTargets; // Internal policy stack management. void PushPolicy(bool weak = false, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fb9b0451d..0a836a564 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -342,21 +342,21 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) void cmMakefileTargetGenerator::WriteTargetLanguageFlags() { // write language flags for target - std::set languages; + std::set languages; this->Target->GetLanguages(languages); // put the compiler in the rules.make file so that if it changes // things rebuild - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { - cmStdString compiler = "CMAKE_"; + std::string compiler = "CMAKE_"; compiler += *l; compiler += "_COMPILER"; *this->FlagFileStream << "# compile " << l->c_str() << " with " << this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n"; } - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) { *this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n"; @@ -1531,7 +1531,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, } // Make sure the extra files are built. - for(std::set::const_iterator i = this->ExtraFiles.begin(); + for(std::set::const_iterator i = this->ExtraFiles.begin(); i != this->ExtraFiles.end(); ++i) { depends.push_back(*i); @@ -1561,7 +1561,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) return std::string(); } - std::set emitted; + std::set emitted; #ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ emitted.insert("/System/Library/Frameworks"); #endif diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index d2cbaddb9..5f697a502 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -208,7 +208,7 @@ protected: std::string FlagFileNameFull; cmGeneratedFileStream *FlagFileStream; class StringList: public std::vector {}; - std::map FlagFileDepends; + std::map FlagFileDepends; // the stream for the info file std::string InfoFileNameFull; @@ -222,12 +222,12 @@ protected: std::vector ExternalObjects; // Set of object file names that will be built in this directory. - std::set ObjectFiles; + std::set ObjectFiles; // Set of extra output files to be driven by the build. - std::set ExtraFiles; + std::set ExtraFiles; - typedef std::map MultipleOutputPairsType; + typedef std::map MultipleOutputPairsType; MultipleOutputPairsType MultipleOutputPairs; // Target name info. @@ -238,11 +238,11 @@ protected: std::string TargetNamePDB; // Mac OS X content info. - std::set MacContentFolders; + std::set MacContentFolders; cmOSXBundleGenerator* OSXBundleGenerator; MacOSXContentGeneratorType* MacOSXContentGenerator; - typedef std::map ByLanguageMap; + typedef std::map ByLanguageMap; std::string GetFlags(const std::string &l); ByLanguageMap FlagsByLanguage; std::string GetDefines(const std::string &l); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 502127e50..a49fc2d7b 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -109,9 +109,9 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() << "\n\n"; #endif - std::set languages; + std::set languages; this->GetTarget()->GetLanguages(languages); - for(std::set::const_iterator l = languages.begin(); + for(std::set::const_iterator l = languages.begin(); l != languages.end(); ++l) this->WriteLanguageRules(*l); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e8ac81c61..b3b37a4c2 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -140,7 +140,7 @@ protected: MacOSXContentGeneratorType* MacOSXContentGenerator; // Properly initialized by sub-classes. cmOSXBundleGenerator* OSXBundleGenerator; - std::set MacContentFolders; + std::set MacContentFolders; void addPoolNinjaVariable(const char* pool_property, cmTarget* target, diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 2f3639402..97ae7314b 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -52,7 +52,7 @@ public: MacOSXContentGeneratorType* generator); std::string InitMacOSXContentDirectory(const char* pkgloc); - void SetMacContentFolders(std::set* macContentFolders) + void SetMacContentFolders(std::set* macContentFolders) { this->MacContentFolders = macContentFolders; } private: @@ -63,7 +63,7 @@ private: cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; const char* ConfigName; - std::set* MacContentFolders; + std::set* MacContentFolders; }; diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 86beb9795..79677e368 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -138,9 +138,9 @@ bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir, } // Check if the file will be built by cmake. - std::set const& files = + std::set const& files = (this->GlobalGenerator->GetDirectoryContent(dir, false)); - std::set::const_iterator fi = files.find(name); + std::set::const_iterator fi = files.find(name); return fi != files.end(); } @@ -200,7 +200,7 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir) { // We do not have the soname. Look for files in the directory // that may conflict. - std::set const& files = + std::set const& files = (this->GlobalGenerator ->GetDirectoryContent(dir, true)); @@ -208,9 +208,9 @@ bool cmOrderDirectoriesConstraintSOName::FindConflict(std::string const& dir) // know the soname just look at all files that start with the // file name. Usually the soname starts with the library name. std::string base = this->FileName; - std::set::const_iterator first = files.lower_bound(base); + std::set::const_iterator first = files.lower_bound(base); ++base[base.size()-1]; - std::set::const_iterator last = files.upper_bound(base); + std::set::const_iterator last = files.upper_bound(base); if(first != last) { return true; @@ -251,8 +251,8 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) if(!this->OD->LinkExtensions.empty() && this->OD->RemoveLibraryExtension.find(this->FileName)) { - cmStdString lib = this->OD->RemoveLibraryExtension.match(1); - cmStdString ext = this->OD->RemoveLibraryExtension.match(2); + std::string lib = this->OD->RemoveLibraryExtension.match(1); + std::string ext = this->OD->RemoveLibraryExtension.match(2); for(std::vector::iterator i = this->OD->LinkExtensions.begin(); i != this->OD->LinkExtensions.end(); ++i) @@ -407,7 +407,7 @@ cmOrderDirectories //---------------------------------------------------------------------------- void cmOrderDirectories -::SetImplicitDirectories(std::set const& implicitDirs) +::SetImplicitDirectories(std::set const& implicitDirs) { this->ImplicitDirectories = implicitDirs; } @@ -444,11 +444,11 @@ void cmOrderDirectories::CollectOriginalDirectories() int cmOrderDirectories::AddOriginalDirectory(std::string const& dir) { // Add the runtime directory with a unique index. - std::map::iterator i = + std::map::iterator i = this->DirectoryIndex.find(dir); if(i == this->DirectoryIndex.end()) { - std::map::value_type + std::map::value_type entry(dir, static_cast(this->OriginalDirectories.size())); i = this->DirectoryIndex.insert(entry).first; this->OriginalDirectories.push_back(dir); diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h index 76bf42965..07c85dd07 100644 --- a/Source/cmOrderDirectories.h +++ b/Source/cmOrderDirectories.h @@ -34,7 +34,7 @@ public: void AddLinkLibrary(std::string const& fullPath); void AddUserDirectories(std::vector const& extra); void AddLanguageDirectories(std::vector const& dirs); - void SetImplicitDirectories(std::set const& implicitDirs); + void SetImplicitDirectories(std::set const& implicitDirs); void SetLinkExtensionInfo(std::vector const& linkExtensions, std::string const& removeExtRegex); @@ -54,11 +54,11 @@ private: std::vector LanguageDirectories; cmsys::RegularExpression RemoveLibraryExtension; std::vector LinkExtensions; - std::set ImplicitDirectories; - std::set EmmittedConstraintSOName; - std::set EmmittedConstraintLibrary; + std::set ImplicitDirectories; + std::set EmmittedConstraintSOName; + std::set EmmittedConstraintLibrary; std::vector OriginalDirectories; - std::map DirectoryIndex; + std::map DirectoryIndex; std::vector DirectoryVisited; void CollectOriginalDirectories(); int AddOriginalDirectory(std::string const& dir); diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx index 9ebbaa4d4..3875318f4 100644 --- a/Source/cmPropertyDefinitionMap.cxx +++ b/Source/cmPropertyDefinitionMap.cxx @@ -14,7 +14,7 @@ #include "cmDocumentationSection.h" void cmPropertyDefinitionMap -::DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, +::DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain) @@ -29,7 +29,7 @@ void cmPropertyDefinitionMap } } -bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name) +bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) { cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) @@ -40,7 +40,7 @@ bool cmPropertyDefinitionMap::IsPropertyDefined(const cmStdString& name) return true; } -bool cmPropertyDefinitionMap::IsPropertyChained(const cmStdString& name) +bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) { cmPropertyDefinitionMap::iterator it = this->find(name); if (it == this->end()) diff --git a/Source/cmPropertyDefinitionMap.h b/Source/cmPropertyDefinitionMap.h index 68c3ff3cd..00c7328c6 100644 --- a/Source/cmPropertyDefinitionMap.h +++ b/Source/cmPropertyDefinitionMap.h @@ -17,20 +17,20 @@ class cmDocumentationSection; class cmPropertyDefinitionMap : -public std::map +public std::map { public: // define the property - void DefineProperty(const cmStdString& name, cmProperty::ScopeType scope, + void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char *ShortDescription, const char *FullDescription, bool chain); // has a named property been defined - bool IsPropertyDefined(const cmStdString& name); + bool IsPropertyDefined(const std::string& name); // is a named property set to chain - bool IsPropertyChained(const cmStdString& name); + bool IsPropertyChained(const std::string& name); }; #endif diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index a13ac351f..fa3384831 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -16,7 +16,7 @@ class cmake; -class cmPropertyMap : public std::map +class cmPropertyMap : public std::map { public: cmProperty *GetOrCreateProperty(const std::string& name); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e075c548b..17b2424c7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -697,7 +697,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, { cmMakefile *makefile = target->GetMakefile(); - std::set skipped; + std::set skipped; std::vector skipVec; cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec); @@ -1895,7 +1895,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, |cmsysTerminal_Color_ForegroundBold, msg.c_str(), true, this->ColorOutput); - std::vector command; + std::vector command; command.push_back(this->MocExecutable); for (std::list::const_iterator it = this->MocIncludes.begin(); it != this->MocIncludes.end(); @@ -1924,7 +1924,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { @@ -1971,7 +1971,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, |cmsysTerminal_Color_ForegroundBold, msg.c_str(), true, this->ColorOutput); - std::vector command; + std::vector command; command.push_back(this->UicExecutable); std::vector opts = this->UicTargetOptions; @@ -1996,7 +1996,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { @@ -2034,7 +2034,7 @@ bool cmQtAutoGenerators::GenerateQrc() { continue; } - std::vector command; + std::vector command; command.push_back(this->RccExecutable); std::string basename = cmsys::SystemTools:: @@ -2068,7 +2068,7 @@ bool cmQtAutoGenerators::GenerateQrc() if (this->Verbose) { - for(std::vector::const_iterator cmdIt = command.begin(); + for(std::vector::const_iterator cmdIt = command.begin(); cmdIt != command.end(); ++cmdIt) { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 11a991301..7ff12dde6 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -326,11 +326,11 @@ std::string cmRST::ReplaceSubstitutions(std::string const& line) std::string::size_type start = this->Substitution.start(2); std::string::size_type end = this->Substitution.end(2); std::string substitute = this->Substitution.match(3); - std::map::iterator + std::map::iterator replace = this->Replace.find(substitute); if(replace != this->Replace.end()) { - std::pair::iterator, bool> replaced = + std::pair::iterator, bool> replaced = this->Replaced.insert(substitute); if(replaced.second) { diff --git a/Source/cmRST.h b/Source/cmRST.h index 335600867..b9b236642 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -92,8 +92,8 @@ private: std::vector MarkupLines; std::string DocDir; - std::map Replace; - std::set Replaced; + std::map Replace; + std::set Replaced; std::string ReplaceName; }; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index e561e36d3..84c7610ea 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -241,7 +241,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() //---------------------------------------------------------------------------- bool cmSetPropertyCommand::HandleTargetMode() { - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { if (this->Makefile->IsAlias(*ni)) @@ -297,7 +297,7 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target) //---------------------------------------------------------------------------- bool cmSetPropertyCommand::HandleSourceMode() { - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { // Get the source file. @@ -345,8 +345,8 @@ bool cmSetPropertyCommand::HandleSource(cmSourceFile* sf) bool cmSetPropertyCommand::HandleTestMode() { // Look for tests with all names given. - std::set::iterator next; - for(std::set::iterator ni = this->Names.begin(); + std::set::iterator next; + for(std::set::iterator ni = this->Names.begin(); ni != this->Names.end(); ni = next) { next = ni; @@ -369,7 +369,7 @@ bool cmSetPropertyCommand::HandleTestMode() { cmOStringStream e; e << "given TEST names that do not exist:\n"; - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { e << " " << *ni << "\n"; @@ -440,7 +440,7 @@ bool cmSetPropertyCommand::HandleCacheMode() return false; } - for(std::set::const_iterator ni = this->Names.begin(); + for(std::set::const_iterator ni = this->Names.begin(); ni != this->Names.end(); ++ni) { // Get the source file. diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 5470314ca..5757d219c 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -44,7 +44,7 @@ public: cmTypeMacro(cmSetPropertyCommand, cmCommand); private: - std::set Names; + std::set Names; std::string PropertyName; std::string PropertyValue; bool Remove; diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx index 195feb5ff..8fed95e11 100644 --- a/Source/cmSourceGroup.cxx +++ b/Source/cmSourceGroup.cxx @@ -99,7 +99,7 @@ bool cmSourceGroup::MatchesRegex(const char* name) //---------------------------------------------------------------------------- bool cmSourceGroup::MatchesFiles(const char* name) { - std::set::const_iterator i = this->GroupFiles.find(name); + std::set::const_iterator i = this->GroupFiles.find(name); if(i != this->GroupFiles.end()) { return true; diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h index 2d891d1d5..e8cf519d4 100644 --- a/Source/cmSourceGroup.h +++ b/Source/cmSourceGroup.h @@ -118,7 +118,7 @@ private: /** * Set of file names explicitly added to this group. */ - std::set GroupFiles; + std::set GroupFiles; /** * Vector of all source files that have been assigned to diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 04e1bc840..ed8efcc68 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -241,7 +241,7 @@ inline bool operator==(std::string const& a, const char* b) // std::string is really basic_string<....lots of stuff....> // when combined with a map or set, the symbols can be > 2000 chars! #include -typedef cmsys::String cmStdString; +//typedef cmsys::String std::string; // Define cmOStringStream and cmIStringStream wrappers to hide // differences between std::stringstream and the old strstream. @@ -468,7 +468,7 @@ struct cmStrCmp { } private: - const cmStdString m_test; + const std::string m_test; }; #endif diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2b17fba73..39b53bf5f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -477,13 +477,6 @@ public: args.push_back(*arg); } } - void Store(std::vector& args) const - { - for(char** arg = this->ArgV; arg && *arg; ++arg) - { - args.push_back(*arg); - } - } }; //---------------------------------------------------------------------------- @@ -495,15 +488,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, argv.Store(args); } -//---------------------------------------------------------------------------- -void cmSystemTools::ParseUnixCommandLine(const char* command, - std::vector& args) -{ - // Invoke the underlying parser. - cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0); - argv.Store(args); -} - std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, int shell_flags) { @@ -523,9 +507,9 @@ std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, return result; } -std::vector cmSystemTools::ParseArguments(const char* command) +std::vector cmSystemTools::ParseArguments(const char* command) { - std::vector args; + std::vector args; std::string arg; bool win_path = false; @@ -606,22 +590,6 @@ std::vector cmSystemTools::ParseArguments(const char* command) } -bool cmSystemTools::RunSingleCommand(std::vectorconst& command, - std::string* output , - int* retVal , const char* dir , - OutputOption outputflag , - double timeout ) -{ - std::vector cmd; - for(std::vector::const_iterator i = command.begin(); - i != command.end(); ++i) - { - cmd.push_back(*i); - } - return cmSystemTools::RunSingleCommand(cmd, output, retVal, dir, - outputflag, timeout); -} - bool cmSystemTools::RunSingleCommand(std::vectorconst& command, std::string* output , int* retVal , const char* dir , @@ -781,7 +749,7 @@ bool cmSystemTools::RunSingleCommand( outputflag = OUTPUT_NONE; } - std::vector args = cmSystemTools::ParseArguments(command); + std::vector args = cmSystemTools::ParseArguments(command); if(args.size() < 1) { @@ -1114,8 +1082,8 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, } } -bool cmSystemTools::SimpleGlob(const cmStdString& glob, - std::vector& files, +bool cmSystemTools::SimpleGlob(const std::string& glob, + std::vector& files, int type /* = 0 */) { files.clear(); @@ -1233,7 +1201,7 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext) return cmSystemTools::UNKNOWN_FILE_FORMAT; } -bool cmSystemTools::Split(const char* s, std::vector& l) +bool cmSystemTools::Split(const char* s, std::vector& l) { std::vector temp; bool res = Superclass::Split(s, temp); @@ -1445,7 +1413,7 @@ bool cmSystemTools::IsPathToFramework(const char* path) } bool cmSystemTools::CreateTar(const char* outFileName, - const std::vector& files, + const std::vector& files, bool gzip, bool bzip2, bool verbose) { #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -1465,7 +1433,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, cmArchiveWrite::CompressNone)), cmArchiveWrite::TypeTAR); a.SetVerbose(verbose); - for(std::vector::const_iterator i = files.begin(); + for(std::vector::const_iterator i = files.begin(); i != files.end(); ++i) { std::string path = *i; @@ -2317,7 +2285,7 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath, bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, std::string& soname) { - std::vector cmds; + std::vector cmds; cmds.push_back("otool"); cmds.push_back("-D"); cmds.push_back(fullPath.c_str()); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4a212c266..27b4bceaf 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -172,8 +172,8 @@ public: * want to find. 0 means all files, -1 means directories, 1 means * files only. This method returns true if search was succesfull. */ - static bool SimpleGlob(const cmStdString& glob, - std::vector& files, + static bool SimpleGlob(const std::string& glob, + std::vector& files, int type = 0); ///! Copy a file. @@ -234,18 +234,13 @@ public: int* retVal = 0, const char* dir = 0, OutputOption outputflag = OUTPUT_MERGE, double timeout = 0.0); - static bool RunSingleCommand(std::vector const& command, - std::string* output = 0, - int* retVal = 0, const char* dir = 0, - OutputOption outputflag = OUTPUT_MERGE, - double timeout = 0.0); static std::string PrintSingleCommand(std::vector const&); /** * Parse arguments out of a single string command */ - static std::vector ParseArguments(const char* command); + static std::vector ParseArguments(const char* command); /** Parse arguments out of a windows command line string. */ static void ParseWindowsCommandLine(const char* command, @@ -254,8 +249,6 @@ public: /** Parse arguments out of a unix command line string. */ static void ParseUnixCommandLine(const char* command, std::vector& args); - static void ParseUnixCommandLine(const char* command, - std::vector& args); /** Compute an escaped version of the given argument for use in a windows shell. See kwsys/System.h.in for details. */ @@ -321,7 +314,7 @@ public: /** Split a string on its newlines into multiple lines. Returns false only if the last line stored had no newline. */ - static bool Split(const char* s, std::vector& l); + static bool Split(const char* s, std::vector& l); static void SetForceUnixPaths(bool v) { s_ForceUnixPaths = v; @@ -390,7 +383,7 @@ public: static bool ListTar(const char* outFileName, bool gzip, bool verbose); static bool CreateTar(const char* outFileName, - const std::vector& files, bool gzip, + const std::vector& files, bool gzip, bool bzip2, bool verbose); static bool ExtractTar(const char* inFileName, bool gzip, bool verbose); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c927a0b87..99f2c1f03 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -118,7 +118,7 @@ public: LinkInterfaceMapType LinkInterfaceMap; bool PolicyWarnedCMP0022; - typedef std::map OutputInfoMapType; + typedef std::map OutputInfoMapType; OutputInfoMapType OutputInfoMap; typedef std::map @@ -356,10 +356,10 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->InsertInclude(*it); } - const std::set parentSystemIncludes = + const std::set parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); - for (std::set::const_iterator it + for (std::set::const_iterator it = parentSystemIncludes.begin(); it != parentSystemIncludes.end(); ++it) { @@ -428,7 +428,7 @@ void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) cmListFileBacktrace const* cmTarget::GetUtilityBacktrace( const std::string& u) const { - std::map::const_iterator i = + std::map::const_iterator i = this->UtilityBacktraces.find(u); if(i == this->UtilityBacktraces.end()) return 0; @@ -776,8 +776,8 @@ void cmTarget::GetDirectLinkLibraries(const char *config, &dagChecker), libs); - std::set seenProps = cge->GetSeenTargetProperties(); - for (std::set::const_iterator it = seenProps.begin(); + std::set seenProps = cge->GetSeenTargetProperties(); + for (std::set::const_iterator it = seenProps.begin(); it != seenProps.end(); ++it) { if (!this->GetProperty(it->c_str())) @@ -887,7 +887,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; - std::set emitted; + std::set emitted; for(std::vector::const_iterator it = sigs.begin(); it != sigs.end(); ++it) { @@ -981,9 +981,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, //---------------------------------------------------------------------------- void -cmTarget::AddSystemIncludeDirectories(const std::set &incs) +cmTarget::AddSystemIncludeDirectories(const std::set &incs) { - for(std::set::const_iterator li = incs.begin(); + for(std::set::const_iterator li = incs.begin(); li != incs.end(); ++li) { this->SystemIncludeDirectories.insert(*li); @@ -1574,7 +1574,7 @@ static void processIncludeDirectories(cmTarget const* tgt, { bool testIsOff = true; bool cacheIncludes = false; - std::vector entryIncludes = (*it)->CachedEntries; + std::vector& entryIncludes = (*it)->CachedEntries; if(!entryIncludes.empty()) { testIsOff = false; @@ -2806,7 +2806,7 @@ class cmTargetCollectLinkLanguages { public: cmTargetCollectLinkLanguages(cmTarget const* target, const char* config, - std::set& languages, + std::set& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), Makefile(target->GetMakefile()), Target(target) @@ -2878,7 +2878,7 @@ public: } private: const char* Config; - std::set& Languages; + std::set& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; const cmTarget* Target; @@ -2917,7 +2917,7 @@ class cmTargetSelectLinker cmTarget const* Target; cmMakefile* Makefile; cmGlobalGenerator* GG; - std::set Preferred; + std::set Preferred; public: cmTargetSelectLinker(cmTarget const* target): Preference(0), Target(target) { @@ -2949,7 +2949,7 @@ public: e << "Target " << this->Target->GetName() << " contains multiple languages with the highest linker preference" << " (" << this->Preference << "):\n"; - for(std::set::const_iterator + for(std::set::const_iterator li = this->Preferred.begin(); li != this->Preferred.end(); ++li) { e << " " << *li << "\n"; @@ -2968,7 +2968,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, cmTarget const* head) const { // Get languages built in this target. - std::set languages; + std::set languages; LinkImplementation const* impl = this->GetLinkImplementation(config, head); for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) @@ -2985,7 +2985,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, } // Store the transitive closure of languages. - for(std::set::const_iterator li = languages.begin(); + for(std::set::const_iterator li = languages.begin(); li != languages.end(); ++li) { lc.Languages.push_back(*li); @@ -3013,7 +3013,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, } // Now consider languages that propagate from linked targets. - for(std::set::const_iterator sit = languages.begin(); + for(std::set::const_iterator sit = languages.begin(); sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; @@ -4822,7 +4822,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, } //---------------------------------------------------------------------------- -void cmTarget::GetLanguages(std::set& languages) const +void cmTarget::GetLanguages(std::set& languages) const { for(std::vector::const_iterator i = this->SourceFiles.begin(); i != this->SourceFiles.end(); ++i) @@ -5662,7 +5662,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. - std::set emitted; + std::set emitted; for(std::vector::const_iterator li = iface.Libraries.begin(); li != iface.Libraries.end(); ++li) { @@ -5891,7 +5891,7 @@ void cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const { // This target needs runtime libraries for its source languages. - std::set languages; + std::set languages; // Get languages used in our source files. this->GetLanguages(languages); // Get languages used in object library sources. @@ -5908,7 +5908,7 @@ cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const } } // Copy the set of langauges to the link implementation. - for(std::set::iterator li = languages.begin(); + for(std::set::iterator li = languages.begin(); li != languages.end(); ++li) { impl.Languages.push_back(*li); @@ -6017,8 +6017,8 @@ const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, template void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, - const cmStdString& propName, - std::set &emitted, + const std::string& propName, + std::set &emitted, const char *config, CompatibleType t, PropertyType *) @@ -6062,10 +6062,10 @@ void checkPropertyConsistency(cmTarget const* depender, } } -static cmStdString intersect(const std::set &s1, - const std::set &s2) +static std::string intersect(const std::set &s1, + const std::set &s2) { - std::set intersect; + std::set intersect; std::set_intersection(s1.begin(),s1.end(), s2.begin(),s2.end(), std::inserter(intersect,intersect.begin())); @@ -6075,11 +6075,11 @@ static cmStdString intersect(const std::set &s1, } return ""; } -static cmStdString intersect(const std::set &s1, - const std::set &s2, - const std::set &s3) +static std::string intersect(const std::set &s1, + const std::set &s2, + const std::set &s3) { - cmStdString result; + std::string result; result = intersect(s1, s2); if (!result.empty()) return result; @@ -6088,12 +6088,12 @@ static cmStdString intersect(const std::set &s1, return result; return intersect(s2, s3); } -static cmStdString intersect(const std::set &s1, - const std::set &s2, - const std::set &s3, - const std::set &s4) +static std::string intersect(const std::set &s1, + const std::set &s2, + const std::set &s3, + const std::set &s4) { - cmStdString result; + std::string result; result = intersect(s1, s2); if (!result.empty()) return result; @@ -6112,10 +6112,10 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, { const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); - std::set emittedBools; - std::set emittedStrings; - std::set emittedMinNumbers; - std::set emittedMaxNumbers; + std::set emittedBools; + std::set emittedStrings; + std::set emittedMinNumbers; + std::set emittedMaxNumbers; for(cmComputeLinkInformation::ItemVector::const_iterator li = deps.begin(); @@ -6167,7 +6167,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, if (!prop.empty()) { std::set props; - std::set::const_iterator i = emittedBools.find(prop); + std::set::const_iterator i = emittedBools.find(prop); if (i != emittedBools.end()) { props.insert("COMPATIBLE_INTERFACE_BOOL"); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f73b271c2..ec74e0504 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -148,7 +148,7 @@ public: enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; //* how we identify a library, by name and type - typedef std::pair LibraryID; + typedef std::pair LibraryID; typedef std::vector LinkLibraryVectorType; const LinkLibraryVectorType &GetLinkLibraries() const { @@ -216,7 +216,7 @@ public: */ void AddUtility(const std::string& u, cmMakefile *makefile = 0); ///! Get the utilities used by this target - std::setconst& GetUtilities() const { return this->Utilities; } + std::setconst& GetUtilities() const { return this->Utilities; } cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const; /** Finalize the target at the end of the Configure step. */ @@ -455,7 +455,7 @@ public: // when source file properties are changed and we do not have enough // information to forward these property changes to the targets // until we have per-target object file properties. - void GetLanguages(std::set& languages) const; + void GetLanguages(std::set& languages) const; /** Return whether this target is an executable with symbol exports enabled. */ @@ -552,9 +552,9 @@ public: std::string GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const; - void AddSystemIncludeDirectories(const std::set &incs); + void AddSystemIncludeDirectories(const std::set &incs); void AddSystemIncludeDirectories(const std::vector &incs); - std::set const & GetSystemIncludeDirectories() const + std::set const & GetSystemIncludeDirectories() const { return this->SystemIncludeDirectories; } bool LinkLanguagePropagatesToDependents() const @@ -570,7 +570,7 @@ private: // The set of include directories that are marked as system include // directories. - std::set SystemIncludeDirectories; + std::set SystemIncludeDirectories; std::vector > TLLCommands; @@ -675,13 +675,13 @@ private: LinkLibraryVectorType PrevLinkedLibraries; bool LinkLibrariesAnalyzed; std::vector LinkDirectories; - std::set LinkDirectoriesEmmitted; + std::set LinkDirectoriesEmmitted; bool HaveInstallRule; std::string InstallPath; std::string RuntimeInstallPath; mutable std::string ExportMacro; - std::set Utilities; - std::map UtilityBacktraces; + std::set Utilities; + std::map UtilityBacktraces; bool RecordDependencies; mutable cmPropertyMap Properties; LinkLibraryVectorType OriginalLinkLibraries; @@ -762,9 +762,9 @@ private: const char* version) const; }; -typedef std::map cmTargets; +typedef std::map cmTargets; -class cmTargetSet: public std::set {}; -class cmTargetManifest: public std::map {}; +class cmTargetSet: public std::set {}; +class cmTargetManifest: public std::map {}; #endif diff --git a/Source/cmTest.h b/Source/cmTest.h index a5795c3dd..b3785f636 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -65,7 +65,7 @@ public: private: cmPropertyMap Properties; - cmStdString Name; + std::string Name; std::vector Command; bool OldStyle; diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 790c75acc..c86fad03c 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -81,7 +81,7 @@ protected: }; typedef std::vector< Pair* > VectorOfPairs; - typedef std::map StringToVectorOfPairs; + typedef std::map StringToVectorOfPairs; StringToVectorOfPairs WatchMap; }; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index d1f3d1929..8d6925430 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -98,7 +98,7 @@ private: private: typedef cmVisualStudioGeneratorOptions Options; - typedef std::map OptionsMap; + typedef std::map OptionsMap; OptionsMap ClOptions; OptionsMap LinkOptions; std::string PathToVcxproj; @@ -113,7 +113,7 @@ private: cmLocalVisualStudio7Generator* LocalGenerator; std::set SourcesVisited; - typedef std::map ToolSourceMap; + typedef std::map ToolSourceMap; ToolSourceMap Tools; }; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index f48c59345..81adb56c6 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -300,7 +300,7 @@ cmVisualStudioGeneratorOptions { if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent; @@ -326,7 +326,7 @@ cmVisualStudioGeneratorOptions } else { - for(std::map::iterator m = this->FlagMap.begin(); + for(std::map::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent << m->first << "=\"" << m->second << "\"\n"; diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index 3b9035fea..3302a8de4 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -108,7 +108,7 @@ void cmXCodeObject::Print(std::ostream& out) { out << separator; } - std::map::iterator i; + std::map::iterator i; cmXCodeObject::Indent(3*indentFactor, out); out << "isa = " << PBXTypeNames[this->IsA] << ";" << separator; for(i = this->ObjectAttributes.begin(); @@ -138,7 +138,7 @@ void cmXCodeObject::Print(std::ostream& out) } else if(object->TypeValue == ATTRIBUTE_GROUP) { - std::map::iterator j; + std::map::iterator j; out << i->first << " = {" << separator; for(j = object->ObjectAttributes.begin(); j != object->ObjectAttributes.end(); ++j) @@ -236,7 +236,7 @@ void cmXCodeObject::CopyAttributes(cmXCodeObject* copy) } //---------------------------------------------------------------------------- -void cmXCodeObject::PrintString(std::ostream& os,cmStdString String) +void cmXCodeObject::PrintString(std::ostream& os,std::string String) { // The string needs to be quoted if it contains any characters // considered special by the Xcode project file parser. diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b4623a053..8eaf2aab4 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -30,7 +30,7 @@ public: PBXCopyFilesBuildPhase, None }; - class StringVec: public std::vector {}; + class StringVec: public std::vector {}; static const char* PBXTypeNames[]; virtual ~cmXCodeObject(); cmXCodeObject(PBXType ptype, Type type); @@ -131,7 +131,7 @@ public: } this->DependLibraries[configName].push_back(l); } - std::map const& GetDependLibraries() + std::map const& GetDependLibraries() { return this->DependLibraries; } @@ -144,27 +144,27 @@ public: } this->DependTargets[configName].push_back(tName); } - std::map const& GetDependTargets() + std::map const& GetDependTargets() { return this->DependTargets; } std::vector const& GetObjectList() { return this->List;} void SetComment(const char* c) { this->Comment = c;} - static void PrintString(std::ostream& os,cmStdString String); + static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; cmTarget* Target; Type TypeValue; - cmStdString Id; + std::string Id; PBXType IsA; int Version; - cmStdString Comment; - cmStdString String; + std::string Comment; + std::string String; cmXCodeObject* Object; std::vector List; - std::map DependLibraries; - std::map DependTargets; - std::map ObjectAttributes; + std::map DependLibraries; + std::map DependTargets; + std::map ObjectAttributes; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ad1d0fafb..bdba9c21c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2701,7 +2701,7 @@ void cmake::RunCheckForUnusedVariables() bool haveUnused = false; cmOStringStream msg; msg << "Manually-specified variables were not used by the project:"; - for(std::map::const_iterator + for(std::map::const_iterator it = this->UsedCliVariables.begin(); it != this->UsedCliVariables.end(); ++it) { diff --git a/Source/cmake.h b/Source/cmake.h index 2d78e8f00..1b8152029 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -91,7 +91,7 @@ class cmake */ FIND_PACKAGE_MODE }; - typedef std::map RegisteredCommandsMap; + typedef std::map RegisteredCommandsMap; /// Default constructor cmake(); @@ -364,14 +364,14 @@ protected: void InitializeProperties(); int HandleDeleteCacheVariables(const std::string& var); cmPropertyMap Properties; - std::set > AccessedProperties; + std::set > AccessedProperties; std::map PropertyDefinitions; typedef cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)(); - typedef std::map RegisteredExtraGeneratorsMap; typedef std::vector RegisteredGeneratorsVector; RegisteredCommandsMap Commands; @@ -432,7 +432,7 @@ private: bool WarnUnused; bool WarnUnusedCli; bool CheckSystemVars; - std::map UsedCliVariables; + std::map UsedCliVariables; std::string CMakeEditCommand; std::string CXXEnvironment; std::string CCEnvironment; diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index faa5fa7c6..55fc6338a 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -198,7 +198,7 @@ static int process( const std::string& srcfilename, std::vector args; cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args); // convert to correct vector type for RunSingleCommand - std::vector command; + std::vector command; for(std::vector::iterator i = args.begin(); i != args.end(); ++i) { diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 4ac198622..603b6d0c0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -677,7 +677,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { std::string flags = args[2]; std::string outFile = args[3]; - std::vector files; + std::vector files; for (std::string::size_type cc = 4; cc < args.size(); cc ++) { files.push_back(args[cc]); @@ -1143,7 +1143,7 @@ int cmcmd::VisualStudioLink(std::vector& args, int type) } int cmcmd::ParseVisualStudioLinkCommand(std::vector& args, - std::vector& command, + std::vector& command, std::string& targetName) { std::vector::iterator i = args.begin(); @@ -1171,14 +1171,14 @@ int cmcmd::ParseVisualStudioLinkCommand(std::vector& args, } bool cmcmd::RunCommand(const char* comment, - std::vector& command, + std::vector& command, bool verbose, int* retCodeOut) { if(verbose) { std::cout << comment << ":\n"; - for(std::vector::iterator i = command.begin(); + for(std::vector::iterator i = command.begin(); i != command.end(); ++i) { std::cout << i->c_str() << " "; @@ -1239,16 +1239,16 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, // 7. Finally, the Linker does another incremental link, but since the // only thing that has changed is the *.res file that contains the // manifest it is a short link. - std::vector linkCommand; + std::vector linkCommand; std::string targetName; if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1) { return -1; } std::string manifestArg = "/MANIFESTFILE:"; - std::vector rcCommand; + std::vector rcCommand; rcCommand.push_back(cmSystemTools::FindProgram("rc.exe")); - std::vector mtCommand; + std::vector mtCommand; mtCommand.push_back(cmSystemTools::FindProgram("mt.exe")); std::string tempManifest; tempManifest = targetName; @@ -1349,7 +1349,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector& args, bool hasManifest, bool verbose) { - std::vector linkCommand; + std::vector linkCommand; std::string targetName; if(cmcmd::ParseVisualStudioLinkCommand(args, linkCommand, targetName) == -1) { @@ -1368,7 +1368,7 @@ int cmcmd::VisualStudioLinkNonIncremental(std::vector& args, { return 0; } - std::vector mtCommand; + std::vector mtCommand; mtCommand.push_back(cmSystemTools::FindProgram("mt.exe")); mtCommand.push_back("/nologo"); mtCommand.push_back("/manifest"); diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 4517ebf64..2bfbae7cc 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -43,10 +43,10 @@ protected: bool hasManifest, bool verbose); static int ParseVisualStudioLinkCommand(std::vector& args, - std::vector& command, + std::vector& command, std::string& targetName); static bool RunCommand(const char* comment, - std::vector& command, + std::vector& command, bool verbose, int* retCodeOut = 0); }; diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx index dc1ce24f7..279bcd587 100644 --- a/Tests/CMakeLib/run_compile_commands.cxx +++ b/Tests/CMakeLib/run_compile_commands.cxx @@ -2,14 +2,14 @@ class CompileCommandParser { public: - class CommandType: public std::map + class CommandType: public std::map { public: - cmStdString const& at(cmStdString const& k) const + std::string const& at(std::string const& k) const { const_iterator i = this->find(k); if(i != this->end()) { return i->second; } - static cmStdString emptyString; + static std::string emptyString; return emptyString; } }; @@ -127,7 +127,7 @@ int main () it = parser.GetTranslationUnits().begin(), end = parser.GetTranslationUnits().end(); it != end; ++it) { - std::vector command; + std::vector command; cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command); if (!cmSystemTools::RunSingleCommand( command, 0, 0, it->at("directory").c_str())) From f0ad6631adb7cd364e2bcf5e8738c697c902e0ad Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:24:15 -0500 Subject: [PATCH 130/278] Directories: Take strings when setting directories --- Source/cmake.cxx | 4 ++-- Source/cmake.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index bdba9c21c..5ada30e5c 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1069,13 +1069,13 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) return generator; } -void cmake::SetHomeDirectory(const char* dir) +void cmake::SetHomeDirectory(const std::string& dir) { this->cmHomeDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); } -void cmake::SetHomeOutputDirectory(const char* lib) +void cmake::SetHomeOutputDirectory(const std::string& lib) { this->HomeOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); diff --git a/Source/cmake.h b/Source/cmake.h index 1b8152029..933502a26 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -110,12 +110,12 @@ class cmake * CMakeLists files by recursing up the tree starting at the StartDirectory * and going up until it reaches the HomeDirectory. */ - void SetHomeDirectory(const char* dir); + void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const { return this->cmHomeDirectory.c_str(); } - void SetHomeOutputDirectory(const char* lib); + void SetHomeOutputDirectory(const std::string& lib); const char* GetHomeOutputDirectory() const { return this->HomeOutputDirectory.c_str(); @@ -130,7 +130,7 @@ class cmake * recursing up the tree starting at the StartDirectory and going up until * it reaches the HomeDirectory. */ - void SetStartDirectory(const char* dir) + void SetStartDirectory(const std::string& dir) { this->cmStartDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); @@ -139,7 +139,7 @@ class cmake { return this->cmStartDirectory.c_str(); } - void SetStartOutputDirectory(const char* lib) + void SetStartOutputDirectory(const std::string& lib) { this->StartOutputDirectory = lib; cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); From cfc2cf9559eacbf45d04249ee1dd7f75bb0cdff0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 8 Feb 2014 12:01:01 -0500 Subject: [PATCH 131/278] cmGeneratorExpression: Tokenize over strings --- Source/cmGeneratorExpression.cxx | 16 ++++++++-------- Source/cmGeneratorExpression.h | 4 ++-- Source/cmGeneratorExpressionLexer.cxx | 6 ++---- Source/cmGeneratorExpressionLexer.h | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 3ebb1b600..433adcf7c 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -33,17 +33,17 @@ cmGeneratorExpression::cmGeneratorExpression( cmsys::auto_ptr cmGeneratorExpression::Parse(std::string const& input) { - return this->Parse(input.c_str()); + return cmsys::auto_ptr( + new cmCompiledGeneratorExpression( + this->Backtrace, + input)); } //---------------------------------------------------------------------------- cmsys::auto_ptr cmGeneratorExpression::Parse(const char* input) { - return cmsys::auto_ptr( - new cmCompiledGeneratorExpression( - this->Backtrace, - input)); + return this->Parse(std::string(input ? input : "")); } cmGeneratorExpression::~cmGeneratorExpression() @@ -122,13 +122,13 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmListFileBacktrace const& backtrace, - const char *input) - : Backtrace(backtrace), Input(input ? input : ""), + const std::string& input) + : Backtrace(backtrace), Input(input), HadContextSensitiveCondition(false) { cmGeneratorExpressionLexer l; std::vector tokens = - l.Tokenize(this->Input.c_str()); + l.Tokenize(this->Input); this->NeedsEvaluation = l.GetSawGeneratorExpression(); if (this->NeedsEvaluation) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 58abf1407..9aa590d36 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -100,7 +100,7 @@ public: ~cmCompiledGeneratorExpression(); - std::string GetInput() const + std::string const& GetInput() const { return this->Input; } @@ -116,7 +116,7 @@ public: private: cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, - const char *input); + const std::string& input); friend class cmGeneratorExpression; diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx index 117a24e09..1c83466ce 100644 --- a/Source/cmGeneratorExpressionLexer.cxx +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -32,13 +32,11 @@ static void InsertText(const char *upto, const char *c, //---------------------------------------------------------------------------- std::vector -cmGeneratorExpressionLexer::Tokenize(const char *input) +cmGeneratorExpressionLexer::Tokenize(const std::string& input) { std::vector result; - if (!input) - return result; - const char *c = input; + const char *c = input.c_str(); const char *upto = c; for ( ; *c; ++c) diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h index 83d661de1..1e2e8c25e 100644 --- a/Source/cmGeneratorExpressionLexer.h +++ b/Source/cmGeneratorExpressionLexer.h @@ -43,7 +43,7 @@ class cmGeneratorExpressionLexer public: cmGeneratorExpressionLexer(); - std::vector Tokenize(const char *input); + std::vector Tokenize(const std::string& input); bool GetSawGeneratorExpression() const { From f154475b65738444414312d7d5a255f3220d90c6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 8 Mar 2014 07:55:46 -0500 Subject: [PATCH 132/278] cmTarget: Refactor GetLocation API When given a non-NULL configuration the GetLocation returned the location for the given configuration. When given a NULL configuration the GetLocation method returned a location with the build-system placeholder for the configuration name. Split the latter use case out into a separate GetLocationForBuild method and update call sites accordingly. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 12 ++++++------ Source/cmTarget.cxx | 25 +++++++++---------------- Source/cmTarget.h | 11 ++++++----- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a7b2efa0a..f7f6febd0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -742,7 +742,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) { // This is really only for compatibility so we do not need to // worry about configuration names and output names. - std::string tLocation = t->GetLocation(0); + std::string tLocation = t->GetLocationForBuild(); tLocation = cmSystemTools::GetFilenamePath(tLocation); std::string depLocation = cmSystemTools::GetFilenamePath(dep); depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 25df953d5..2d485f658 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -76,7 +76,7 @@ void cmGlobalKdevelopGenerator::Generate() { if (ti->second.GetType()==cmTarget::EXECUTABLE) { - executable = ti->second.GetLocation(0); + executable = ti->second.GetLocation(""); break; } } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 17b2424c7..fbb3b1c61 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -610,7 +610,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0)); + makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -621,7 +621,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, autogenTargetName.c_str()); return; } - makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(0)); + makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation("")); } else { @@ -782,7 +782,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } else { - makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(0)); + makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation("")); } } else if (strcmp(qtVersion, "4") == 0) @@ -794,7 +794,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, targetName.c_str()); return; } - makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0)); + makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation("")); } else { @@ -931,7 +931,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) targetName.c_str()); return; } - makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0)); + makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation("")); } else if (strcmp(qtVersion, "4") == 0) { @@ -942,7 +942,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) targetName.c_str()); return; } - makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0)); + makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation("")); } else { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 99f2c1f03..3273437c0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2458,32 +2458,25 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const //---------------------------------------------------------------------------- const char* cmTarget::GetLocation(const char* config) const { + static std::string location; if (this->IsImported()) { - return this->ImportedGetLocation(config); + location = this->ImportedGetFullPath(config, false); } else { - return this->NormalGetLocation(config); + location = this->GetFullPath(config, false); } -} - -//---------------------------------------------------------------------------- -const char* cmTarget::ImportedGetLocation(const char* config) const -{ - static std::string location; - location = this->ImportedGetFullPath(config, false); return location.c_str(); } //---------------------------------------------------------------------------- -const char* cmTarget::NormalGetLocation(const char* config) const +const char* cmTarget::GetLocationForBuild() const { static std::string location; - // Handle the configuration-specific case first. - if(config) + if(this->IsImported()) { - location = this->GetFullPath(config, false); + location = this->ImportedGetFullPath("", false); return location.c_str(); } @@ -2503,7 +2496,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const if(this->IsAppBundleOnApple()) { - std::string macdir = this->BuildMacContentDirectory("", config, false); + std::string macdir = this->BuildMacContentDirectory("", "", false); if(!macdir.empty()) { location += "/"; @@ -2511,7 +2504,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const } } location += "/"; - location += this->GetFullName(config, false); + location += this->GetFullName("", false); return location.c_str(); } @@ -2659,7 +2652,7 @@ const char *cmTarget::GetProperty(const std::string& prop, // cannot take into account the per-configuration name of the // target because the configuration type may not be known at // CMake time. - this->Properties.SetProperty("LOCATION", this->GetLocation(0), + this->Properties.SetProperty("LOCATION", this->GetLocationForBuild(), cmProperty::TARGET); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ec74e0504..41f84a60d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -331,10 +331,14 @@ public: std::string GetCompilePDBDirectory(const char* config = 0) const; /** Get the location of the target in the build tree for the given - configuration. This location is suitable for use as the LOCATION - target property. */ + configuration. */ const char* GetLocation(const char* config) const; + /** Get the location of the target in the build tree with a placeholder + referencing the configuration in the native build system. This + location is suitable for use as the LOCATION target property. */ + const char* GetLocationForBuild() const; + /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is not set or cannot be parsed. */ @@ -643,9 +647,6 @@ private: // Get the target base name. std::string GetOutputName(const char* config, bool implib) const; - const char* ImportedGetLocation(const char* config) const; - const char* NormalGetLocation(const char* config) const; - std::string GetFullNameImported(const char* config, bool implib) const; std::string ImportedGetFullPath(const char* config, bool implib) const; From 84fdc9921cab35addba8c57cd201778de2cf87a4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 22:48:34 -0500 Subject: [PATCH 133/278] stringapi: Pass configuration names as strings --- Source/CPack/cmCPackGenerator.cxx | 7 +- Source/cmComputeLinkDepends.cxx | 7 +- Source/cmComputeLinkDepends.h | 5 +- Source/cmComputeLinkInformation.cxx | 7 +- Source/cmComputeLinkInformation.h | 4 +- Source/cmComputeTargetDepends.cxx | 6 +- Source/cmComputeTargetDepends.h | 2 +- Source/cmCoreTryCompile.cxx | 2 +- Source/cmCustomCommandGenerator.cxx | 2 +- Source/cmCustomCommandGenerator.h | 5 +- Source/cmExportBuildFileGenerator.cxx | 8 +- Source/cmExportBuildFileGenerator.h | 4 +- Source/cmExportFileGenerator.cxx | 25 +- Source/cmExportFileGenerator.h | 16 +- Source/cmExportInstallFileGenerator.cxx | 11 +- Source/cmExportInstallFileGenerator.h | 6 +- Source/cmExportTryCompileFileGenerator.h | 6 +- Source/cmExtraSublimeTextGenerator.cxx | 4 +- Source/cmGeneratorExpression.cxx | 4 +- Source/cmGeneratorExpression.h | 4 +- .../cmGeneratorExpressionEvaluationFile.cxx | 4 +- Source/cmGeneratorExpressionEvaluationFile.h | 2 +- Source/cmGeneratorExpressionEvaluator.cxx | 6 +- Source/cmGeneratorExpressionEvaluator.h | 2 +- Source/cmGeneratorTarget.cxx | 30 +- Source/cmGeneratorTarget.h | 10 +- Source/cmGlobalGenerator.cxx | 17 +- Source/cmGlobalGenerator.h | 10 +- Source/cmGlobalNinjaGenerator.cxx | 6 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 8 +- Source/cmGlobalVisualStudio6Generator.h | 4 +- Source/cmGlobalVisualStudio7Generator.cxx | 8 +- Source/cmGlobalVisualStudio7Generator.h | 4 +- Source/cmGlobalXCodeGenerator.cxx | 27 +- Source/cmGlobalXCodeGenerator.h | 11 +- Source/cmInstallExportGenerator.cxx | 2 +- Source/cmInstallFilesGenerator.cxx | 4 +- Source/cmInstallFilesGenerator.h | 2 +- Source/cmInstallGenerator.cxx | 2 +- Source/cmInstallGenerator.h | 2 +- Source/cmInstallTargetGenerator.cxx | 29 +- Source/cmInstallTargetGenerator.h | 25 +- Source/cmLocalGenerator.cxx | 38 +-- Source/cmLocalGenerator.h | 20 +- Source/cmLocalVisualStudio6Generator.cxx | 16 +- Source/cmLocalVisualStudio6Generator.h | 9 +- Source/cmLocalVisualStudio7Generator.cxx | 16 +- Source/cmLocalVisualStudio7Generator.h | 8 +- Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmLocalVisualStudioGenerator.h | 5 +- Source/cmLocalXCodeGenerator.cxx | 4 +- Source/cmMakefile.cxx | 13 +- Source/cmMakefile.h | 4 +- Source/cmMakefileTargetGenerator.cxx | 15 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.cxx | 2 +- Source/cmOSXBundleGenerator.h | 4 +- Source/cmQtAutoGenerators.cxx | 21 +- Source/cmQtAutoGenerators.h | 4 +- Source/cmScriptGenerator.cxx | 21 +- Source/cmScriptGenerator.h | 10 +- Source/cmTarget.cxx | 277 +++++++++--------- Source/cmTarget.h | 147 +++++----- Source/cmTestGenerator.cxx | 2 +- Source/cmTestGenerator.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.h | 2 +- Source/cmXCodeObject.h | 12 +- Source/cmcmd.cxx | 2 +- 74 files changed, 539 insertions(+), 485 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index bed3891c0..4c52c9614 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -623,7 +623,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( componentsVector.push_back(installComponent); } - const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG"); + const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG"); + std::string buildConfig = buildConfigCstr ? buildConfigCstr : ""; cmGlobalGenerator* globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( cmakeGenerator); @@ -822,9 +823,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << "'" << std::endl); } - if ( buildConfig && *buildConfig ) + if (!buildConfig.empty()) { - mf->AddDefinition("BUILD_TYPE", buildConfig); + mf->AddDefinition("BUILD_TYPE", buildConfig.c_str()); } std::string installComponentLowerCase = cmSystemTools::LowerCase(installComponent); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 6c1c1de22..2d1da558a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -172,7 +172,7 @@ satisfy dependencies. //---------------------------------------------------------------------------- cmComputeLinkDepends -::cmComputeLinkDepends(cmTarget const* target, const char* config, +::cmComputeLinkDepends(cmTarget const* target, const std::string& config, cmTarget const* head) { // Store context information. @@ -184,7 +184,8 @@ cmComputeLinkDepends this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // The configuration being linked. - this->Config = (config && *config)? config : 0; + this->HasConfig = !config.empty(); + this->Config = (this->HasConfig)? config : std::string(); this->LinkType = this->Target->ComputeLinkType(this->Config); // Enable debug mode if requested. @@ -255,7 +256,7 @@ cmComputeLinkDepends::Compute() "---------------------------------------\n"); fprintf(stderr, "Link dependency analysis for target %s, config %s\n", this->Target->GetName().c_str(), - this->Config?this->Config:"noconfig"); + this->HasConfig?this->Config.c_str():"noconfig"); this->DisplayConstraintGraph(); } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index ac5e368ae..13fc993fb 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -32,7 +32,7 @@ class cmake; class cmComputeLinkDepends { public: - cmComputeLinkDepends(cmTarget const* target, const char* config, + cmComputeLinkDepends(cmTarget const* target, const std::string& config, cmTarget const* head); ~cmComputeLinkDepends(); @@ -68,7 +68,8 @@ private: bool DebugMode; // Configuration information. - const char* Config; + bool HasConfig; + std::string Config; cmTarget::LinkLibraryType LinkType; // Output information. diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 32b23b8e4..e4e204738 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -239,7 +239,7 @@ because this need be done only for shared libraries without soname-s. //---------------------------------------------------------------------------- cmComputeLinkInformation -::cmComputeLinkInformation(cmTarget const* target, const char* config, +::cmComputeLinkInformation(cmTarget const* target, const std::string& config, cmTarget const* headTarget) { // Store context information. @@ -505,7 +505,8 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget); + cmComputeLinkDepends cld(this->Target, this->Config.c_str(), + this->HeadTarget); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -624,7 +625,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget const* tgt) { // Compute the proper name to use to link this library. - const char* config = this->Config; + const std::string& config = this->Config; bool impexe = (tgt && tgt->IsExecutableWithExports()); if(impexe && !this->UseImportLibrary && !this->LoaderFlag) { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index b5a8bec6b..e345fe259 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -29,7 +29,7 @@ class cmOrderDirectories; class cmComputeLinkInformation { public: - cmComputeLinkInformation(cmTarget const* target, const char* config, + cmComputeLinkInformation(cmTarget const* target, const std::string& config, cmTarget const* headTarget); ~cmComputeLinkInformation(); bool Compute(); @@ -82,7 +82,7 @@ private: cmake* CMakeInstance; // Configuration information. - const char* Config; + std::string Config; std::string LinkLanguage; bool LinkDependsNoShared; diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 405643e1b..10041db8a 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -214,7 +214,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) std::set emitted; { std::vector tlibs; - depender->GetDirectLinkLibraries(0, tlibs, depender); + depender->GetDirectLinkLibraries("", tlibs, depender); // A target should not depend on itself. emitted.insert(depender->GetName()); for(std::vector::const_iterator lib = tlibs.begin(); @@ -274,7 +274,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) //---------------------------------------------------------------------------- void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, cmTarget const* dependee, - const char *config, + const std::string& config, std::set &emitted) { cmTarget const* depender = this->Targets[depender_index]; @@ -317,7 +317,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, if(dependee) { - this->AddInterfaceDepends(depender_index, dependee, 0, emitted); + this->AddInterfaceDepends(depender_index, dependee, "", emitted); std::vector configs; depender->GetMakefile()->GetConfigurations(configs); for (std::vector::const_iterator it = configs.begin(); diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index db76a1803..755381635 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -55,7 +55,7 @@ private: const std::string& dependee_name, bool linking, std::set &emitted); void AddInterfaceDepends(int depender_index, cmTarget const* dependee, - const char *config, + const std::string& config, std::set &emitted); cmGlobalGenerator* GlobalGenerator; bool DebugMode; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ea3e81462..ab7b024bf 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -357,7 +357,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) cmExportTryCompileFileGenerator tcfg; tcfg.SetExportFile((this->BinaryDirectory + fname).c_str()); tcfg.SetExports(targets); - tcfg.SetConfig(this->Makefile->GetDefinition( + tcfg.SetConfig(this->Makefile->GetSafeDefinition( "CMAKE_TRY_COMPILE_CONFIGURATION")); if(!tcfg.GenerateImportFile()) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index f24dfa212..d8a756dc9 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -18,7 +18,7 @@ //---------------------------------------------------------------------------- cmCustomCommandGenerator::cmCustomCommandGenerator( - cmCustomCommand const& cc, const char* config, cmMakefile* mf): + cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), GE(new cmGeneratorExpression(cc.GetBacktrace())) diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 4e89f2731..17d644af3 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -22,14 +22,15 @@ class cmGeneratorExpression; class cmCustomCommandGenerator { cmCustomCommand const& CC; - const char* Config; + std::string Config; cmMakefile* Makefile; cmLocalGenerator* LG; bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; public: - cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config, + cmCustomCommandGenerator(cmCustomCommand const& cc, + const std::string& config, cmMakefile* mf); ~cmCustomCommandGenerator(); unsigned int GetNumberOfCommands() const; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 308956a60..f991f457a 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -118,8 +118,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) void cmExportBuildFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix, - std::vector &missingTargets) + const std::string& config, + std::string const& suffix, + std::vector &missingTargets) { for(std::vector::const_iterator tei = this->Exports.begin(); @@ -166,7 +167,8 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet) //---------------------------------------------------------------------------- void cmExportBuildFileGenerator -::SetImportLocationProperty(const char* config, std::string const& suffix, +::SetImportLocationProperty(const std::string& config, + std::string const& suffix, cmTarget* target, ImportPropertyMap& properties) { // Get the makefile in which to lookup target information. diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index cea2099b7..c1bdb5b95 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -52,7 +52,7 @@ protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, @@ -66,7 +66,7 @@ protected: int occurrences); /** Fill in properties indicating built file locations. */ - void SetImportLocationProperty(const char* config, + void SetImportLocationProperty(const std::string& config, std::string const& suffix, cmTarget* target, ImportPropertyMap& properties); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index c06f88966..3c3c6df48 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -35,7 +35,7 @@ cmExportFileGenerator::cmExportFileGenerator() } //---------------------------------------------------------------------------- -void cmExportFileGenerator::AddConfiguration(const char* config) +void cmExportFileGenerator::AddConfiguration(const std::string& config) { this->Configurations.push_back(config); } @@ -117,12 +117,12 @@ bool cmExportFileGenerator::GenerateImportFile() //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportConfig(std::ostream& os, - const char* config, + const std::string& config, std::vector &missingTargets) { // Construct the property configuration suffix. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -345,7 +345,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( true); this->ReplaceInstallPrefix(dirs); cmsys::auto_ptr cge = ge.Parse(dirs); - std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0, + std::string exportDirs = cge->Evaluate(target->GetMakefile(), "", false, target); if (cge->GetHadContextSensitiveCondition()) @@ -426,7 +426,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop, //---------------------------------------------------------------------------- void getCompatibleInterfaceProperties(cmTarget *target, std::set &ifaceProperties, - const char *config) + const std::string& config) { cmComputeLinkInformation *info = target->GetLinkInformation(config); @@ -490,7 +490,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( if (target->GetType() != cmTarget::INTERFACE_LIBRARY) { - getCompatibleInterfaceProperties(target, ifaceProperties, 0); + getCompatibleInterfaceProperties(target, ifaceProperties, ""); std::vector configNames; target->GetMakefile()->GetConfigurations(configNames); @@ -687,7 +687,7 @@ cmExportFileGenerator::ReplaceInstallPrefix(std::string &) //---------------------------------------------------------------------------- void cmExportFileGenerator -::SetImportLinkInterface(const char* config, std::string const& suffix, +::SetImportLinkInterface(const std::string& config, std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets) @@ -762,7 +762,8 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator -::SetImportDetailProperties(const char* config, std::string const& suffix, +::SetImportDetailProperties(const std::string& config, + std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets ) @@ -864,11 +865,11 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, - const char* config) + const std::string& config) { os << "#----------------------------------------------------------------\n" << "# Generated CMake target import file"; - if(config) + if(!config.empty()) { os << " for configuration \"" << config << "\".\n"; } @@ -999,7 +1000,7 @@ cmExportFileGenerator //---------------------------------------------------------------------------- void cmExportFileGenerator -::GenerateImportPropertyCode(std::ostream& os, const char* config, +::GenerateImportPropertyCode(std::ostream& os, const std::string& config, cmTarget const* target, ImportPropertyMap const& properties) { @@ -1013,7 +1014,7 @@ cmExportFileGenerator << config << "\"\n"; os << "set_property(TARGET " << targetName << " APPEND PROPERTY IMPORTED_CONFIGURATIONS "; - if(config && *config) + if(!config.empty()) { os << cmSystemTools::UpperCase(config); } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 9e3ce0b49..cf91c6985 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -56,7 +56,7 @@ public: void SetExportOld(bool exportOld) { this->ExportOld = exportOld; } /** Add a configuration to be exported. */ - void AddConfiguration(const char* config); + void AddConfiguration(const std::string& config); /** Actually generate the export file. Returns whether there was an error. */ @@ -67,15 +67,16 @@ protected: // Generate per-configuration target information to the given output // stream. - void GenerateImportConfig(std::ostream& os, const char* config, + void GenerateImportConfig(std::ostream& os, const std::string& config, std::vector &missingTargets); // Methods to implement export file code generation. - void GenerateImportHeaderCode(std::ostream& os, const char* config = 0); + void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); void GenerateImportTargetCode(std::ostream& os, cmTarget const* target); - void GenerateImportPropertyCode(std::ostream& os, const char* config, + void GenerateImportPropertyCode(std::ostream& os, const std::string& config, cmTarget const* target, ImportPropertyMap const& properties); void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target, @@ -90,7 +91,7 @@ protected: // Collect properties with detailed information about targets beyond // their location on disk. - void SetImportDetailProperties(const char* config, + void SetImportDetailProperties(const std::string& config, std::string const& suffix, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); @@ -105,7 +106,7 @@ protected: /** Each subclass knows where the target files are located. */ virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets) = 0; @@ -137,7 +138,8 @@ protected: ImportPropertyMap &properties, std::vector &missingTargets); - void SetImportLinkInterface(const char* config, std::string const& suffix, + void SetImportLinkInterface(const std::string& config, + std::string const& suffix, cmGeneratorExpression::PreprocessContext preprocessRule, cmTarget* target, ImportPropertyMap& properties, std::vector& missingTargets); diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index b57996305..5e7d5e44c 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -240,7 +240,8 @@ cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input) //---------------------------------------------------------------------------- bool -cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, +cmExportInstallFileGenerator::GenerateImportFileConfig( + const std::string& config, std::vector &missingTargets) { // Skip configurations not enabled for this export. @@ -254,7 +255,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, fileName += "/"; fileName += this->FileBase; fileName += "-"; - if(config && *config) + if(!config.empty()) { fileName += cmSystemTools::LowerCase(config); } @@ -296,7 +297,8 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config, void cmExportInstallFileGenerator ::GenerateImportTargetsConfig(std::ostream& os, - const char* config, std::string const& suffix, + const std::string& config, + std::string const& suffix, std::vector &missingTargets) { // Add each target in the set to the export. @@ -355,7 +357,8 @@ cmExportInstallFileGenerator //---------------------------------------------------------------------------- void cmExportInstallFileGenerator -::SetImportLocationProperty(const char* config, std::string const& suffix, +::SetImportLocationProperty(const std::string& config, + std::string const& suffix, cmInstallTargetGenerator* itgen, ImportPropertyMap& properties, std::set& importedLocations diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index 5ee2a7802..b851ad5f3 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -52,7 +52,7 @@ protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream& os, - const char* config, + const std::string& config, std::string const& suffix, std::vector &missingTargets); virtual void HandleMissingTarget(std::string& link_libs, @@ -72,11 +72,11 @@ protected: /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const char* config, + bool GenerateImportFileConfig(const std::string& config, std::vector &missingTargets); /** Fill in properties indicating installed file locations. */ - void SetImportLocationProperty(const char* config, + void SetImportLocationProperty(const std::string& config, std::string const& suffix, cmInstallTargetGenerator* itgen, ImportPropertyMap& properties, diff --git a/Source/cmExportTryCompileFileGenerator.h b/Source/cmExportTryCompileFileGenerator.h index a16fe6b91..ec70d8103 100644 --- a/Source/cmExportTryCompileFileGenerator.h +++ b/Source/cmExportTryCompileFileGenerator.h @@ -23,14 +23,14 @@ public: /** Set the list of targets to export. */ void SetExports(const std::vector &exports) { this->Exports = exports; } - void SetConfig(const char *config) { this->Config = config; } + void SetConfig(const std::string& config) { this->Config = config; } protected: // Implement virtual methods from the superclass. virtual bool GenerateMainFile(std::ostream& os); virtual void GenerateImportTargetsConfig(std::ostream&, - const char*, + const std::string&, std::string const&, std::vector&) {} virtual void HandleMissingTarget(std::string&, @@ -51,7 +51,7 @@ private: std::vector Exports; - const char *Config; + std::string Config; }; #endif diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 9c2849c01..03c7c9297 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -375,7 +375,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source, { language = "C"; } - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add language-specific flags. lg->AddLanguageFlags(flags, language, config); @@ -425,7 +425,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, std::set defines; cmMakefile *makefile = lg->GetMakefile(); const std::string& language = source->GetLanguage(); - const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); // Add the export symbol definition for shared library objects. if(const char* exportMacro = target->GetExportMacro()) diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 433adcf7c..e4187d286 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -52,7 +52,7 @@ cmGeneratorExpression::~cmGeneratorExpression() //---------------------------------------------------------------------------- const char *cmCompiledGeneratorExpression::Evaluate( - cmMakefile* mf, const char* config, bool quiet, + cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmGeneratorExpressionDAGChecker *dagChecker) const { @@ -66,7 +66,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( //---------------------------------------------------------------------------- const char *cmCompiledGeneratorExpression::Evaluate( - cmMakefile* mf, const char* config, bool quiet, + cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmTarget const* currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) const diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 9aa590d36..5b97e8b2a 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -78,12 +78,12 @@ private: class cmCompiledGeneratorExpression { public: - const char* Evaluate(cmMakefile* mf, const char* config, + const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet = false, cmTarget const* headTarget = 0, cmTarget const* currentTarget = 0, cmGeneratorExpressionDAGChecker *dagChecker = 0) const; - const char* Evaluate(cmMakefile* mf, const char* config, + const char* Evaluate(cmMakefile* mf, const std::string& config, bool quiet, cmTarget const* headTarget, cmGeneratorExpressionDAGChecker *dagChecker) const; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index bf858700d..90ce27cdd 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -33,7 +33,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( } //---------------------------------------------------------------------------- -void cmGeneratorExpressionEvaluationFile::Generate(const char *config, +void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles) { @@ -135,7 +135,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() if (allConfigs.empty()) { - this->Generate(0, inputExpression.get(), outputFiles); + this->Generate("", inputExpression.get(), outputFiles); } else { diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 20ee5cb2d..f939916d6 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -32,7 +32,7 @@ public: std::vector GetFiles() const { return this->Files; } private: - void Generate(const char *config, + void Generate(const std::string& config, cmCompiledGeneratorExpression* inputExpression, std::map &outputFiles); diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index d12a66de0..43c1794e9 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -689,7 +689,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode cmGeneratorExpressionDAGChecker *) const { context->HadContextSensitiveCondition = true; - return context->Config ? context->Config : ""; + return context->Config; } } configurationNode; @@ -718,13 +718,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode return std::string(); } context->HadContextSensitiveCondition = true; - if (!context->Config) + if (context->Config.empty()) { return parameters.front().empty() ? "1" : "0"; } if (cmsysString_strcasecmp(parameters.begin()->c_str(), - context->Config) == 0) + context->Config.c_str()) == 0) { return "1"; } diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h index 0c8a9cf59..a7099cbc0 100644 --- a/Source/cmGeneratorExpressionEvaluator.h +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -27,7 +27,7 @@ struct cmGeneratorExpressionContext std::set AllTargets; std::set SeenTargetProperties; cmMakefile *Makefile; - const char *Config; + std::string Config; cmTarget const* HeadTarget; // The target whose property is being evaluated. cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears // directly or indirectly in the property. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f7f6febd0..eb67f9140 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -252,7 +252,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const } static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, - const char *config, cmTarget *headTarget, + const std::string& config, + cmTarget *headTarget, cmGeneratorExpressionDAGChecker *dagChecker, std::vector& result, bool excludeImported) @@ -390,12 +391,12 @@ void cmGeneratorTarget::GetResxSources(std::vector& srcs) const } //---------------------------------------------------------------------------- -bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir, - const char *config) const +bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, + const std::string& config) const { assert(this->GetType() != cmTarget::INTERFACE_LIBRARY); std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -802,7 +803,7 @@ cmTargetTraceDependencies { const cmsys::auto_ptr cge = ge.Parse(*cli); - cge->Evaluate(this->Makefile, 0, true); + cge->Evaluate(this->Makefile, "", true); std::set geTargets = cge->GetTargets(); for(std::set::const_iterator it = geTargets.begin(); it != geTargets.end(); ++it) @@ -863,11 +864,11 @@ void cmGeneratorTarget::TraceDependencies() } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetAppleArchs(const char* config, +void cmGeneratorTarget::GetAppleArchs(const std::string& config, std::vector& archVec) const { const char* archs = 0; - if(config && *config) + if(!config.empty()) { std::string defVarName = "OSX_ARCHITECTURES_"; defVarName += cmSystemTools::UpperCase(config); @@ -904,13 +905,14 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const //---------------------------------------------------------------------------- std::vector -cmGeneratorTarget::GetIncludeDirectories(const char *config) const +cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const { return this->Target->GetIncludeDirectories(config); } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GenerateTargetManifest(const char* config) const +void cmGeneratorTarget::GenerateTargetManifest( + const std::string& config) const { if (this->Target->IsImported()) { @@ -953,35 +955,35 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const f = dir; f += "/"; f += name; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!soName.empty()) { f = dir; f += "/"; f += soName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!realName.empty()) { f = dir; f += "/"; f += realName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!pdbName.empty()) { f = dir; f += "/"; f += pdbName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } if(!impName.empty()) { f = this->Target->GetDirectory(config, true); f += "/"; f += impName; - gg->AddToManifest(config? config:"", f); + gg->AddToManifest(config, f); } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b15bade37..81a447f46 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -61,7 +61,7 @@ public: void UseObjectLibraries(std::vector& objs) const; - void GetAppleArchs(const char* config, + void GetAppleArchs(const std::string& config, std::vector& archVec) const; ///! Return the rule variable used to create this type of target, @@ -69,12 +69,14 @@ public: const char* GetCreateRuleVariable() const; /** Get the include directories for this target. */ - std::vector GetIncludeDirectories(const char *config) const; + std::vector GetIncludeDirectories( + const std::string& config) const; - bool IsSystemIncludeDirectory(const char *dir, const char *config) const; + bool IsSystemIncludeDirectory(const std::string& dir, + const std::string& config) const; /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config) const; + void GenerateTargetManifest(const std::string& config) const; /** * Trace through the source files in this target and add al source files diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9748c6147..70cc16f3a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1655,7 +1655,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, #endif // WIN32 #endif } - const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); + std::string config = + mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, newTarget.c_str(), output,0,config,false,fast, @@ -1664,7 +1665,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const std::string&, - const char*, const std::string&, const char*, bool, + const char*, const std::string&, const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1676,7 +1677,7 @@ int cmGlobalGenerator::Build( const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, - const char *config, + const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag, @@ -1788,13 +1789,14 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( - const std::string& target, const char* config, const char* native, + const std::string& target, const std::string& config, + const char* native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); makeCommand += " --build ."; - if(config && *config) + if(!config.empty()) { makeCommand += " --config \""; makeCommand += config; @@ -2526,7 +2528,8 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*, +void cmGlobalGenerator::AppendDirectoryForConfig(const char*, + const std::string&, const char*, std::string&) { // Subclasses that support multiple configurations should implement @@ -2677,7 +2680,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target, //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddToManifest(const char* config, +void cmGlobalGenerator::AddToManifest(const std::string& config, std::string const& f) { // Add to the main manifest for this configuration. diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f06162c84..e9a1b4740 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -120,7 +120,7 @@ public: int Build(const char *srcdir, const char *bindir, const std::string& projectName, const std::string& targetName, std::string *output, - const char *makeProgram, const char *config, + const char *makeProgram, const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, @@ -131,13 +131,13 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, const char *projectDir, - const std::string& targetName, const char* config, bool fast, + const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); /** Generate a "cmake --build" call for a given target and config. */ std::string GenerateCMakeBuildCommand(const std::string& target, - const char* config, + const std::string& config, const char* native, bool ignoreErrors); @@ -173,7 +173,7 @@ public: cmExportSetMap& GetExportSets() {return this->ExportSets;} /** Add a file to the manifest of generated targets for a configuration. */ - void AddToManifest(const char* config, std::string const& f); + void AddToManifest(const std::string& config, std::string const& f); void EnableInstallTarget(); @@ -231,7 +231,7 @@ public: appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 977b3a1c8..16e9788eb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -555,7 +555,7 @@ void cmGlobalNinjaGenerator const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, - const char* /*config*/, + const std::string& /*config*/, bool /*fast*/, std::vector const& makeOptions) { @@ -834,8 +834,8 @@ void cmGlobalNinjaGenerator ::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs) { - const char* configName = - target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE"); + std::string configName = + target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmLocalNinjaGenerator *ng = static_cast(this->LocalGenerators[0]); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e422e36a1..86c2912f7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -197,7 +197,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a392aa6fd..d94715096 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -569,7 +569,7 @@ void cmGlobalUnixMakefileGenerator3 const std::string& /*projectName*/, const char* /*projectDir*/, const std::string& targetName, - const char* /*config*/, + const std::string& /*config*/, bool fast, std::vector const& makeOptions) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index b61619d41..8924fa836 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -113,7 +113,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index a2991e100..0bc572b36 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -314,7 +314,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions) { @@ -397,7 +397,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( makeCommand.push_back(targetProject); } std::string configArg = "/p:Configuration="; - if(config && strlen(config)) + if(!config.empty()) { configArg += config; } diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 97ac9bc01..085f2d2ae 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -38,7 +38,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index a7f65872b..f69bcfd99 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions ) @@ -149,7 +149,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( targetArg += "ALL_BUILD"; } targetArg += " - "; - if(config && strlen(config)) + if(!config.empty()) { targetArg += config; } @@ -419,11 +419,11 @@ void cmGlobalVisualStudio6Generator void cmGlobalVisualStudio6Generator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 3665f7b78..22ec926a8 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -58,7 +58,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -82,7 +82,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 2a97edc80..18f7f195f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -187,7 +187,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions) { @@ -224,7 +224,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( makeCommand.push_back("/build"); } - if(config && strlen(config)) + if(!config.empty()) { makeCommand.push_back(config); } @@ -962,11 +962,11 @@ void cmGlobalVisualStudio7Generator void cmGlobalVisualStudio7Generator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 2e58f6c15..009f0025b 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -66,7 +66,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -94,7 +94,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 08e9adf43..c0077b923 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -264,7 +264,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( const std::string& projectName, const char* /*projectDir*/, const std::string& targetName, - const char* config, + const std::string& config, bool /*fast*/, std::vector const& makeOptions) { @@ -298,11 +298,6 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.push_back("build"); } makeCommand.push_back("-target"); - // if it is a null string for config don't use it - if(config && *config == 0) - { - config = 0; - } if (!realTarget.empty()) { makeCommand.push_back(realTarget); @@ -319,7 +314,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( else { makeCommand.push_back("-configuration"); - makeCommand.push_back(config?config:"Debug"); + makeCommand.push_back(!config.empty()?config:"Debug"); } makeCommand.insert(makeCommand.end(), makeOptions.begin(), makeOptions.end()); @@ -1547,7 +1542,7 @@ void cmGlobalXCodeGenerator cmTarget& target, std::vector const & commands, - const char* configName, + const std::string& configName, const std::map& multipleOutputPairs ) @@ -1690,8 +1685,8 @@ void cmGlobalXCodeGenerator //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, - cmXCodeObject* buildSettings, - const char* configName) + cmXCodeObject* buildSettings, + const std::string& configName) { if(target.GetType() == cmTarget::INTERFACE_LIBRARY) { @@ -1804,7 +1799,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->CurrentLocalGenerator-> AppendFlags(extraLinkOptions, targetLinkFlags); } - if(configName && *configName) + if(!configName.empty()) { std::string linkFlagsVar = "LINK_FLAGS_"; linkFlagsVar += cmSystemTools::UpperCase(configName); @@ -2738,7 +2733,7 @@ void cmGlobalXCodeGenerator ::AppendBuildSettingAttribute(cmXCodeObject* target, const char* attribute, const char* value, - const char* configName) + const std::string& configName) { if(this->XcodeVersion < 21) { @@ -2761,9 +2756,9 @@ void cmGlobalXCodeGenerator for(std::vector::iterator i = list.begin(); i != list.end(); ++i) { - if(configName) + if(!configName.empty()) { - if(strcmp((*i)->GetObject("name")->GetString(), configName) == 0) + if((*i)->GetObject("name")->GetString() == configName) { cmXCodeObject* settings = (*i)->GetObject("buildSettings"); this->AppendOrAddBuildSetting(settings, attribute, value); @@ -3777,13 +3772,13 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) void cmGlobalXCodeGenerator ::AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir) { if(this->XcodeVersion > 20) { - if(config) + if(!config.empty()) { dir += prefix; dir += config; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index d2dd491f3..03e75c4d6 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -59,7 +59,7 @@ public: const std::string& projectName, const char* projectDir, const std::string& targetName, - const char* config, + const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); @@ -73,7 +73,7 @@ public: /** Append the subdirectory for the given configuration. */ virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, + const std::string& config, const char* suffix, std::string& dir); @@ -123,7 +123,7 @@ private: void CreateCustomRulesMakefile(const char* makefileBasename, cmTarget& target, std::vector const & commands, - const char* configName, + const std::string& configName, const std::map& multipleOutputPairs ); @@ -147,12 +147,13 @@ private: void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, const char* value); void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr, - const char* value, const char* configName); + const char* value, + const std::string& configName); cmXCodeObject* CreateUtilityTarget(cmTarget& target); void AddDependAndLinkInformation(cmXCodeObject* target); void CreateBuildSettings(cmTarget& target, cmXCodeObject* buildSettings, - const char* buildType); + const std::string& buildType); std::string ExtractFlag(const char* flag, std::string& flags); // delete all objects in the this->XCodeObjects vector. void ClearXCodeObjects(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 045cff649..d2737a1e7 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -142,7 +142,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) this->EFGen->SetExportOld(this->ExportOld); if(this->ConfigurationTypes->empty()) { - if(this->ConfigurationName && *this->ConfigurationName) + if(!this->ConfigurationName.empty()) { this->EFGen->AddConfiguration(this->ConfigurationName); } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index ec15044c7..65942180a 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -80,8 +80,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, //---------------------------------------------------------------------------- void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, - Indent const& indent) + const std::string& config, + Indent const& indent) { std::vector files; cmListFileBacktrace lfbt; diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 9dea296d2..23bf935db 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -35,7 +35,7 @@ public: protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); void AddFilesInstallRule(std::ostream& os, Indent const& indent, std::vector const& files); diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index d105a0c20..0fad9d66c 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -163,7 +163,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) } //---------------------------------------------------------------------------- -bool cmInstallGenerator::InstallsForConfig(const char* config) +bool cmInstallGenerator::InstallsForConfig(const std::string& config) { return this->GeneratesForConfig(config); } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index c89ab8ac5..c72e9e96c 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -48,7 +48,7 @@ public: std::string GetInstallDestination() const; /** Test if this generator installs something for a given configuration. */ - bool InstallsForConfig(const char*); + bool InstallsForConfig(const std::string& config); protected: virtual void GenerateScript(std::ostream& os); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5df6e4bcd..ec2b51864 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -59,8 +59,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) //---------------------------------------------------------------------------- void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, - Indent const& indent) + const std::string& config, + Indent const& indent) { // Compute the build tree directory from which to copy the target. std::string fromDirConfig; @@ -319,7 +319,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, //---------------------------------------------------------------------------- std::string -cmInstallTargetGenerator::GetInstallFilename(const char* config) const +cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const { NameType nameType = this->ImportLibrary? NameImplib : NameNormal; return @@ -330,7 +330,7 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const //---------------------------------------------------------------------------- std::string cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, - const char* config, + const std::string& config, NameType nameType) { std::string fname; @@ -405,7 +405,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, //---------------------------------------------------------------------------- void cmInstallTargetGenerator -::AddTweak(std::ostream& os, Indent const& indent, const char* config, +::AddTweak(std::ostream& os, Indent const& indent, const std::string& config, std::string const& file, TweakMethod tweak) { cmOStringStream tw; @@ -423,7 +423,7 @@ cmInstallTargetGenerator //---------------------------------------------------------------------------- void cmInstallTargetGenerator -::AddTweak(std::ostream& os, Indent const& indent, const char* config, +::AddTweak(std::ostream& os, Indent const& indent, const std::string& config, std::vector const& files, TweakMethod tweak) { if(files.size() == 1) @@ -470,7 +470,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file) //---------------------------------------------------------------------------- void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& file) { this->AddRPathCheckRule(os, indent, config, file); @@ -478,9 +478,9 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os, //---------------------------------------------------------------------------- void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, - Indent const& indent, - const char* config, - std::string const& file) + Indent const& indent, + const std::string& config, + std::string const& file) { this->AddInstallNamePatchRule(os, indent, config, file); this->AddChrpathPatchRule(os, indent, config, file); @@ -492,7 +492,8 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, void cmInstallTargetGenerator ::AddInstallNamePatchRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { if(this->ImportLibrary || !(this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -605,7 +606,8 @@ cmInstallTargetGenerator void cmInstallTargetGenerator ::AddRPathCheckRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) @@ -642,7 +644,8 @@ cmInstallTargetGenerator void cmInstallTargetGenerator ::AddChrpathPatchRule(std::ostream& os, Indent const& indent, - const char* config, std::string const& toDestDirPath) + const std::string& config, + std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 18c395707..0f21da79e 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -43,7 +43,7 @@ public: void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; } NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; } - std::string GetInstallFilename(const char* config) const; + std::string GetInstallFilename(const std::string& config) const; enum NameType { @@ -54,7 +54,7 @@ public: }; static std::string GetInstallFilename(cmTarget const* target, - const char* config, + const std::string& config, NameType nameType = NameNormal); cmTarget* GetTarget() const { return this->Target; } @@ -63,30 +63,33 @@ public: protected: virtual void GenerateScript(std::ostream& os); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); typedef void (cmInstallTargetGenerator::*TweakMethod)( - std::ostream&, Indent const&, const char*, std::string const& + std::ostream&, Indent const&, const std::string&, std::string const& ); void AddTweak(std::ostream& os, Indent const& indent, - const char* config, std::string const& file, + const std::string& config, std::string const& file, TweakMethod tweak); void AddTweak(std::ostream& os, Indent const& indent, - const char* config, std::vector const& files, + const std::string& config, + std::vector const& files, TweakMethod tweak); std::string GetDestDirPath(std::string const& file); void PreReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, std::string const& file); + const std::string& config, + std::string const& file); void PostReplacementTweaks(std::ostream& os, Indent const& indent, - const char* config, std::string const& file); + const std::string& config, + std::string const& file); void AddInstallNamePatchRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, const std::string& toDestDirPath); void AddChrpathPatchRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& toDestDirPath); void AddRPathCheckRule(std::ostream& os, Indent const& indent, - const char* config, + const std::string& config, std::string const& toDestDirPath); void AddStripRule(std::ostream& os, Indent const& indent, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index e36266a7f..cd9f9bdb8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -280,7 +280,7 @@ void cmLocalGenerator::GenerateTestFiles() // Compute the set of configurations. std::vector configurationTypes; - const char* config = + const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); std::string file = this->Makefile->GetStartOutputDirectory(); @@ -384,11 +384,11 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the set of configurations. std::vector configurationTypes; - const char* config = + const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); // Choose a default install configuration. - const char* default_config = config; + const char* default_config = config.c_str(); const char* default_order[] = {"RELEASE", "MINSIZEREL", "RELWITHDEBINFO", "DEBUG", 0}; for(const char** c = default_order; *c && !default_config; ++c) @@ -557,7 +557,7 @@ void cmLocalGenerator::GenerateTargetManifest() } if(configNames.empty()) { - target.GenerateTargetManifest(0); + target.GenerateTargetManifest(""); } else { @@ -712,8 +712,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, vars.LinkFlags = linkFlags.c_str(); std::string langFlags; - this->AddLanguageFlags(langFlags, llang, 0); - this->AddArchitectureFlags(langFlags, &target, llang, 0); + this->AddLanguageFlags(langFlags, llang, ""); + this->AddArchitectureFlags(langFlags, &target, llang, ""); vars.LanguageCompileFlags = langFlags.c_str(); cmCustomCommandLines commandLines; @@ -1292,7 +1292,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmGeneratorTarget* target, const std::string& lang, bool forResponseFile, - const char *config) + const std::string& config) { if(lang.empty()) { @@ -1370,7 +1370,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if(!flagUsed || repeatFlag) { if(sysIncludeFlag && target && - target->IsSystemIncludeDirectory(i->c_str(), config)) + target->IsSystemIncludeDirectory(*i, config)) { includeFlags << sysIncludeFlag; } @@ -1405,7 +1405,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileDefinitions(std::set& defines, cmTarget const* target, - const char* config) + const std::string& config) { std::vector targetDefines; target->GetCompileDefinitions(targetDefines, @@ -1416,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set& defines, //---------------------------------------------------------------------------- void cmLocalGenerator::AddCompileOptions( std::string& flags, cmTarget* target, - const std::string& lang, const char* config + const std::string& lang, const std::string& config ) { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; @@ -1465,7 +1465,7 @@ void cmLocalGenerator::AddCompileOptions( void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, const std::string& lang, - const char *config, + const std::string& config, bool stripImplicitInclDirs ) { @@ -1698,7 +1698,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, target->Target->GetName().c_str()); return; } - this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); + this->AddLanguageFlags(flags, linkLanguage, buildType); this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *target, false, false); if(cmSystemTools::IsOn @@ -1945,7 +1945,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, const std::string& lang, - const char* config) + const std::string& config) { // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone): if(!this->Makefile->IsOn("APPLE")) @@ -2002,7 +2002,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddLanguageFlags(std::string& flags, const std::string& lang, - const char* config) + const std::string& config) { // Add language-specific flags. std::string flagsVar = "CMAKE_"; @@ -2013,7 +2013,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, //---------------------------------------------------------------------------- bool cmLocalGenerator::GetRealDependency(const std::string& inName, - const char* config, + const std::string& config, std::string& dep) { // Older CMake code may specify the dependency using the target @@ -2211,7 +2211,7 @@ void cmLocalGenerator //---------------------------------------------------------------------------- void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, std::string const& lang, - const char *config) + const std::string& config) { int targetType = target->GetType(); @@ -2327,13 +2327,13 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, //---------------------------------------------------------------------------- void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, const std::string& var, - const char* config) + const std::string& config) { // Add the flags from the variable itself. std::string flagsVar = var; this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); // Add the flags from the build-type specific variable. - if(config && *config) + if(!config.empty()) { flagsVar += "_"; flagsVar += cmSystemTools::UpperCase(config); @@ -2837,7 +2837,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector& local, void cmLocalGenerator ::GenerateTargetInstallRules( - std::ostream& os, const char* config, + std::ostream& os, const std::string& config, std::vector const& configurationTypes) { // Convert the old-style install specification from each target to diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 3fe6a26de..4d62833d9 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -138,16 +138,16 @@ public: void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, - const std::string&lang, const char* config); + const std::string&lang, const std::string& config); void AddLanguageFlags(std::string& flags, const std::string& lang, - const char* config); + const std::string& config); void AddCMP0018Flags(std::string &flags, cmTarget* target, - std::string const& lang, const char *config); + std::string const& lang, const std::string& config); void AddVisibilityPresetFlags(std::string &flags, cmTarget* target, const std::string& lang); void AddConfigVariableFlags(std::string& flags, const std::string& var, - const char* config); + const std::string& config); ///! Append flags to a string. virtual void AppendFlags(std::string& flags, const char* newFlags); virtual void AppendFlagEscape(std::string& flags, @@ -157,7 +157,7 @@ public: cmGeneratorTarget* target, const std::string& lang, bool forResponseFile = false, - const char *config = 0); + const std::string& config = ""); /** * Encode a list of preprocessor definitions for the compiler @@ -196,7 +196,7 @@ public: * the source directory of this generator. This should only be * used for dependencies of custom commands. */ - bool GetRealDependency(const std::string& name, const char* config, + bool GetRealDependency(const std::string& name, const std::string& config, std::string& dep); ///! for existing files convert to output path and short path if spaces @@ -227,13 +227,13 @@ public: void GetIncludeDirectories(std::vector& dirs, cmGeneratorTarget* target, const std::string& lang = "C", - const char *config = 0, + const std::string& config = "", bool stripImplicitInclDirs = true); void AddCompileOptions(std::string& flags, cmTarget* target, - const std::string& lang, const char* config); + const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set& defines, cmTarget const* target, - const char* config); + const std::string& config); /** Compute the language used to compile the given source file. */ std::string GetSourceFileLanguage(const cmSourceFile& source); @@ -410,7 +410,7 @@ protected: // Handle old-style install rules stored in the targets. void GenerateTargetInstallRules( - std::ostream& os, const char* config, + std::ostream& os, const std::string& config, std::vector const& configurationTypes); std::string& CreateSafeUniqueObjectFileName(const std::string& sin, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b0c577ecb..0e246a52a 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -38,7 +38,7 @@ class cmLocalVisualStudio6Generator::EventWriter { public: EventWriter(cmLocalVisualStudio6Generator* lg, - const char* config, std::string& code): + const std::string& config, std::string& code): LG(lg), Config(config), Code(code), First(true) {} void Start(const char* event) { @@ -72,7 +72,7 @@ public: } private: cmLocalVisualStudio6Generator* LG; - const char* Config; + std::string Config; std::string& Code; bool First; std::string Event; @@ -785,7 +785,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, //---------------------------------------------------------------------------- cmsys::auto_ptr cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, - const char* config) + const std::string& config) { cmsys::auto_ptr pcc; @@ -813,7 +813,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, // look for custom rules on a target and collect them together std::string cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, - const char* configName, + const std::string& configName, const std::string& /* libName */) { if (target.GetType() >= cmTarget::UTILITY ) @@ -863,7 +863,7 @@ inline std::string removeQuotes(const std::string& s) std::string cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, - const char *config) + const std::string& config) { std::string includeOptions; @@ -1704,7 +1704,7 @@ void cmLocalVisualStudio6Generator flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; - this->AddCompileOptions(flags, &target, linkLanguage, 0); + this->AddCompileOptions(flags, &target, linkLanguage, ""); this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug"); this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release"); this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage, @@ -1730,7 +1730,7 @@ void cmLocalVisualStudio6Generator std::set minsizeDefinesSet; std::set debugrelDefinesSet; - this->AddCompileDefinitions(definesSet, &target, 0); + this->AddCompileDefinitions(definesSet, &target, ""); this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG"); this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE"); this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL"); @@ -1800,7 +1800,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout) //---------------------------------------------------------------------------- void cmLocalVisualStudio6Generator ::ComputeLinkOptions(cmTarget& target, - const char* configName, + const std::string& configName, const std::string extraOptions, std::string& options) { diff --git a/Source/cmLocalVisualStudio6Generator.h b/Source/cmLocalVisualStudio6Generator.h index 6702111ff..47718337b 100644 --- a/Source/cmLocalVisualStudio6Generator.h +++ b/Source/cmLocalVisualStudio6Generator.h @@ -81,16 +81,17 @@ private: class EventWriter; friend class EventWriter; cmsys::auto_ptr - MaybeCreateOutputDir(cmTarget& target, const char* config); + MaybeCreateOutputDir(cmTarget& target, const std::string& config); std::string CreateTargetRules(cmTarget &target, - const char* configName, + const std::string& configName, const std::string& libName); - void ComputeLinkOptions(cmTarget& target, const char* configName, + void ComputeLinkOptions(cmTarget& target, const std::string& configName, const std::string extraOptions, std::string& options); void OutputObjects(cmTarget& target, const char* tool, std::string& options); - std::string GetTargetIncludeOptions(cmTarget &target, const char *config); + std::string GetTargetIncludeOptions(cmTarget &target, + const std::string& config); std::vector Configurations; std::string GetConfigName(std::string const& configuration) const; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6ad5e04e9..5f98a713e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -588,7 +588,7 @@ class cmLocalVisualStudio7Generator::EventWriter { public: EventWriter(cmLocalVisualStudio7Generator* lg, - const char* config, std::ostream& os): + const std::string& config, std::ostream& os): LG(lg), Config(config), Stream(os), First(true) {} void Start(const char* tool) { @@ -629,14 +629,14 @@ public: } private: cmLocalVisualStudio7Generator* LG; - const char* Config; + std::string Config; std::ostream& Stream; bool First; }; //---------------------------------------------------------------------------- void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, - const char* configName, + const std::string& configName, const std::string& libName, cmTarget &target) { @@ -745,7 +745,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, table, this->ExtraFlagTable); targetOptions.FixExceptionHandlingDefault(); - std::string asmLocation = std::string(configName) + "/"; + std::string asmLocation = configName + "/"; targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str()); targetOptions.Parse(flags.c_str()); targetOptions.Parse(defineFlags.c_str()); @@ -944,7 +944,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, //---------------------------------------------------------------------------- std::string cmLocalVisualStudio7Generator -::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName) +::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, + const std::string& configName) { std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string extraLinkOptionsBuildTypeDef = @@ -958,7 +959,8 @@ cmLocalVisualStudio7Generator } void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, - const char* configName, cmTarget &target, const Options& targetOptions) + const std::string& configName, cmTarget &target, + const Options& targetOptions) { cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); @@ -1903,7 +1905,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout) // look for custom rules on a target and collect them together void cmLocalVisualStudio7Generator ::OutputTargetRules(std::ostream& fout, - const char* configName, + const std::string& configName, cmTarget &target, const std::string& /*libName*/) { diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 2823a2cc3..f9bb6e195 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -71,7 +71,7 @@ private: typedef cmVisualStudioGeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags, - const char* configName); + const std::string& configName); void FixGlobalTargets(); void WriteProjectFiles(); void WriteVCProjHeader(std::ostream& fout, const std::string& libName, @@ -82,14 +82,14 @@ private: void WriteConfigurations(std::ostream& fout, const std::string& libName, cmTarget &tgt); void WriteConfiguration(std::ostream& fout, - const char* configName, + const std::string& configName, const std::string& libName, cmTarget &tgt); std::string EscapeForXML(const std::string& s); std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path); - void OutputTargetRules(std::ostream& fout, const char* configName, + void OutputTargetRules(std::ostream& fout, const std::string& configName, cmTarget &target, const std::string& libName); - void OutputBuildTool(std::ostream& fout, const char* configName, + void OutputBuildTool(std::ostream& fout, const std::string& configName, cmTarget& t, const Options& targetOptions); void OutputLibraryDirectories(std::ostream& fout, std::vector const& dirs); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index ef2bb1d99..11b038772 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -33,7 +33,7 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator() //---------------------------------------------------------------------------- cmsys::auto_ptr cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, - const char* config, + const std::string& config, bool isFortran) { cmsys::auto_ptr pcc; @@ -80,7 +80,7 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, - const char* configName, + const std::string& configName, const char* newline_text) { bool useLocal = this->CustomCommandUseLocal(); diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 1a3499a96..2297072b5 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -47,7 +47,7 @@ public: /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, - const char* configName, + const std::string& configName, const char* newline = "\n"); /** Label to which to jump in a batch file after a failed step in a @@ -67,7 +67,8 @@ protected: /** Construct a custom command to make exe import lib dir. */ cmsys::auto_ptr - MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran); + MaybeCreateImplibDir(cmTarget& target, const std::string& config, + bool isFortran); VSVersion Version; }; diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index fb8c2d15e..5857aefa0 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -54,7 +54,7 @@ void cmLocalXCodeGenerator::Generate() iter != targets.end(); ++iter) { cmTarget* t = &iter->second; - t->HasMacOSXRpathInstallNameDir(NULL); + t->HasMacOSXRpathInstallNameDir(""); } } @@ -68,6 +68,6 @@ void cmLocalXCodeGenerator::GenerateInstallRules() iter != targets.end(); ++iter) { cmTarget* t = &iter->second; - t->HasMacOSXRpathInstallNameDir(NULL); + t->HasMacOSXRpathInstallNameDir(""); } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index d107ddf97..1ef4d46ba 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2734,7 +2734,7 @@ void cmMakefile::AddDefaultDefinitions() } //---------------------------------------------------------------------------- -const char* +std::string cmMakefile::GetConfigurations(std::vector& configs, bool single) const { @@ -2745,12 +2745,12 @@ cmMakefile::GetConfigurations(std::vector& configs, { cmSystemTools::ExpandListArgument(configTypes, configs); } - return 0; + return ""; } else { - const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE"); - if(single && buildType && *buildType) + const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE"); + if(single && !buildType.empty()) { configs.push_back(buildType); } @@ -3801,11 +3801,12 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const char* feature, const char* config) +const char* cmMakefile::GetFeature(const char* feature, + const std::string& config) { // TODO: Define accumulation policy for features (prepend, append, replace). // Currently we always replace. - if(config && *config) + if(!config.empty()) { std::string featureConfig = feature; featureConfig += "_"; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 86cedb030..1c3ad73f6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -320,7 +320,7 @@ public: } /** Get the configurations to be generated. */ - const char* GetConfigurations(std::vector& configs, + std::string GetConfigurations(std::vector& configs, bool single = true) const; /** @@ -811,7 +811,7 @@ public: cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; - const char* GetFeature(const char* feature, const char* config); + const char* GetFeature(const char* feature, const std::string& config); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0a836a564..1af5d6c79 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -133,7 +133,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->Makefile->GetProperty ("ADDITIONAL_MAKE_CLEAN_FILES")) { - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); cmsys::auto_ptr cge = @@ -1070,7 +1071,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); @@ -1567,7 +1569,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) #endif std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); @@ -1952,7 +1955,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, lang, config); @@ -2059,7 +2063,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector includes; - const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + const std::string& config = + this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, "C", config); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 5f697a502..21eece4db 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -183,7 +183,7 @@ protected: cmLocalUnixMakefileGenerator3 *LocalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator; cmMakefile *Makefile; - const char *ConfigName; + std::string ConfigName; enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility }; CustomCommandDriveType CustomCommandDriver; diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 78b59b382..449f923f6 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -19,7 +19,7 @@ //---------------------------------------------------------------------------- cmOSXBundleGenerator:: cmOSXBundleGenerator(cmGeneratorTarget* target, - const char* configName) + const std::string& configName) : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(Makefile->GetLocalGenerator()) diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 97ae7314b..95b4aef6c 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -27,7 +27,7 @@ class cmOSXBundleGenerator { public: cmOSXBundleGenerator(cmGeneratorTarget* target, - const char* configName); + const std::string& configName); // create an app bundle at a given root, and return // the directory within the bundle that contains the executable @@ -62,7 +62,7 @@ private: cmGeneratorTarget* GT; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; - const char* ConfigName; + std::string ConfigName; std::set* MacContentFolders; }; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index fbb3b1c61..8eee991a0 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -306,7 +306,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) } static void GetCompileDefinitionsAndDirectories(cmTarget const* target, - const char * config, + const std::string& config, std::string &incs, std::string &defs) { @@ -366,7 +366,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR"); } if (const char *targetQtVersion = - target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0)) + target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", "")) { qtVersion = targetQtVersion; } @@ -563,7 +563,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, std::string _moc_incs; std::string _moc_compile_defs; std::vector configs; - const char *config = makefile->GetConfigurations(configs); + const std::string& config = makefile->GetConfigurations(configs); GetCompileDefinitionsAndDirectories(target, config, _moc_incs, _moc_compile_defs); @@ -675,7 +675,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -static void GetUicOpts(cmTarget const* target, const char * config, +static void GetUicOpts(cmTarget const* target, const std::string& config, std::string &optString) { std::vector opts; @@ -717,7 +717,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::string _uic_opts; std::vector configs; - const char *config = makefile->GetConfigurations(configs); + const std::string& config = makefile->GetConfigurations(configs); GetUicOpts(target, config, _uic_opts); if (!_uic_opts.empty()) @@ -967,7 +967,8 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, return gg; } -bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config) +bool cmQtAutoGenerators::Run(const char* targetDirectory, + const std::string& config) { bool success = true; cmake cm; @@ -994,7 +995,7 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config) bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, const char* targetDirectory, - const char *config) + const std::string& config) { std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); cmSystemTools::ConvertToUnixSlashes(filename); @@ -1027,7 +1028,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, { std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS"; std::string compileDefsProp = compileDefsPropOrig; - if(config) + if(!config.empty()) { compileDefsProp += "_"; compileDefsProp += config; @@ -1039,7 +1040,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, { std::string includesPropOrig = "AM_MOC_INCLUDES"; std::string includesProp = includesPropOrig; - if(config) + if(!config.empty()) { includesProp += "_"; includesProp += config; @@ -1058,7 +1059,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, = makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES"); std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS"; std::string uicOptionsProp = uicOptionsPropOrig; - if(config) + if(!config.empty()) { uicOptionsProp += "_"; uicOptionsProp += config; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 2840fbf4b..af4ceb9f8 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -21,7 +21,7 @@ class cmQtAutoGenerators { public: cmQtAutoGenerators(); - bool Run(const char* targetDirectory, const char *config); + bool Run(const char* targetDirectory, const std::string& config); bool InitializeAutogenTarget(cmTarget* target); void SetupAutoGenerateTarget(cmTarget const* target); @@ -38,7 +38,7 @@ private: bool ReadAutogenInfoFile(cmMakefile* makefile, const char* targetDirectory, - const char *config); + const std::string& config); bool ReadOldMocDefinitionsFile(cmMakefile* makefile, const char* targetDirectory); void WriteOldMocDefinitionsFile(const char* targetDirectory); diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 7a8efc10c..7685d40f5 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -19,7 +19,7 @@ cmScriptGenerator std::vector const& configurations): RuntimeConfigVariable(config_var), Configurations(configurations), - ConfigurationName(0), + ConfigurationName(""), ConfigurationTypes(0), ActionsPerConfig(false) { @@ -34,21 +34,21 @@ cmScriptGenerator //---------------------------------------------------------------------------- void cmScriptGenerator -::Generate(std::ostream& os, const char* config, +::Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes) { this->ConfigurationName = config; this->ConfigurationTypes = &configurationTypes; this->GenerateScript(os); - this->ConfigurationName = 0; + this->ConfigurationName = ""; this->ConfigurationTypes = 0; } //---------------------------------------------------------------------------- -static void cmScriptGeneratorEncodeConfig(const char* config, +static void cmScriptGeneratorEncodeConfig(const std::string& config, std::string& result) { - for(const char* c = config; *c; ++c) + for(const char* c = config.c_str(); *c; ++c) { if(*c >= 'a' && *c <= 'z') { @@ -73,12 +73,12 @@ static void cmScriptGeneratorEncodeConfig(const char* config, //---------------------------------------------------------------------------- std::string -cmScriptGenerator::CreateConfigTest(const char* config) +cmScriptGenerator::CreateConfigTest(const std::string& config) { std::string result = "\"${"; result += this->RuntimeConfigVariable; result += "}\" MATCHES \"^("; - if(config && *config) + if(!config.empty()) { cmScriptGeneratorEncodeConfig(config, result); } @@ -142,14 +142,15 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os, } //---------------------------------------------------------------------------- -void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, const char*, +void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, + const std::string&, Indent const&) { // No actions for this generator. } //---------------------------------------------------------------------------- -bool cmScriptGenerator::GeneratesForConfig(const char* config) +bool cmScriptGenerator::GeneratesForConfig(const std::string& config) { // If this is not a configuration-specific rule then we install. if(this->Configurations.empty()) @@ -159,7 +160,7 @@ bool cmScriptGenerator::GeneratesForConfig(const char* config) // This is a configuration-specific rule. Check if the config // matches this rule. - std::string config_upper = cmSystemTools::UpperCase(config?config:""); + std::string config_upper = cmSystemTools::UpperCase(config); for(std::vector::const_iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 3515e204e..9ab04f17b 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -51,7 +51,7 @@ public: std::vector const& configurations); virtual ~cmScriptGenerator(); - void Generate(std::ostream& os, const char* config, + void Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes); const std::vector& GetConfigurations() const @@ -63,15 +63,15 @@ protected: virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {} virtual bool NeedsScriptNoConfig() const { return false; } // Test if this generator does something for a given configuration. - bool GeneratesForConfig(const char*); + bool GeneratesForConfig(const std::string&); - std::string CreateConfigTest(const char* config); + std::string CreateConfigTest(const std::string& config); std::string CreateConfigTest(std::vector const& configs); std::string CreateComponentTest(const char* component); @@ -80,7 +80,7 @@ protected: std::vector const Configurations; // Information used during generation. - const char* ConfigurationName; + std::string ConfigurationName; std::vector const* ConfigurationTypes; // True if the subclass needs to generate an explicit rule for each diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3273437c0..b8e662ae4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -109,7 +109,8 @@ public: const char* ExplicitLibraries; }; void ComputeLinkInterface(cmTarget const* thisTarget, - const char* config, OptionalLinkInterface& iface, + const std::string& config, + OptionalLinkInterface& iface, cmTarget const* head, const char *explicitLibraries) const; @@ -692,10 +693,11 @@ const std::vector& cmTarget::GetLinkDirectories() const } //---------------------------------------------------------------------------- -cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const +cmTarget::LinkLibraryType cmTarget::ComputeLinkType( + const std::string& config) const { // No configuration is always optimized. - if(!(config && *config)) + if(config.empty()) { return cmTarget::OPTIMIZED; } @@ -755,7 +757,7 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const } //---------------------------------------------------------------------------- -void cmTarget::GetDirectLinkLibraries(const char *config, +void cmTarget::GetDirectLinkLibraries(const std::string& config, std::vector &libs, cmTarget const* head) const { @@ -789,7 +791,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config, } //---------------------------------------------------------------------------- -void cmTarget::GetInterfaceLinkLibraries(const char *config, +void cmTarget::GetInterfaceLinkLibraries(const std::string& config, std::vector &libs, cmTarget const* head) const { @@ -1565,7 +1567,7 @@ static void processIncludeDirectories(cmTarget const* tgt, std::vector &includes, std::set &uniqueIncludes, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugIncludes) + const std::string& config, bool debugIncludes) { cmMakefile *mf = tgt->GetMakefile(); @@ -1730,7 +1732,7 @@ static void processIncludeDirectories(cmTarget const* tgt, //---------------------------------------------------------------------------- std::vector -cmTarget::GetIncludeDirectories(const char *config) const +cmTarget::GetIncludeDirectories(const std::string& config) const { std::vector includes; std::set uniqueIncludes; @@ -1767,8 +1769,7 @@ cmTarget::GetIncludeDirectories(const char *config) const config, debugIncludes); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]) + if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -1805,7 +1806,7 @@ cmTarget::GetIncludeDirectories(const char *config) const includeGenex); this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back( + ->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } @@ -1833,14 +1834,14 @@ cmTarget::GetIncludeDirectories(const char *config) const cmsys::auto_ptr cge = ge.Parse(libDir.c_str()); this->Internal - ->CachedLinkInterfaceIncludeDirectoriesEntries[configString] + ->CachedLinkInterfaceIncludeDirectoriesEntries[config] .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } } } processIncludeDirectories(this, - this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString], + this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config], includes, uniqueIncludes, &dagChecker, @@ -1854,7 +1855,7 @@ cmTarget::GetIncludeDirectories(const char *config) const } else { - this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString] + this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config] = true; } @@ -1867,7 +1868,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions, const char *logName) + const std::string& config, bool debugOptions, const char *logName) { cmMakefile *mf = tgt->GetMakefile(); @@ -1926,7 +1927,7 @@ static void processCompileOptions(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions) + const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, "options"); @@ -1934,7 +1935,7 @@ static void processCompileOptions(cmTarget const* tgt, //---------------------------------------------------------------------------- void cmTarget::GetAutoUicOptions(std::vector &result, - const char *config) const + const std::string& config) const { const char *prop = this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS", @@ -1960,7 +1961,7 @@ void cmTarget::GetAutoUicOptions(std::vector &result, //---------------------------------------------------------------------------- void cmTarget::GetCompileOptions(std::vector &result, - const char *config) const + const std::string& config) const { std::set uniqueOptions; cmListFileBacktrace lfbt; @@ -1996,8 +1997,7 @@ void cmTarget::GetCompileOptions(std::vector &result, config, debugOptions); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString]) + if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -2034,14 +2034,14 @@ void cmTarget::GetCompileOptions(std::vector &result, optionGenex); this->Internal - ->CachedLinkInterfaceCompileOptionsEntries[configString].push_back( + ->CachedLinkInterfaceCompileOptionsEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } } processCompileOptions(this, - this->Internal->CachedLinkInterfaceCompileOptionsEntries[configString], + this->Internal->CachedLinkInterfaceCompileOptionsEntries[config], result, uniqueOptions, &dagChecker, @@ -2054,7 +2054,7 @@ void cmTarget::GetCompileOptions(std::vector &result, } else { - this->Internal->CacheLinkInterfaceCompileOptionsDone[configString] = true; + this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true; } } @@ -2064,7 +2064,7 @@ static void processCompileDefinitions(cmTarget const* tgt, std::vector &options, std::set &uniqueOptions, cmGeneratorExpressionDAGChecker *dagChecker, - const char *config, bool debugOptions) + const std::string& config, bool debugOptions) { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, @@ -2073,7 +2073,7 @@ static void processCompileDefinitions(cmTarget const* tgt, //---------------------------------------------------------------------------- void cmTarget::GetCompileDefinitions(std::vector &list, - const char *config) const + const std::string& config) const { std::set uniqueOptions; cmListFileBacktrace lfbt; @@ -2109,8 +2109,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, config, debugDefines); - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]) + if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]) { for (std::vector::const_iterator it = this->Internal->LinkImplementationPropertyEntries.begin(), @@ -2147,11 +2146,11 @@ void cmTarget::GetCompileDefinitions(std::vector &list, defsGenex); this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back( + ->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back( new cmTargetInternals::TargetPropertyEntry(cge, it->Value)); } - if (config) + if (!config.empty()) { std::string configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); @@ -2174,7 +2173,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, cmsys::auto_ptr cge = ge.Parse(configProp); this->Internal - ->CachedLinkInterfaceCompileDefinitionsEntries[configString] + ->CachedLinkInterfaceCompileDefinitionsEntries[config] .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } break; @@ -2189,7 +2188,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } processCompileDefinitions(this, - this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString], + this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config], list, uniqueOptions, &dagChecker, @@ -2203,7 +2202,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, } else { - this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString] + this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config] = true; } } @@ -2333,7 +2332,8 @@ bool cmTarget::HaveWellDefinedOutputFiles() const } //---------------------------------------------------------------------------- -cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const +cmTarget::OutputInfo const* cmTarget::GetOutputInfo( + const std::string& config) const { // There is no output information for imported targets. if(this->IsImported()) @@ -2355,7 +2355,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const // Lookup/compute/cache the output information for this configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -2378,7 +2378,8 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const } //---------------------------------------------------------------------------- -cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const +cmTarget::CompileInfo const* cmTarget::GetCompileInfo( + const std::string& config) const { // There is no compile information for imported targets. if(this->IsImported()) @@ -2399,7 +2400,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const // Lookup/compute/cache the compile information for this configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -2417,7 +2418,8 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetDirectory(const char* config, bool implib) const +std::string cmTarget::GetDirectory(const std::string& config, + bool implib) const { if (this->IsImported()) { @@ -2435,7 +2437,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetPDBDirectory(const char* config) const +std::string cmTarget::GetPDBDirectory(const std::string& config) const { if(OutputInfo const* info = this->GetOutputInfo(config)) { @@ -2446,7 +2448,7 @@ std::string cmTarget::GetPDBDirectory(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBDirectory(const char* config) const +std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const { if(CompileInfo const* info = this->GetCompileInfo(config)) { @@ -2456,7 +2458,7 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const } //---------------------------------------------------------------------------- -const char* cmTarget::GetLocation(const char* config) const +const char* cmTarget::GetLocation(const std::string& config) const { static std::string location; if (this->IsImported()) @@ -2547,9 +2549,10 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const char* feature, const char* config) const +const char* cmTarget::GetFeature(const char* feature, + const std::string& config) const { - if(config && *config) + if(!config.empty()) { std::string featureConfig = feature; featureConfig += "_"; @@ -2798,7 +2801,8 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const class cmTargetCollectLinkLanguages { public: - cmTargetCollectLinkLanguages(cmTarget const* target, const char* config, + cmTargetCollectLinkLanguages(cmTarget const* target, + const std::string& config, std::set& languages, cmTarget const* head): Config(config), Languages(languages), HeadTarget(head), @@ -2870,7 +2874,7 @@ public: } } private: - const char* Config; + std::string Config; std::set& Languages; cmTarget const* HeadTarget; cmMakefile* Makefile; @@ -2879,7 +2883,7 @@ private: }; //---------------------------------------------------------------------------- -std::string cmTarget::GetLinkerLanguage(const char* config, +std::string cmTarget::GetLinkerLanguage(const std::string& config, cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; @@ -2887,10 +2891,11 @@ std::string cmTarget::GetLinkerLanguage(const char* config, } //---------------------------------------------------------------------------- -cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config, +cmTarget::LinkClosure const* cmTarget::GetLinkClosure( + const std::string& config, cmTarget const* head) const { - TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkClosureMapType::iterator i = this->Internal->LinkClosureMap.find(key); if(i == this->Internal->LinkClosureMap.end()) @@ -2957,7 +2962,7 @@ public: }; //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc, +void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, cmTarget const* head) const { // Get languages built in this target. @@ -3070,7 +3075,7 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetPDBName(const char* config) const +std::string cmTarget::GetPDBName(const std::string& config) const { std::string prefix; std::string base; @@ -3078,8 +3083,7 @@ std::string cmTarget::GetPDBName(const char* config) const this->GetFullNameInternal(config, false, prefix, base, suffix); std::vector props; - std::string configUpper = - cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); if(!configUpper.empty()) { // PDB_NAME_ @@ -3102,7 +3106,7 @@ std::string cmTarget::GetPDBName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBName(const char* config) const +std::string cmTarget::GetCompilePDBName(const std::string& config) const { std::string prefix; std::string base; @@ -3110,7 +3114,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const this->GetFullNameInternal(config, false, prefix, base, suffix); // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); std::string configProp = "COMPILE_PDB_NAME_"; configProp += configUpper; const char* config_name = this->GetProperty(configProp.c_str()); @@ -3129,7 +3133,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetCompilePDBPath(const char* config) const +std::string cmTarget::GetCompilePDBPath(const std::string& config) const { std::string dir = this->GetCompilePDBDirectory(config); std::string name = this->GetCompilePDBName(config); @@ -3145,7 +3149,7 @@ std::string cmTarget::GetCompilePDBPath(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasSOName(const char* config) const +bool cmTarget::HasSOName(const std::string& config) const { // soname is supported only for shared libraries and modules, // and then only when the platform supports an soname flag. @@ -3157,7 +3161,7 @@ bool cmTarget::HasSOName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetSOName(const char* config) const +std::string cmTarget::GetSOName(const std::string& config) const { if(this->IsImported()) { @@ -3199,7 +3203,7 @@ std::string cmTarget::GetSOName(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const +bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const { bool install_name_is_rpath = false; bool macosx_rpath = false; @@ -3311,7 +3315,8 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const } //---------------------------------------------------------------------------- -bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const +bool cmTarget::IsImportedSharedLibWithoutSOName( + const std::string& config) const { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) { @@ -3324,7 +3329,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::NormalGetRealName(const char* config) const +std::string cmTarget::NormalGetRealName(const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3362,7 +3367,8 @@ std::string cmTarget::NormalGetRealName(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetFullName(const char* config, bool implib) const +std::string cmTarget::GetFullName(const std::string& config, + bool implib) const { if(this->IsImported()) { @@ -3376,7 +3382,7 @@ std::string cmTarget::GetFullName(const char* config, bool implib) const //---------------------------------------------------------------------------- std::string -cmTarget::GetFullNameImported(const char* config, bool implib) const +cmTarget::GetFullNameImported(const std::string& config, bool implib) const { return cmSystemTools::GetFilenameName( this->ImportedGetFullPath(config, implib)); @@ -3384,14 +3390,15 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const //---------------------------------------------------------------------------- void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base, - std::string& suffix, const char* config, + std::string& suffix, + const std::string& config, bool implib) const { this->GetFullNameInternal(config, implib, prefix, base, suffix); } //---------------------------------------------------------------------------- -std::string cmTarget::GetFullPath(const char* config, bool implib, +std::string cmTarget::GetFullPath(const std::string& config, bool implib, bool realname) const { if(this->IsImported()) @@ -3405,8 +3412,8 @@ std::string cmTarget::GetFullPath(const char* config, bool implib, } //---------------------------------------------------------------------------- -std::string cmTarget::NormalGetFullPath(const char* config, bool implib, - bool realname) const +std::string cmTarget::NormalGetFullPath(const std::string& config, + bool implib, bool realname) const { std::string fpath = this->GetDirectory(config, implib); fpath += "/"; @@ -3434,7 +3441,7 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib, //---------------------------------------------------------------------------- std::string -cmTarget::ImportedGetFullPath(const char* config, bool implib) const +cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const { std::string result; if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this)) @@ -3451,7 +3458,7 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const //---------------------------------------------------------------------------- std::string -cmTarget::GetFullNameInternal(const char* config, bool implib) const +cmTarget::GetFullNameInternal(const std::string& config, bool implib) const { std::string prefix; std::string base; @@ -3461,7 +3468,7 @@ cmTarget::GetFullNameInternal(const char* config, bool implib) const } //---------------------------------------------------------------------------- -void cmTarget::GetFullNameInternal(const char* config, +void cmTarget::GetFullNameInternal(const std::string& config, bool implib, std::string& outPrefix, std::string& outBase, @@ -3507,7 +3514,7 @@ void cmTarget::GetFullNameInternal(const char* config, ? this->GetProperty("IMPORT_SUFFIX") : this->GetProperty("SUFFIX")); const char* configPostfix = 0; - if(config && *config) + if(!config.empty()) { std::string configProp = cmSystemTools::UpperCase(config); configProp += "_POSTFIX"; @@ -3604,7 +3611,7 @@ void cmTarget::GetLibraryNames(std::string& name, std::string& realName, std::string& impName, std::string& pdbName, - const char* config) const + const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3708,7 +3715,7 @@ void cmTarget::GetExecutableNames(std::string& name, std::string& realName, std::string& impName, std::string& pdbName, - const char* config) const + const std::string& config) const { // This should not be called for imported targets. // TODO: Split cmTarget into a class hierarchy to get compile-time @@ -3804,7 +3811,7 @@ void cmTarget::SetPropertyDefault(const std::string& property, } //---------------------------------------------------------------------------- -bool cmTarget::HaveBuildTreeRPATH(const char *config) const +bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) { @@ -3824,7 +3831,7 @@ bool cmTarget::HaveInstallTreeRPATH() const } //---------------------------------------------------------------------------- -bool cmTarget::NeedRelinkBeforeInstall(const char* config) const +bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const { // Only executables and shared libraries can have an rpath and may // need relinking. @@ -3888,7 +3895,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const +std::string cmTarget::GetInstallNameDirForBuildTree( + const std::string& config) const { // If building directly for installation then the build tree install_name // is the same as the install tree. @@ -4010,10 +4018,11 @@ const char* cmTarget::GetOutputTargetType(bool implib) const } //---------------------------------------------------------------------------- -bool cmTarget::ComputeOutputDir(const char* config, +bool cmTarget::ComputeOutputDir(const std::string& config, bool implib, std::string& out) const { bool usesDefaultOutputDir = false; + std::string conf = config; // Look for a target property defining the target output directory // based on the target type. @@ -4027,7 +4036,7 @@ bool cmTarget::ComputeOutputDir(const char* config, } // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(conf); const char* configProp = 0; std::string configPropStr = targetTypeName; if(!configPropStr.empty()) @@ -4044,7 +4053,7 @@ bool cmTarget::ComputeOutputDir(const char* config, out = config_outdir; // Skip per-configuration subdirectory. - config = 0; + conf = ""; } else if(const char* outdir = this->GetProperty(propertyName)) { @@ -4077,21 +4086,21 @@ bool cmTarget::ComputeOutputDir(const char* config, (out.c_str(), this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. - if(config && *config) + if(!conf.empty()) { const char *platforms = this->Makefile->GetDefinition( "CMAKE_XCODE_EFFECTIVE_PLATFORMS"); std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", config, suffix.c_str(), out); + AppendDirectoryForConfig("/", conf, suffix.c_str(), out); } return usesDefaultOutputDir; } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, +bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config, std::string& out) const { // Look for a target property defining the target output directory @@ -4103,9 +4112,10 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, propertyNameStr += "_OUTPUT_DIRECTORY"; propertyName = propertyNameStr.c_str(); } + std::string conf = config; // Check for a per-configuration output directory target property. - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(conf); const char* configProp = 0; std::string configPropStr = kind; if(!configPropStr.empty()) @@ -4122,7 +4132,7 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, out = config_outdir; // Skip per-configuration subdirectory. - config = 0; + conf = ""; } else if(const char* outdir = this->GetProperty(propertyName)) { @@ -4141,27 +4151,29 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config, (out.c_str(), this->Makefile->GetStartOutputDirectory())); // The generator may add the configuration's subdirectory. - if(config && *config) + if(!conf.empty()) { this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", config, "", out); + AppendDirectoryForConfig("/", conf, "", out); } return true; } //---------------------------------------------------------------------------- -bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const +bool cmTarget::UsesDefaultOutputDir(const std::string& config, + bool implib) const { std::string dir; return this->ComputeOutputDir(config, implib, dir); } //---------------------------------------------------------------------------- -std::string cmTarget::GetOutputName(const char* config, bool implib) const +std::string cmTarget::GetOutputName(const std::string& config, + bool implib) const { std::vector props; std::string type = this->GetOutputTargetType(implib); - std::string configUpper = cmSystemTools::UpperCase(config? config : ""); + std::string configUpper = cmSystemTools::UpperCase(config); if(!type.empty() && !configUpper.empty()) { // _OUTPUT_NAME_ @@ -4495,7 +4507,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant) template PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, const std::string &p, - const char *config, + const std::string& config, const char *defaultValue, CompatibleType t, PropertyType *) @@ -4679,7 +4691,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, //---------------------------------------------------------------------------- bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, config, "FALSE", BoolType, 0); @@ -4687,8 +4699,8 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p, //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentStringProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4699,8 +4711,8 @@ const char * cmTarget::GetLinkInterfaceDependentStringProperty( //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4711,8 +4723,8 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty( //---------------------------------------------------------------------------- const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( - const std::string &p, - const char *config) const + const std::string &p, + const std::string& config) const { return checkInterfacePropertyCompatibility(this, p, @@ -4724,7 +4736,7 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty( //---------------------------------------------------------------------------- bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, const std::string& interfaceProperty, - const char *config) + const std::string& config) { std::vector deps; tgt->GetTransitiveTargetClosure(config, tgt, deps); @@ -4762,7 +4774,7 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4776,7 +4788,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4790,7 +4802,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4803,7 +4815,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p, //---------------------------------------------------------------------------- bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const + const std::string& config) const { if (this->TargetTypeValue == OBJECT_LIBRARY || this->TargetTypeValue == INTERFACE_LIBRARY) @@ -4829,7 +4841,7 @@ void cmTarget::GetLanguages(std::set& languages) const } //---------------------------------------------------------------------------- -bool cmTarget::IsChrpathUsed(const char* config) const +bool cmTarget::IsChrpathUsed(const std::string& config) const { // Only certain target types have an rpath. if(!(this->GetType() == cmTarget::SHARED_LIBRARY || @@ -4897,7 +4909,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const //---------------------------------------------------------------------------- cmTarget::ImportInfo const* -cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const +cmTarget::GetImportInfo(const std::string& config, + cmTarget const* headTarget) const { // There is no imported information for non-imported targets. if(!this->IsImported()) @@ -4908,7 +4921,7 @@ cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const // Lookup/compute/cache the import information for this // configuration. std::string config_upper; - if(config && *config) + if(!config.empty()) { config_upper = cmSystemTools::UpperCase(config); } @@ -5262,7 +5275,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } //---------------------------------------------------------------------------- -cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, +cmTarget::LinkInterface const* cmTarget::GetLinkInterface( + const std::string& config, cmTarget const* head) const { // Imported targets have their own link interface. @@ -5284,7 +5298,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkInterfaceMapType::iterator i = this->Internal->LinkInterfaceMap.find(key); @@ -5315,7 +5329,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config, //---------------------------------------------------------------------------- cmTarget::LinkInterface const* -cmTarget::GetLinkInterfaceLibraries(const char* config, +cmTarget::GetLinkInterfaceLibraries(const std::string& config, cmTarget const* head) const { // Imported targets have their own link interface. @@ -5337,7 +5351,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config, } // Lookup any existing link interface for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkInterfaceMapType::iterator i = this->Internal->LinkInterfaceMap.find(key); @@ -5359,7 +5373,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config, } //---------------------------------------------------------------------------- -void processILibs(const char* config, +void processILibs(const std::string& config, cmTarget const* headTarget, std::string const& name, std::vector& tgts, std::set& emitted) @@ -5387,7 +5401,7 @@ void processILibs(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::GetTransitiveTargetClosure(const char* config, +void cmTarget::GetTransitiveTargetClosure(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { @@ -5404,7 +5418,7 @@ void cmTarget::GetTransitiveTargetClosure(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::GetTransitivePropertyTargets(const char* config, +void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { @@ -5464,14 +5478,14 @@ void cmTarget::GetTransitivePropertyTargets(const char* config, } //---------------------------------------------------------------------------- -const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, +const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* headTarget, bool &exists) const { // Construct the property name suffix for this configuration. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -5642,7 +5656,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config, //---------------------------------------------------------------------------- void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, - const char* config, + const std::string& config, OptionalLinkInterface& iface, cmTarget const* headTarget, const char* explicitLibraries) const @@ -5714,7 +5728,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, { // Construct the property name suffix for this configuration. std::string suffix = "_"; - if(config && *config) + if(!config.empty()) { suffix += cmSystemTools::UpperCase(config); } @@ -5742,7 +5756,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const +cmTarget::GetLinkImplementation(const std::string& config, + cmTarget const* head) const { // There is no link implementation for imported targets. if(this->IsImported()) @@ -5751,7 +5766,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -5776,7 +5791,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const //---------------------------------------------------------------------------- cmTarget::LinkImplementation const* -cmTarget::GetLinkImplementationLibraries(const char* config, +cmTarget::GetLinkImplementationLibraries(const std::string& config, cmTarget const* head) const { // There is no link implementation for imported targets. @@ -5786,7 +5801,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config, } // Lookup any existing link implementation for this configuration. - TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : "")); + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); cmTargetInternals::LinkImplMapType::iterator i = this->Internal->LinkImplMap.find(key); @@ -5805,7 +5820,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config, } //---------------------------------------------------------------------------- -void cmTarget::ComputeLinkImplementation(const char* config, +void cmTarget::ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const { @@ -5970,14 +5985,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const template PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType, PropertyType *); template<> bool getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType, bool *) { return tgt->GetLinkInterfaceDependentBoolProperty(prop, config); @@ -5986,7 +6001,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt, template<> const char * getLinkInterfaceDependentProperty(cmTarget const* tgt, const std::string& prop, - const char *config, + const std::string& config, CompatibleType t, const char **) { @@ -6012,7 +6027,7 @@ void checkPropertyConsistency(cmTarget const* depender, cmTarget const* dependee, const std::string& propName, std::set &emitted, - const char *config, + const std::string& config, CompatibleType t, PropertyType *) { @@ -6101,7 +6116,7 @@ static std::string intersect(const std::set &s1, //---------------------------------------------------------------------------- void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, - const char* config) const + const std::string& config) const { const cmComputeLinkInformation::ItemVector &deps = info->GetItems(); @@ -6205,12 +6220,12 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info, //---------------------------------------------------------------------------- cmComputeLinkInformation* -cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const +cmTarget::GetLinkInformation(const std::string& config, + cmTarget const* head) const { cmTarget const* headTarget = head ? head : this; // Lookup any existing information for this configuration. - TargetConfigPair key(headTarget, - cmSystemTools::UpperCase(config?config:"")); + TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config)); cmTargetLinkInformationMap::iterator i = this->LinkInformation.find(key); if(i == this->LinkInformation.end()) @@ -6237,7 +6252,7 @@ cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetFrameworkDirectory(const char* config, +std::string cmTarget::GetFrameworkDirectory(const std::string& config, bool rootDir) const { std::string fpath; @@ -6252,7 +6267,7 @@ std::string cmTarget::GetFrameworkDirectory(const char* config, } //---------------------------------------------------------------------------- -std::string cmTarget::GetCFBundleDirectory(const char* config, +std::string cmTarget::GetCFBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath; @@ -6271,7 +6286,7 @@ std::string cmTarget::GetCFBundleDirectory(const char* config, } //---------------------------------------------------------------------------- -std::string cmTarget::GetAppBundleDirectory(const char* config, +std::string cmTarget::GetAppBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath = this->GetFullName(config, false); @@ -6283,7 +6298,7 @@ std::string cmTarget::GetAppBundleDirectory(const char* config, //---------------------------------------------------------------------------- std::string cmTarget::BuildMacContentDirectory(const std::string& base, - const char* config, + const std::string& config, bool contentOnly) const { std::string fpath = base; @@ -6303,7 +6318,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base, } //---------------------------------------------------------------------------- -std::string cmTarget::GetMacContentDirectory(const char* config, +std::string cmTarget::GetMacContentDirectory(const std::string& config, bool implib) const { // Start with the output directory for the target. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 41f84a60d..65fbb0feb 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -155,15 +155,15 @@ public: return this->LinkLibraries;} const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} - void GetDirectLinkLibraries(const char *config, + void GetDirectLinkLibraries(const std::string& config, std::vector &, cmTarget const* head) const; - void GetInterfaceLinkLibraries(const char *config, + void GetInterfaceLinkLibraries(const std::string& config, std::vector &, cmTarget const* head) const; /** Compute the link type to use for the given configuration. */ - LinkLibraryType ComputeLinkType(const char* config) const; + LinkLibraryType ComputeLinkType(const std::string& config) const; /** * Clear the dependency information recorded for this target, if any. @@ -232,7 +232,8 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - const char* GetFeature(const char* feature, const char* config) const; + const char* GetFeature(const char* feature, + const std::string& config) const; bool IsImported() const {return this->IsImportedTarget;} @@ -264,14 +265,14 @@ public: /** Get the link interface for the given configuration. Returns 0 if the target cannot be linked. */ - LinkInterface const* GetLinkInterface(const char* config, + LinkInterface const* GetLinkInterface(const std::string& config, cmTarget const* headTarget) const; - LinkInterface const* GetLinkInterfaceLibraries(const char* config, + LinkInterface const* GetLinkInterfaceLibraries(const std::string& config, cmTarget const* headTarget) const; - void GetTransitivePropertyTargets(const char* config, + void GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &libs) const; - void GetTransitiveTargetClosure(const char* config, + void GetTransitiveTargetClosure(const std::string& config, cmTarget const* headTarget, std::vector &libs) const; @@ -289,10 +290,11 @@ public: // Needed only for OLD behavior of CMP0003. std::vector WrongConfigLibraries; }; - LinkImplementation const* GetLinkImplementation(const char* config, + LinkImplementation const* GetLinkImplementation(const std::string& config, cmTarget const* head) const; - LinkImplementation const* GetLinkImplementationLibraries(const char* config, + LinkImplementation const* GetLinkImplementationLibraries( + const std::string& config, cmTarget const* head) const; /** Link information from the transitive closure of the link @@ -305,7 +307,7 @@ public: // Languages whose runtime libraries must be linked. std::vector Languages; }; - LinkClosure const* GetLinkClosure(const char* config, + LinkClosure const* GetLinkClosure(const std::string& config, cmTarget const* head) const; /** Strip off leading and trailing whitespace from an item named in @@ -316,23 +318,24 @@ public: configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical output directory is given. */ - std::string GetDirectory(const char* config = 0, bool implib = false) const; + std::string GetDirectory(const std::string& config = "", + bool implib = false) const; /** Get the directory in which this targets .pdb files will be placed. If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical pdb output directory is given. */ - std::string GetPDBDirectory(const char* config) const; + std::string GetPDBDirectory(const std::string& config) const; /** Get the directory in which to place the target compiler .pdb file. If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical compiler pdb output directory is given. */ - std::string GetCompilePDBDirectory(const char* config = 0) const; + std::string GetCompilePDBDirectory(const std::string& config = "") const; /** Get the location of the target in the build tree for the given configuration. */ - const char* GetLocation(const char* config) const; + const char* GetLocation(const std::string& config) const; /** Get the location of the target in the build tree with a placeholder referencing the configuration in the native build system. This @@ -351,44 +354,46 @@ public: GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; ///! Return the preferred linker language for this target - std::string GetLinkerLanguage(const char* config = 0, + std::string GetLinkerLanguage(const std::string& config = "", cmTarget const* head = 0) const; /** Get the full name of the target according to the settings in its makefile. */ - std::string GetFullName(const char* config=0, bool implib = false) const; + std::string GetFullName(const std::string& config="", + bool implib = false) const; void GetFullNameComponents(std::string& prefix, std::string& base, std::string& suffix, - const char* config=0, bool implib = false) const; + const std::string& config="", + bool implib = false) const; /** Get the name of the pdb file for the target. */ - std::string GetPDBName(const char* config) const; + std::string GetPDBName(const std::string& config) const; /** Get the name of the compiler pdb file for the target. */ - std::string GetCompilePDBName(const char* config=0) const; + std::string GetCompilePDBName(const std::string& config="") const; /** Get the path for the MSVC /Fd option for this target. */ - std::string GetCompilePDBPath(const char* config=0) const; + std::string GetCompilePDBPath(const std::string& config="") const; /** Whether this library has soname enabled and platform supports it. */ - bool HasSOName(const char* config) const; + bool HasSOName(const std::string& config) const; /** Get the soname of the target. Allowed only for a shared library. */ - std::string GetSOName(const char* config) const; + std::string GetSOName(const std::string& config) const; /** Whether this library has \@rpath and platform supports it. */ - bool HasMacOSXRpathInstallNameDir(const char* config) const; + bool HasMacOSXRpathInstallNameDir(const std::string& config) const; /** Whether this library defaults to \@rpath. */ bool MacOSXRpathInstallNameDirDefault() const; /** Test for special case of a third-party shared library that has no soname at all. */ - bool IsImportedSharedLibWithoutSOName(const char* config) const; + bool IsImportedSharedLibWithoutSOName(const std::string& config) const; /** Get the full path to the target according to the settings in its makefile and the configuration type. */ - std::string GetFullPath(const char* config=0, bool implib = false, + std::string GetFullPath(const std::string& config="", bool implib = false, bool realname = false) const; /** Get the names of the library needed to generate a build rule @@ -396,14 +401,15 @@ public: should be called only on a library target. */ void GetLibraryNames(std::string& name, std::string& soName, std::string& realName, std::string& impName, - std::string& pdbName, const char* config) const; + std::string& pdbName, const std::string& config) const; /** Get the names of the executable needed to generate a build rule that takes into account executable version numbers. This should be called only on an executable target. */ void GetExecutableNames(std::string& name, std::string& realName, std::string& impName, - std::string& pdbName, const char* config) const; + std::string& pdbName, + const std::string& config) const; /** Does this target have a GNU implib to convert to MS format? */ bool HasImplibGNUtoMS() const; @@ -416,24 +422,24 @@ public: /** * Compute whether this target must be relinked before installing. */ - bool NeedRelinkBeforeInstall(const char* config) const; + bool NeedRelinkBeforeInstall(const std::string& config) const; - bool HaveBuildTreeRPATH(const char *config) const; + bool HaveBuildTreeRPATH(const std::string& config) const; bool HaveInstallTreeRPATH() const; /** Return true if builtin chrpath will work for this target */ - bool IsChrpathUsed(const char* config) const; + bool IsChrpathUsed(const std::string& config) const; /** Return the install name directory for the target in the * build tree. For example: "\@rpath/", "\@loader_path/", * or "/full/path/to/library". */ - std::string GetInstallNameDirForBuildTree(const char* config) const; + std::string GetInstallNameDirForBuildTree(const std::string& config) const; /** Return the install name directory for the target in the * install tree. For example: "\@rpath/" or "\@loader_path/". */ std::string GetInstallNameDirForInstallTree() const; - cmComputeLinkInformation* GetLinkInformation(const char* config, + cmComputeLinkInformation* GetLinkInformation(const std::string& config, cmTarget const* head = 0) const; // Get the properties @@ -452,7 +458,7 @@ public: const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, - const char *config) const; + const std::string& config) const; // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change @@ -500,26 +506,29 @@ public: /** Return whether this target uses the default value for its output directory. */ - bool UsesDefaultOutputDir(const char* config, bool implib) const; + bool UsesDefaultOutputDir(const std::string& config, bool implib) const; /** @return the mac content directory for this target. */ - std::string GetMacContentDirectory(const char* config, + std::string GetMacContentDirectory(const std::string& config, bool implib) const; /** @return whether this target have a well defined output file name. */ bool HaveWellDefinedOutputFiles() const; /** @return the Mac framework directory without the base. */ - std::string GetFrameworkDirectory(const char* config, bool rootDir) const; + std::string GetFrameworkDirectory(const std::string& config, + bool rootDir) const; /** @return the Mac CFBundle directory without the base */ - std::string GetCFBundleDirectory(const char* config, bool contentOnly) const; + std::string GetCFBundleDirectory(const std::string& config, + bool contentOnly) const; /** @return the Mac App directory without the base */ - std::string GetAppBundleDirectory(const char* config, + std::string GetAppBundleDirectory(const std::string& config, bool contentOnly) const; - std::vector GetIncludeDirectories(const char *config) const; + std::vector GetIncludeDirectories( + const std::string& config) const; void InsertInclude(const cmValueWithOrigin &entry, bool before = false); void InsertCompileOption(const cmValueWithOrigin &entry, @@ -529,29 +538,29 @@ public: void AppendBuildInterfaceIncludes(); void GetCompileOptions(std::vector &result, - const char *config) const; + const std::string& config) const; void GetAutoUicOptions(std::vector &result, - const char *config) const; + const std::string& config) const; bool IsNullImpliedByLinkLibraries(const std::string &p) const; bool IsLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const; + const std::string& config) const; bool GetLinkInterfaceDependentBoolProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentStringProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p, - const char *config) const; + const std::string& config) const; const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p, - const char *config) const; + const std::string& config) const; std::string GetDebugGeneratorExpressions(const std::string &value, cmTarget::LinkLibraryType llt) const; @@ -631,8 +640,9 @@ private: const char* GetSuffixVariableInternal(bool implib) const; const char* GetPrefixVariableInternal(bool implib) const; - std::string GetFullNameInternal(const char* config, bool implib) const; - void GetFullNameInternal(const char* config, bool implib, + std::string GetFullNameInternal(const std::string& config, + bool implib) const; + void GetFullNameInternal(const std::string& config, bool implib, std::string& outPrefix, std::string& outBase, std::string& outSuffix) const; @@ -645,23 +655,25 @@ private: const char* GetOutputTargetType(bool implib) const; // Get the target base name. - std::string GetOutputName(const char* config, bool implib) const; + std::string GetOutputName(const std::string& config, bool implib) const; - std::string GetFullNameImported(const char* config, bool implib) const; + std::string GetFullNameImported(const std::string& config, + bool implib) const; - std::string ImportedGetFullPath(const char* config, bool implib) const; - std::string NormalGetFullPath(const char* config, bool implib, + std::string ImportedGetFullPath(const std::string& config, + bool implib) const; + std::string NormalGetFullPath(const std::string& config, bool implib, bool realname) const; /** Get the real name of the target. Allowed only for non-imported targets. When a library or executable file is versioned this is the full versioned name. If the target is not versioned this is the same as GetFullName. */ - std::string NormalGetRealName(const char* config) const; + std::string NormalGetRealName(const std::string& config) const; /** Append to @a base the mac content directory and return it. */ std::string BuildMacContentDirectory(const std::string& base, - const char* config, + const std::string& config, bool contentOnly) const; private: @@ -698,37 +710,38 @@ private: // Cache target output paths for each configuration. struct OutputInfo; - OutputInfo const* GetOutputInfo(const char* config) const; + OutputInfo const* GetOutputInfo(const std::string& config) const; bool - ComputeOutputDir(const char* config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* kind, const char* config, + ComputeOutputDir(const std::string& config, + bool implib, std::string& out) const; + bool ComputePDBOutputDir(const char* kind, const std::string& config, std::string& out) const; // Cache import information from properties for each configuration. struct ImportInfo; - ImportInfo const* GetImportInfo(const char* config, + ImportInfo const* GetImportInfo(const std::string& config, cmTarget const* workingTarget) const; void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, cmTarget const* head) const; // Cache target compile paths for each configuration. struct CompileInfo; - CompileInfo const* GetCompileInfo(const char* config) const; + CompileInfo const* GetCompileInfo(const std::string& config) const; mutable cmTargetLinkInformationMap LinkInformation; void CheckPropertyCompatibility(cmComputeLinkInformation *info, - const char* config) const; + const std::string& config) const; - const char* ComputeLinkInterfaceLibraries(const char* config, + const char* ComputeLinkInterfaceLibraries(const std::string& config, LinkInterface& iface, cmTarget const* head, bool &exists) const; - void ComputeLinkImplementation(const char* config, + void ComputeLinkImplementation(const std::string& config, LinkImplementation& impl, cmTarget const* head) const; void ComputeLinkImplementationLanguages(LinkImplementation& impl) const; - void ComputeLinkClosure(const char* config, LinkClosure& lc, + void ComputeLinkClosure(const std::string& config, LinkClosure& lc, cmTarget const* head) const; void ClearLinkMaps(); diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 5dc3e6042..a21e1aae3 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -64,7 +64,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os, //---------------------------------------------------------------------------- void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent) { this->TestGenerated = true; diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 2c69fc3c5..5446553cf 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -32,7 +32,7 @@ protected: virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, - const char* config, + const std::string& config, Indent const& indent); virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent); virtual bool NeedsScriptNoConfig() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index aa721b75c..90155b413 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -140,7 +140,7 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( const char* tag, - const char* config, + const std::string& config, int indentLevel, const char* attribute, const char* end, diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8d6925430..02b951cc8 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -35,7 +35,7 @@ public: // used by cmVisualStudioGeneratorOptions void WritePlatformConfigTag( const char* tag, - const char* config, + const std::string& config, int indentLevel, const char* attribute = 0, const char* end = 0, diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 8eaf2aab4..3a6528ae9 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -122,26 +122,18 @@ public: void CopyAttributes(cmXCodeObject* ); - void AddDependLibrary(const char* configName, + void AddDependLibrary(const std::string& configName, const std::string& l) { - if(!configName) - { - configName = ""; - } this->DependLibraries[configName].push_back(l); } std::map const& GetDependLibraries() { return this->DependLibraries; } - void AddDependTarget(const char* configName, + void AddDependTarget(const std::string& configName, const std::string& tName) { - if(!configName) - { - configName = ""; - } this->DependTargets[configName].push_back(tName); } std::map const& GetDependTargets() diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 603b6d0c0..047f09da5 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -666,7 +666,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) else if (args[1] == "cmake_autogen" && args.size() >= 4) { cmQtAutoGenerators autogen; - const char *config = args[3].empty() ? 0 : args[3].c_str(); + std::string const& config = args[3]; bool autogenSuccess = autogen.Run(args[2].c_str(), config); return autogenSuccess ? 0 : 1; } From acb116e3b52362b41988aa27eeb593dd2e7194c0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 23:07:44 -0500 Subject: [PATCH 134/278] stringapi: Return a string reference for the configuration --- Source/cmLocalNinjaGenerator.h | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmSourceFileLocation.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 8b26806ee..2d870fb77 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -55,8 +55,8 @@ public: const cmake* GetCMakeInstance() const; cmake* GetCMakeInstance(); - const char* GetConfigName() const - { return this->ConfigName.c_str(); } + std::string const& GetConfigName() const + { return this->ConfigName; } /// @return whether we are processing the top CMakeLists.txt file. bool isRootMakefile() const; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1c43cb3ce..78ff4e4cd 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -91,7 +91,7 @@ cmGlobalNinjaGenerator* cmNinjaTargetGenerator::GetGlobalGenerator() const return this->LocalGenerator->GetGlobalNinjaGenerator(); } -const char* cmNinjaTargetGenerator::GetConfigName() const +std::string const& cmNinjaTargetGenerator::GetConfigName() const { return this->LocalGenerator->GetConfigName(); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index b3b37a4c2..c2e194721 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -65,7 +65,7 @@ protected: cmMakefile* GetMakefile() const { return this->Makefile; } - const char* GetConfigName() const; + std::string const& GetConfigName() const; std::string LanguageCompilerRule(const std::string& lang) const { return lang + "_COMPILER"; } diff --git a/Source/cmSourceFileLocation.h b/Source/cmSourceFileLocation.h index 64b8c1fd5..c83e8c0f8 100644 --- a/Source/cmSourceFileLocation.h +++ b/Source/cmSourceFileLocation.h @@ -76,7 +76,7 @@ public: * final name (but could be). Otherwise the returned name is the * final name. */ - const char* GetName() const { return this->Name.c_str(); } + const std::string& GetName() const { return this->Name; } /** * Get the cmMakefile instance for which the source file was created. From 3def29da3c16ad3a72f05ea8b97ee728e6e3581e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Feb 2014 23:09:05 -0500 Subject: [PATCH 135/278] stringapi: Use strings for feature arguments --- Source/cmMakefile.cxx | 2 +- Source/cmMakefile.h | 3 ++- Source/cmMakefileTargetGenerator.cxx | 4 ++-- Source/cmMakefileTargetGenerator.h | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.h | 4 ++-- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1ef4d46ba..bb88bc4ab 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3801,7 +3801,7 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- -const char* cmMakefile::GetFeature(const char* feature, +const char* cmMakefile::GetFeature(const std::string& feature, const std::string& config) { // TODO: Define accumulation policy for features (prepend, append, replace). diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 1c3ad73f6..7c82ec21a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -811,7 +811,8 @@ public: cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const std::string& prop) const; - const char* GetFeature(const char* feature, const std::string& config); + const char* GetFeature(const std::string& feature, + const std::string& config); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1af5d6c79..f0c9a3f1b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -2105,13 +2105,13 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) } //---------------------------------------------------------------------------- -const char* cmMakefileTargetGenerator::GetFeature(const char* feature) +const char* cmMakefileTargetGenerator::GetFeature(const std::string& feature) { return this->Target->GetFeature(feature, this->ConfigName); } //---------------------------------------------------------------------------- -bool cmMakefileTargetGenerator::GetFeatureAsBool(const char* feature) +bool cmMakefileTargetGenerator::GetFeatureAsBool(const std::string& feature) { return cmSystemTools::IsOn(this->GetFeature(feature)); } diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 21eece4db..573ce227f 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -263,8 +263,8 @@ protected: void AddFeatureFlags(std::string& flags, const std::string& lang); // Feature query methods. - const char* GetFeature(const char* feature); - bool GetFeatureAsBool(const char* feature); + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); //================================================================== // Convenience routines that do nothing more than forward to diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 78ff4e4cd..3ef236aad 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -97,13 +97,13 @@ std::string const& cmNinjaTargetGenerator::GetConfigName() const } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -const char* cmNinjaTargetGenerator::GetFeature(const char* feature) +const char* cmNinjaTargetGenerator::GetFeature(const std::string& feature) { return this->Target->GetFeature(feature, this->GetConfigName()); } // TODO: Picked up from cmMakefileTargetGenerator. Refactor it. -bool cmNinjaTargetGenerator::GetFeatureAsBool(const char* feature) +bool cmNinjaTargetGenerator::GetFeatureAsBool(const std::string& feature) { return cmSystemTools::IsOn(this->GetFeature(feature)); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index c2e194721..e66e55fef 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -70,8 +70,8 @@ protected: std::string LanguageCompilerRule(const std::string& lang) const { return lang + "_COMPILER"; } - const char* GetFeature(const char* feature); - bool GetFeatureAsBool(const char* feature); + const char* GetFeature(const std::string& feature); + bool GetFeatureAsBool(const std::string& feature); void AddFeatureFlags(std::string& flags, const std::string& lang); /** diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b8e662ae4..25ca1683a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2549,7 +2549,7 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const char* feature, +const char* cmTarget::GetFeature(const std::string& feature, const std::string& config) const { if(!config.empty()) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 65fbb0feb..15f00bec6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -232,7 +232,7 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - const char* GetFeature(const char* feature, + const char* GetFeature(const std::string& feature, const std::string& config) const; bool IsImported() const {return this->IsImportedTarget;} From 2b17626e9b0ffbd5b3adf81e64aae975a35c8b6b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 14:43:19 -0500 Subject: [PATCH 136/278] stringapi: Pass strings as install directories in CPack --- Source/CPack/cmCPackGenerator.cxx | 18 +++++++++--------- Source/CPack/cmCPackGenerator.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4c52c9614..3e1bf3b7a 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -254,7 +254,7 @@ int cmCPackGenerator::InstallProject() // If the project is a CMAKE project then run pre-install // and then read the cmake_install script to run it if ( !this->InstallProjectViaInstallCMakeProjects( - setDestDir, bareTempInstallDirectory.c_str()) ) + setDestDir, bareTempInstallDirectory) ) { return 0; } @@ -269,7 +269,7 @@ int cmCPackGenerator::InstallProject() //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallCommands( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { (void) setDestDir; const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS"); @@ -312,7 +312,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstalledDirectories( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { (void)setDestDir; (void)tempInstallDirectory; @@ -349,7 +349,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( return 0; } std::vector::iterator it; - const char* tempDir = tempInstallDirectory; + const std::string& tempDir = tempInstallDirectory; for ( it = installDirectoriesVector.begin(); it != installDirectoriesVector.end(); ++it ) @@ -457,7 +457,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallScript( - bool setDestDir, const char* tempInstallDirectory) + bool setDestDir, const std::string& tempInstallDirectory) { const char* cmakeScripts = this->GetOption("CPACK_INSTALL_SCRIPT"); @@ -499,7 +499,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( } else { - this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory); + this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); cmCPackLogger(cmCPackLog::LOG_DEBUG, "- Using non-DESTDIR install... (this->SetOption)" << std::endl); @@ -509,9 +509,9 @@ int cmCPackGenerator::InstallProjectViaInstallScript( } this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR", - tempInstallDirectory); + tempInstallDirectory.c_str()); this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", - tempInstallDirectory); + tempInstallDirectory.c_str()); int res = this->MakefileMap->ReadListFile(0, installScript.c_str()); if ( cmSystemTools::GetErrorOccuredFlag() || !res ) { @@ -524,7 +524,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( //---------------------------------------------------------------------- int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( - bool setDestDir, const char* baseTempInstallDirectory) + bool setDestDir, const std::string& baseTempInstallDirectory) { const char* cmakeProjects = this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS"); diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 7e7c94f2b..fadd1bf90 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -190,13 +190,13 @@ protected: //! Run install commands if specified virtual int InstallProjectViaInstallCommands( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstallScript( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstalledDirectories( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); virtual int InstallProjectViaInstallCMakeProjects( - bool setDestDir, const char* tempInstallDirectory); + bool setDestDir, const std::string& tempInstallDirectory); /** * The various level of support of From 5af95c396dc780c04444f549b957c2cba7c75309 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 18:42:53 -0500 Subject: [PATCH 137/278] typo: Match argument name with the header --- Source/cmGlobalGenerator.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 70cc16f3a..b7af21bb6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -988,13 +988,13 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, } } -bool cmGlobalGenerator::IgnoreFile(const char* l) const +bool cmGlobalGenerator::IgnoreFile(const char* ext) const { - if(!this->GetLanguageFromExtension(l).empty()) + if(!this->GetLanguageFromExtension(ext).empty()) { return false; } - return (this->IgnoreExtensions.count(l) > 0); + return (this->IgnoreExtensions.count(ext) > 0); } bool cmGlobalGenerator::GetLanguageEnabled(const std::string& l) const From b3bf31a5488a19ea3c357e346b882a2ca84c63b6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 19:05:55 -0500 Subject: [PATCH 138/278] stringapi: Miscellaneous char* parameters --- Source/CPack/WiX/cmWIXPatchParser.cxx | 12 +++---- Source/CPack/WiX/cmWIXPatchParser.h | 4 +-- Source/CPack/cmCPackComponentGroup.cxx | 5 +-- Source/CPack/cmCPackComponentGroup.h | 4 +-- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.h | 2 +- Source/CPack/cmCPackOSXX11Generator.cxx | 2 +- Source/CPack/cmCPackOSXX11Generator.h | 2 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 15 ++++---- Source/CPack/cmCPackPackageMakerGenerator.h | 8 ++--- Source/CTest/cmCTestBZR.cxx | 36 +++++++++---------- Source/CTest/cmCTestBuildCommand.cxx | 4 +-- Source/CTest/cmCTestHG.cxx | 22 ++++++------ Source/CTest/cmCTestMemCheckHandler.cxx | 18 ++++------ Source/CTest/cmCTestSVN.cxx | 18 +++++----- Source/CTest/cmCTestSubmitHandler.cxx | 14 ++++---- Source/CTest/cmParsePythonCoverage.cxx | 8 ++--- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesOptionsWidget.h | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesStringWidget.h | 2 +- Source/CursesDialog/cmCursesWidget.cxx | 4 +-- Source/CursesDialog/cmCursesWidget.h | 2 +- Source/cmCacheManager.cxx | 4 +-- Source/cmCacheManager.h | 2 +- Source/cmExportFileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 9 ++--- Source/cmGlobalGenerator.h | 8 ++--- Source/cmGlobalVisualStudio6Generator.cxx | 4 +-- Source/cmGlobalVisualStudio6Generator.h | 4 +-- Source/cmGlobalVisualStudio7Generator.cxx | 6 ++-- Source/cmGlobalVisualStudio7Generator.h | 6 ++-- Source/cmGlobalXCodeGenerator.cxx | 14 ++++---- Source/cmGlobalXCodeGenerator.h | 4 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 10 +++--- Source/cmLocalVisualStudio10Generator.cxx | 8 ++--- Source/cmLocalVisualStudio10Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 8 ++--- Source/cmLocalVisualStudio7Generator.h | 4 +-- Source/cmLocalVisualStudioGenerator.cxx | 4 +-- Source/cmLocalVisualStudioGenerator.h | 2 +- Source/cmTarget.cxx | 3 +- Source/cmTarget.h | 2 +- Source/cmVisualStudioWCEPlatformParser.cxx | 20 +++++------ Source/cmVisualStudioWCEPlatformParser.h | 4 +-- Source/cmXCodeObject.h | 18 +++++----- Source/cmXMLParser.cxx | 4 +-- Source/cmXMLParser.h | 4 +-- 49 files changed, 173 insertions(+), 175 deletions(-) diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 10af1f6af..ef67b23ec 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser( } -void cmWIXPatchParser::StartElement(const char *name, const char **atts) +void cmWIXPatchParser::StartElement(const std::string& name, const char **atts) { - std::string name_str = name; if(State == BEGIN_DOCUMENT) { - if(name_str == "CPackWiXPatch") + if(name == "CPackWiXPatch") { State = BEGIN_FRAGMENTS; } @@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts) } else if(State == BEGIN_FRAGMENTS) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = INSIDE_FRAGMENT; StartFragment(atts); @@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes) } } -void cmWIXPatchParser::EndElement(const char *name) +void cmWIXPatchParser::EndElement(const std::string& name) { - std::string name_str = name; if(State == INSIDE_FRAGMENT) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = BEGIN_FRAGMENTS; ElementStack.clear(); diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index da3adf509..acfb4c071 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -43,11 +43,11 @@ public: cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger); private: - virtual void StartElement(const char *name, const char **atts); + virtual void StartElement(const std::string& name, const char **atts); void StartFragment(const char **attributes); - virtual void EndElement(const char *name); + virtual void EndElement(const std::string& name); virtual void ReportError(int line, int column, const char* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index f93eca823..77f11cbf2 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -16,7 +16,8 @@ #include //---------------------------------------------------------------------- -unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const +unsigned long cmCPackComponent::GetInstalledSize( + const std::string& installDir) const { if (this->TotalSize != 0) { @@ -37,7 +38,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const //---------------------------------------------------------------------- unsigned long -cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const +cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const { unsigned long result = (GetInstalledSize(installDir) + 512) / 1024; return result? result : 1; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index abae3724e..0679638a6 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -94,11 +94,11 @@ public: /// Get the total installed size of all of the files in this /// component, in bytes. installDir is the directory into which the /// component was installed. - unsigned long GetInstalledSize(const char* installDir) const; + unsigned long GetInstalledSize(const std::string& installDir) const; /// Identical to GetInstalledSize, but returns the result in /// kilobytes. - unsigned long GetInstalledSizeInKbytes(const char* installDir) const; + unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const; private: mutable unsigned long TotalSize; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3e1bf3b7a..a8e104bd2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1139,7 +1139,7 @@ int cmCPackGenerator::DoPackage() } //---------------------------------------------------------------------- -int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf) +int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) { this->MakefileMap = mf; this->Name = name; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index fadd1bf90..efd3bef73 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -90,7 +90,7 @@ public: /** * Initialize generator */ - int Initialize(const char* name, cmMakefile* mf); + int Initialize(const std::string& name, cmMakefile* mf); /** * Construct generator diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 95ffab581..28c7f1dc0 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -272,7 +272,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) //---------------------------------------------------------------------- bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, - const char* dir, const char* outputFileName /* = 0 */, + const std::string& dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 7a93f5a57..9d0a6d188 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -39,7 +39,7 @@ protected: //bool CopyCreateResourceFile(const std::string& name, // const std::string& dir); - bool CopyResourcePlistFile(const std::string& name, const char* dir, + bool CopyResourcePlistFile(const std::string& name, const std::string& dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 69886a1b7..d736948a2 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -43,14 +43,14 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const } //---------------------------------------------------------------------- -int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir, - const char* script, - const char* name) +int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name) { std::string dst = resdir; dst += "/"; dst += name; - cmSystemTools::CopyFileAlways(script, dst.c_str()); + cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); cmSystemTools::SetPermissions(dst.c_str(),0777); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " << script << "\ninto " << dst.c_str() << @@ -601,12 +601,13 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( return true; } -bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(const char* name, - const char* outName) +bool cmCPackPackageMakerGenerator::CopyResourcePlistFile( + const std::string& name, + const char* outName) { if (!outName) { - outName = name; + outName = name.c_str(); } std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index bebb63337..e350a609d 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -38,9 +38,9 @@ public: virtual bool SupportsComponentInstallation() const; protected: - int CopyInstallScript(const char* resdir, - const char* script, - const char* name); + int CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name); virtual int InitializeInternal(); int PackageFiles(); virtual const char* GetOutputExtension() { return ".dmg"; } @@ -53,7 +53,7 @@ protected: // which will be configured via ConfigureFile. bool CopyCreateResourceFile(const std::string& name, const std::string& dirName); - bool CopyResourcePlistFile(const char* name, const char* outName = 0); + bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if // successful) produce the given package file. Returns true if diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 840ebc93f..3014a9322 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -225,35 +225,35 @@ private: return true; } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { this->CData.clear(); - if(strcmp(name, "log") == 0) + if(name == "log") { this->Rev = Revision(); this->Changes.clear(); } // affected-files can contain blocks of // modified, unknown, renamed, kind-changed, removed, conflicts, added - else if(strcmp(name, "modified") == 0 - || strcmp(name, "renamed") == 0 - || strcmp(name, "kind-changed") == 0) + else if(name == "modified" + || name == "renamed" + || name == "kind-changed") { this->CurChange = Change(); this->CurChange.Action = 'M'; } - else if(strcmp(name, "added") == 0) + else if(name == "added") { this->CurChange = Change(); this->CurChange = 'A'; } - else if(strcmp(name, "removed") == 0) + else if(name == "removed") { this->CurChange = Change(); this->CurChange = 'D'; } - else if(strcmp(name, "unknown") == 0 - || strcmp(name, "conflicts") == 0) + else if(name == "unknown" + || name == "conflicts") { // Should not happen here this->CurChange = Change(); @@ -265,27 +265,27 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "log") == 0) + if(name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); } - else if((strcmp(name, "file") == 0 || strcmp(name, "directory") == 0) - && !this->CData.empty()) + else if(!this->CData.empty() && + (name == "file" || name == "directory")) { this->CurChange.Path.assign(&this->CData[0], this->CData.size()); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "symlink") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "symlink") { // symlinks have an arobase at the end in the log this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "committer") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "committer") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); if(this->EmailRegex.find(this->Rev.Author)) @@ -294,15 +294,15 @@ private: this->Rev.EMail = this->EmailRegex.match(2); } } - else if(strcmp(name, "timestamp") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "timestamp") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "message") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "message") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "revno") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "revno") { this->Rev.Rev.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 9738bded9..c60ded065 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -131,8 +131,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string buildCommand = this->GlobalGenerator-> GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", - cmakeBuildConfiguration, - cmakeBuildAdditionalFlags, true); + cmakeBuildConfiguration, + cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" << buildCommand.c_str() << "\n"); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 5bf994989..0f79d68a0 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -189,10 +189,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); if(const char* rev = this->FindAttribute(atts, "revision")) @@ -208,29 +208,29 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if ( strcmp(name, "email") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "email") { this->Rev.EMail.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "files") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "files") { std::vector paths = this->SplitCData(); for(unsigned int i = 0; i < paths.size(); ++i) @@ -242,7 +242,7 @@ private: this->Changes.push_back(this->CurChange); } } - else if(strcmp(name, "file_adds") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_adds") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) @@ -253,7 +253,7 @@ private: } } } - else if(strcmp(name, "file_dels") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_dels") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index f2982a4f2..f27dbc098 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -49,21 +49,15 @@ class cmBoundsCheckerParser : public cmXMLParser { public: cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;} - void StartElement(const char* name, const char** atts) + void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "MemoryLeak") == 0) + if(name == "MemoryLeak" || + name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); } - if(strcmp(name, "ResourceLeak") == 0) - { - this->Errors.push_back(cmCTestMemCheckHandler::MLK); - } - if(strcmp(name, "Error") == 0) - { - this->ParseError(atts); - } - if(strcmp(name, "Dangling Pointer") == 0) + else if(name == "Error" || + name == "Dangling Pointer") { this->ParseError(atts); } @@ -79,7 +73,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const char* ) + void EndElement(const std::string& ) { } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 89592dd8e..86dc2f2fd 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -361,10 +361,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &SVNRepo; @@ -374,7 +374,7 @@ private: } this->Changes.clear(); } - else if(strcmp(name, "path") == 0) + else if(name == "path") { this->CurChange = Change(); if(const char* action = this->FindAttribute(atts, "action")) @@ -389,28 +389,28 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); } - else if(strcmp(name, "path") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "path") { std::string orig_path(&this->CData[0], this->CData.size()); std::string new_path = SVNRepo.BuildLocalPath( orig_path ); this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1cd8fc76f..3173f1564 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -68,10 +68,10 @@ private: return val; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CurrentValue.clear(); - if(strcmp(name, "cdash") == 0) + if(name == "cdash") { this->CDashVersion = this->FindAttribute(atts, "version"); } @@ -82,9 +82,9 @@ private: this->CurrentValue.insert(this->CurrentValue.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "status") == 0) + if(name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); if(status == "OK" || status == "SUCCESS") @@ -100,15 +100,15 @@ private: this->Status = STATUS_ERROR; } } - else if(strcmp(name, "filename") == 0) + else if(name == "filename") { this->Filename = this->GetCurrentValue(); } - else if(strcmp(name, "md5") == 0) + else if(name == "md5") { this->MD5 = this->GetCurrentValue(); } - else if(strcmp(name, "message") == 0) + else if(name == "message") { this->Message = this->GetCurrentValue(); } diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx index 38a770ac8..2578bb876 100644 --- a/Source/CTest/cmParsePythonCoverage.cxx +++ b/Source/CTest/cmParsePythonCoverage.cxx @@ -20,9 +20,9 @@ public: protected: - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "class") == 0) + if(name == "class") { int tagCount = 0; while(true) @@ -57,7 +57,7 @@ protected: ++tagCount; } } - else if(strcmp(name, "line") == 0) + else if(name == "line") { int tagCount = 0; int curNumber = -1; @@ -85,7 +85,7 @@ protected: } } - virtual void EndElement(const char*) {} + virtual void EndElement(const std::string&) {} private: diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 652b2df7a..aa680fb9a 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -89,7 +89,7 @@ void cmCursesOptionsWidget::PreviousOption() this->SetValue(this->Options[this->CurrentOption].c_str()); } -void cmCursesOptionsWidget::SetOption(const char* value) +void cmCursesOptionsWidget::SetOption(const std::string& value) { this->CurrentOption = 0; // default to 0 index this->SetValue(value); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index b52ac9de9..5cee489b0 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -25,7 +25,7 @@ public: // when this widget has focus. Returns true if the input was // handled. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); - void SetOption(const char*); + void SetOption(const std::string&); void AddOption(std::string const &); void NextOption(); void PreviousOption(); diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index bd1ff71c6..d25022d59 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -195,7 +195,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, return true; } -void cmCursesStringWidget::SetString(const char* value) +void cmCursesStringWidget::SetString(const std::string& value) { this->SetValue(value); } diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index e939049df..dd8c02a32 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -37,7 +37,7 @@ public: /** * Set/Get the string. */ - void SetString(const char* value); + void SetString(const std::string& value); const char* GetString(); virtual const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx index 5dffcaa5c..e5363f489 100644 --- a/Source/CursesDialog/cmCursesWidget.cxx +++ b/Source/CursesDialog/cmCursesWidget.cxx @@ -46,10 +46,10 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage) } } -void cmCursesWidget::SetValue(const char* value) +void cmCursesWidget::SetValue(const std::string& value) { this->Value = value; - set_field_buffer(this->Field, 0, value); + set_field_buffer(this->Field, 0, value.c_str()); } const char* cmCursesWidget::GetValue() diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 952c67a86..d91a0cb5f 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -40,7 +40,7 @@ public: * Set/Get the value (setting the value also changes the contents * of the field buffer). */ - virtual void SetValue(const char* value); + virtual void SetValue(const std::string& value); virtual const char* GetValue(); /** diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 39b9ae53c..159f9c307 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -94,7 +94,7 @@ bool cmCacheManager::LoadCache(const std::string& path, return this->LoadCache(path, internal, emptySet, emptySet); } -static bool ParseEntryWithoutType(const char* entry, +static bool ParseEntryWithoutType(const std::string& entry, std::string& var, std::string& value) { @@ -132,7 +132,7 @@ static bool ParseEntryWithoutType(const char* entry, return flag; } -bool cmCacheManager::ParseEntry(const char* entry, +bool cmCacheManager::ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 573f828f1..07a8675b1 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -136,7 +136,7 @@ public: return static_cast(this->Cache.size()); } ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseEntry(const char* entry, + static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index cf91c6985..abd8ad531 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -50,7 +50,7 @@ public: const char *GetMainExportFileName() const; /** Set the namespace in which to place exported target names. */ - void SetNamespace(const char* ns) { this->Namespace = ns; } + void SetNamespace(const std::string& ns) { this->Namespace = ns; } std::string GetNamespace() const { return this->Namespace; } void SetExportOld(bool exportOld) { this->ExportOld = exportOld; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b7af21bb6..a14696d25 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1790,7 +1790,7 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); @@ -1819,7 +1819,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( sep = " "; } } - if(native && *native) + if(!native.empty()) { makeCommand += sep; makeCommand += native; @@ -2528,9 +2528,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AppendDirectoryForConfig(const char*, +void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&, const std::string&, - const char*, std::string&) + const std::string&, + std::string&) { // Subclasses that support multiple configurations should implement // this method to append the subdirectory for the given build diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index e9a1b4740..5b979605a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -138,7 +138,7 @@ public: /** Generate a "cmake --build" call for a given target and config. */ std::string GenerateCMakeBuildCommand(const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors); ///! Set the CMake instance @@ -230,9 +230,9 @@ public: /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); /** Get the manifest of all targets that will be built for each @@ -292,7 +292,7 @@ public: return this->BinaryDirectories.insert(dir).second; } /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const char*) {} + virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index f69bcfd99..82047d744 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -418,9 +418,9 @@ void cmGlobalVisualStudio6Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio6Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 22ec926a8..f7ef9729a 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -81,9 +81,9 @@ public: std::vector& generators); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 18f7f195f..c65bdaacb 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -924,7 +924,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) } -void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) +void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -961,9 +961,9 @@ void cmGlobalVisualStudio7Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 009f0025b..342fa88d5 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -89,13 +89,13 @@ public: std::vector *GetConfigurations(); ///! Create a GUID or get an existing one. - void CreateGUID(const char* name); + void CreateGUID(const std::string& name); std::string GetGUID(const std::string& name); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c0077b923..ec2e1e983 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -34,17 +34,17 @@ class cmXcodeVersionParser : public cmXMLParser { public: cmXcodeVersionParser(): Version("1.5") {} - void StartElement(const char* , const char** ) + void StartElement(const std::string&, const char**) { this->Data = ""; } - void EndElement(const char* name) + void EndElement(const std::string& name) { - if(strcmp(name, "key") == 0) + if(name == "key") { this->Key = this->Data; } - else if(strcmp(name, "string") == 0) + else if(name == "string") { if(this->Key == "CFBundleShortVersionString") { @@ -1005,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, gtgt->GetTargetSourceFileFlags(*i); if(filetype && - strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) + filetype->GetString() == "compiled.mach-o.objfile") { externalObjFiles.push_back(xsf); } @@ -3771,9 +3771,9 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(this->XcodeVersion > 20) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 03e75c4d6..e9149c2d4 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -72,9 +72,9 @@ public: virtual void Generate(); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 251661391..f7088c2da 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1299,7 +1299,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::CreateMakeVariable(const char* sin, const char* s2in) +::CreateMakeVariable(const std::string& sin, const std::string& s2in) { std::string s = sin; std::string s2 = s2in; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 37ee87474..39f213b65 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -75,7 +75,7 @@ public: /** * Set the flag used to keep the make program silent. */ - void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; } + void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; } std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** @@ -130,8 +130,9 @@ public: * Set the string used to include one makefile into another default * is include. */ - void SetIncludeDirective(const char* s) { this->IncludeDirective = s; } - const char *GetIncludeDirective() { return this->IncludeDirective.c_str(); } + void SetIncludeDirective(const std::string& s) + { this->IncludeDirective = s; } + const std::string& GetIncludeDirective() { return this->IncludeDirective; } /** * Set max makefile variable size, default is 0 which means unlimited. @@ -192,7 +193,8 @@ public: static std::string ConvertToQuotedOutputPath(const char* p); - std::string CreateMakeVariable(const char* sin, const char* s2in); + std::string CreateMakeVariable(const std::string& sin, + const std::string& s2in); /** Called from command-line hook to bring dependencies up to date for a target. */ diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index aedd6edbf..aa70ab9d6 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -19,7 +19,7 @@ class cmVS10XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } virtual void CharacterDataHandler(const char* data, int length) @@ -30,14 +30,14 @@ class cmVS10XMLParser : public cmXMLParser this->DoGUID = false; } } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { // once the GUID is found do nothing if(this->GUID.size()) { return; } - if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0) + if("ProjectGUID" == name || "ProjectGuid" == name) { this->DoGUID = true; } @@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::Generate() void cmLocalVisualStudio10Generator -::ReadAndStoreExternalGUID(const char* name, +::ReadAndStoreExternalGUID(const std::string& name, const char* path) { cmVS10XMLParser parser; diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 41db735b2..b50e3458b 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -34,7 +34,7 @@ public: * Generate the makefile for this directory. */ virtual void Generate(); - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); protected: diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5f98a713e..0bbafd80d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2146,10 +2146,10 @@ std::string cmLocalVisualStudio7Generator class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { // once the GUID is found do nothing if(this->GUID.size()) @@ -2157,7 +2157,7 @@ public: return; } int i =0; - if(strcmp("VisualStudioProject", name) == 0) + if("VisualStudioProject" == name) { while(atts[i]) { @@ -2194,7 +2194,7 @@ public: }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( - const char* name, + const std::string& name, const char* path) { cmVS7XMLParser parser; diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index f9bb6e195..d2e66a5c9 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -51,7 +51,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType,const char *name); + void SetBuildType(BuildType,const std::string& name); void SetPlatformName(const char* n) { this->PlatformName = n;} @@ -62,7 +62,7 @@ public: void WriteStampFiles(); virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); virtual void AddCMakeListsRules(); protected: diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 11b038772..6e93d22c2 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -81,7 +81,7 @@ std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline_text) + const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); const char* workingDirectory = cc.GetWorkingDirectory(); @@ -89,7 +89,7 @@ cmLocalVisualStudioGenerator RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; // Avoid leading or trailing newlines. - const char* newline = ""; + std::string newline = ""; // Line to check for error between commands. std::string check_error = newline_text; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 2297072b5..94a6293b6 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -48,7 +48,7 @@ public: /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline = "\n"); + const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a sequence of custom commands. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 25ca1683a..595244436 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4100,7 +4100,8 @@ bool cmTarget::ComputeOutputDir(const std::string& config, } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config, +bool cmTarget::ComputePDBOutputDir(const std::string& kind, + const std::string& config, std::string& out) const { // Look for a target property defining the target output directory diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 15f00bec6..d5ef18d9f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -714,7 +714,7 @@ private: bool ComputeOutputDir(const std::string& config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* kind, const std::string& config, + bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; // Cache import information from properties for each configuration. diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index 219a5eb49..ca226fb50 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -62,7 +62,7 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const return 0; } -void cmVisualStudioWCEPlatformParser::StartElement(const char* name, +void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, const char** attributes) { if(this->FoundRequiredName) @@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->CharacterData = ""; - if(strcmp(name, "PlatformData") == 0) + if(name == "PlatformData") { this->PlatformName = ""; this->OSMajorVersion = ""; @@ -80,7 +80,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros.clear(); } - if(strcmp(name, "Macro") == 0) + if(name == "Macro") { std::string macroName; std::string macroValue; @@ -102,7 +102,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros[macroName] = macroValue; } } - else if(strcmp(name, "Directories") == 0) + else if(name == "Directories") { for(const char** attr = attributes; *attr; attr += 2) { @@ -122,11 +122,11 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, } } -void cmVisualStudioWCEPlatformParser::EndElement(const char* name) +void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name) { if(!this->RequiredName) { - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->AvailablePlatforms.push_back(this->CharacterData); } @@ -138,19 +138,19 @@ void cmVisualStudioWCEPlatformParser::EndElement(const char* name) return; } - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->PlatformName = this->CharacterData; } - else if(strcmp(name, "OSMajorVersion") == 0) + else if(name == "OSMajorVersion") { this->OSMajorVersion = this->CharacterData; } - else if(strcmp(name, "OSMinorVersion") == 0) + else if(name == "OSMinorVersion") { this->OSMinorVersion = this->CharacterData; } - else if(strcmp(name, "Platform") == 0) + else if(name == "Platform") { if(this->PlatformName == this->RequiredName) { diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h index 466e1dd43..042df0142 100644 --- a/Source/cmVisualStudioWCEPlatformParser.h +++ b/Source/cmVisualStudioWCEPlatformParser.h @@ -41,8 +41,8 @@ public: return this->AvailablePlatforms; } protected: - virtual void StartElement(const char* name, const char** attributes); - void EndElement(const char* name); + virtual void StartElement(const std::string& name, const char** attributes); + void EndElement(const std::string& name); void CharacterDataHandler(const char* data, int length); private: diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 3a6528ae9..ed2940a0c 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -38,12 +38,12 @@ public: PBXType GetIsA() { return this->IsA;} void SetString(const std::string& s); - const char* GetString() + const std::string& GetString() { - return this->String.c_str(); + return this->String; } - void AddAttribute(const char* name, cmXCodeObject* value) + void AddAttribute(const std::string& name, cmXCodeObject* value) { this->ObjectAttributes[name] = value; } @@ -79,11 +79,11 @@ public: static void PrintList(std::vector const&, std::ostream& out); - const char* GetId() + const std::string& GetId() { - return this->Id.c_str(); + return this->Id; } - void SetId(const char* id) + void SetId(const std::string& id) { this->Id = id; } @@ -95,8 +95,8 @@ public: { this->Target = t; } - const char* GetComment() {return this->Comment.c_str();} - bool HasComment() { return (this->Comment.size() != 0);} + const std::string& GetComment() {return this->Comment;} + bool HasComment() { return (!this->Comment.empty());} cmXCodeObject* GetObject(const char* name) { if(this->ObjectAttributes.count(name)) @@ -141,7 +141,7 @@ public: return this->DependTargets; } std::vector const& GetObjectList() { return this->List;} - void SetComment(const char* c) { this->Comment = c;} + void SetComment(const std::string& c) { this->Comment = c;} static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 0c53440ef..a73fd7032 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -152,14 +152,14 @@ int cmXMLParser::ParsingComplete() } //---------------------------------------------------------------------------- -void cmXMLParser::StartElement(const char * name, +void cmXMLParser::StartElement(const std::string& name, const char ** /*atts*/) { std::cout << "Start element: " << name << std::endl; } //---------------------------------------------------------------------------- -void cmXMLParser::EndElement(const char * name) +void cmXMLParser::EndElement(const std::string& name) { std::cout << "End element: " << name << std::endl; } diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index d916075e5..84a5a7dd6 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -74,11 +74,11 @@ protected: * element. atts = Null-terminated array of attribute name/value pairs. * Even indices are attribute names, and odd indices are values. */ - virtual void StartElement(const char* name, const char** atts); + virtual void StartElement(const std::string& name, const char** atts); //! Called at the end of an element in the XML source opened when //StartElement was called. - virtual void EndElement(const char* name); + virtual void EndElement(const std::string& name); //! Called when there is character data to handle. virtual void CharacterDataHandler(const char* data, int length); From 11ed3e2cfe70e7d9d5a8e1f8e24fa61bbf6420b0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 19:06:54 -0500 Subject: [PATCH 139/278] stringapi: Add string overload for the Def struct --- Source/cmDefinitions.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h index 4c1ad0afe..d615fb0e6 100644 --- a/Source/cmDefinitions.h +++ b/Source/cmDefinitions.h @@ -59,6 +59,7 @@ private: public: Def(): std_string(), Exists(false) {} Def(const char* v): std_string(v?v:""), Exists(v?true:false) {} + Def(const std_string& v): std_string(v), Exists(true) {} Def(Def const& d): std_string(d), Exists(d.Exists) {} bool Exists; }; From 24b5e93de2c753e94cae3b41c1ca7cddaa03e5e7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:38:30 -0500 Subject: [PATCH 140/278] stringapi: Use strings for directories --- Source/cmGlobalGenerator.cxx | 9 +++++---- Source/cmGlobalGenerator.h | 6 +++--- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 4 ++-- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmMakefile.cxx | 9 +++++---- Source/cmMakefile.h | 2 +- Source/cmQtAutoGenerators.cxx | 20 ++++++++++++-------- Source/cmQtAutoGenerators.h | 8 ++++---- Source/cmake.cxx | 2 +- 19 files changed, 44 insertions(+), 38 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a14696d25..c1cce2ed6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1614,7 +1614,8 @@ void cmGlobalGenerator::CheckLocalGenerators() } } -int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, +int cmGlobalGenerator::TryCompile(const std::string& srcdir, + const std::string& bindir, const std::string& projectName, const std::string& target, bool fast, std::string *output, cmMakefile *mf) @@ -1665,7 +1666,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, void cmGlobalGenerator::GenerateBuildCommand( std::vector& makeCommand, const char*, const std::string&, - const char*, const std::string&, const std::string&, bool, + const std::string&, const std::string&, const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1673,7 +1674,7 @@ void cmGlobalGenerator::GenerateBuildCommand( } int cmGlobalGenerator::Build( - const char *, const char *bindir, + const std::string&, const std::string& bindir, const std::string& projectName, const std::string& target, std::string *output, const char *makeCommandCSTR, @@ -1687,7 +1688,7 @@ int cmGlobalGenerator::Build( * Run an executable command and put the stdout in output. */ std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmSystemTools::ChangeDirectory(bindir.c_str()); if(output) { *output += "Change Dir: "; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 5b979605a..761fb0760 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -105,7 +105,7 @@ public: * Try running cmake and building a file. This is used for dynamically * loaded commands, not as part of the usual build process. */ - virtual int TryCompile(const char *srcdir, const char *bindir, + virtual int TryCompile(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -117,7 +117,7 @@ public: * empty then all is assumed. clean indicates if a "make clean" should be * done first. */ - int Build(const char *srcdir, const char *bindir, + int Build(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, std::string *output, const char *makeProgram, const std::string& config, @@ -130,7 +130,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, - const std::string& projectName, const char *projectDir, + const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() ); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 16e9788eb..73a6245d5 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -553,7 +553,7 @@ void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, const std::string& /*projectName*/, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool /*fast*/, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 86c2912f7..4a284864a 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -195,7 +195,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d94715096..9ddbe5b45 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -567,7 +567,7 @@ void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, const char* makeProgram, const std::string& /*projectName*/, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& /*config*/, bool fast, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 8924fa836..d64afaf6f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -111,7 +111,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 0bc572b36..3819a5be6 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -312,7 +312,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, @@ -334,7 +334,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( cmSlnData slnData; { std::string slnFile; - if(projectDir && *projectDir) + if(!projectDir.empty()) { slnFile = projectDir; slnFile += "/"; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 085f2d2ae..5d902eedb 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -36,7 +36,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 82047d744..3a51fce80 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -118,7 +118,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index f7ef9729a..eb3dddf97 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -56,7 +56,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index c65bdaacb..392710049 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -185,7 +185,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 342fa88d5..b65948036 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -64,7 +64,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ec2e1e983..e1f2a919a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -262,7 +262,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* /*projectDir*/, + const std::string& /*projectDir*/, const std::string& targetName, const std::string& config, bool /*fast*/, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e9149c2d4..aec795841 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -57,7 +57,7 @@ public: std::vector& makeCommand, const char* makeProgram, const std::string& projectName, - const char* projectDir, + const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bb88bc4ab..e61b12bf4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3060,7 +3060,8 @@ void cmMakefile::ExpandSourceListArguments( } } -int cmMakefile::TryCompile(const char *srcdir, const char *bindir, +int cmMakefile::TryCompile(const std::string& srcdir, + const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, @@ -3069,15 +3070,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, { this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... - if (!cmSystemTools::FileIsDirectory(bindir)) + if (!cmSystemTools::FileIsDirectory(bindir.c_str())) { - cmSystemTools::MakeDirectory(bindir); + cmSystemTools::MakeDirectory(bindir.c_str()); } // change to the tests directory and run cmake // use the cmake object instead of calling cmake std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(bindir); + cmSystemTools::ChangeDirectory(bindir.c_str()); // make sure the same generator is used // use this program as the cmake to be run, it should not diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7c82ec21a..fb40c1bbf 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -126,7 +126,7 @@ public: * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. */ - int TryCompile(const char *srcdir, const char *bindir, + int TryCompile(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, bool fast, const std::vector *cmakeArgs, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 8eee991a0..48a6b38e3 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -952,7 +952,7 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, - const char* targetDirectory) + const std::string& targetDirectory) { cmGlobalGenerator* gg = new cmGlobalGenerator(); gg->SetCMakeInstance(cm); @@ -967,7 +967,7 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, return gg; } -bool cmQtAutoGenerators::Run(const char* targetDirectory, +bool cmQtAutoGenerators::Run(const std::string& targetDirectory, const std::string& config) { bool success = true; @@ -994,10 +994,11 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, } bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, - const char* targetDirectory, + const std::string& targetDirectory, const std::string& config) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutogenInfo.cmake"; @@ -1137,9 +1138,10 @@ std::string cmQtAutoGenerators::MakeCompileSettingsString(cmMakefile* makefile) bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, - const char* targetDirectory) + const std::string& targetDirectory) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; @@ -1153,9 +1155,11 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, void -cmQtAutoGenerators::WriteOldMocDefinitionsFile(const char* targetDirectory) +cmQtAutoGenerators::WriteOldMocDefinitionsFile( + const std::string& targetDirectory) { - std::string filename(cmSystemTools::CollapseFullPath(targetDirectory)); + std::string filename( + cmSystemTools::CollapseFullPath(targetDirectory.c_str())); cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index af4ceb9f8..a593dd5da 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -21,7 +21,7 @@ class cmQtAutoGenerators { public: cmQtAutoGenerators(); - bool Run(const char* targetDirectory, const std::string& config); + bool Run(const std::string& targetDirectory, const std::string& config); bool InitializeAutogenTarget(cmTarget* target); void SetupAutoGenerateTarget(cmTarget const* target); @@ -37,11 +37,11 @@ private: void SetupAutoRccTarget(cmTarget const* target); bool ReadAutogenInfoFile(cmMakefile* makefile, - const char* targetDirectory, + const std::string& targetDirectory, const std::string& config); bool ReadOldMocDefinitionsFile(cmMakefile* makefile, - const char* targetDirectory); - void WriteOldMocDefinitionsFile(const char* targetDirectory); + const std::string& targetDirectory); + void WriteOldMocDefinitionsFile(const std::string& targetDirectory); std::string MakeCompileSettingsString(cmMakefile* makefile); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5ada30e5c..13572f418 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2667,7 +2667,7 @@ int cmake::Build(const std::string& dir, return 1; } projName = it.GetValue(); - return gen->Build(0, dir.c_str(), + return gen->Build("", dir.c_str(), projName.c_str(), target.c_str(), &output, 0, From 1a1b737c99ac0bd0d555fde2fadf77f08516a4ea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:36:27 -0500 Subject: [PATCH 141/278] stringapi: Use strings for generator names --- Source/CTest/cmCTestBuildCommand.cxx | 3 +- Source/cmComputeLinkInformation.cxx | 5 ++-- Source/cmExternalMakefileProjectGenerator.cxx | 22 +++++++------- Source/cmExternalMakefileProjectGenerator.h | 11 +++---- Source/cmExtraCodeBlocksGenerator.cxx | 9 +++--- Source/cmExtraCodeBlocksGenerator.h | 6 ++-- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraCodeLiteGenerator.h | 6 ++-- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.h | 6 ++-- Source/cmExtraKateGenerator.cxx | 4 +-- Source/cmExtraKateGenerator.h | 6 ++-- Source/cmExtraSublimeTextGenerator.cxx | 11 +++---- Source/cmExtraSublimeTextGenerator.h | 6 ++-- Source/cmGlobalBorlandMakefileGenerator.h | 4 +-- Source/cmGlobalGenerator.cxx | 4 +-- Source/cmGlobalGenerator.h | 8 ++--- Source/cmGlobalGeneratorFactory.h | 8 +++-- Source/cmGlobalJOMMakefileGenerator.h | 4 +-- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalKdevelopGenerator.h | 6 ++-- Source/cmGlobalMSYSMakefileGenerator.h | 4 +-- Source/cmGlobalMinGWMakefileGenerator.h | 4 +-- Source/cmGlobalNMakeMakefileGenerator.h | 4 +-- Source/cmGlobalNinjaGenerator.h | 4 +-- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 +-- Source/cmGlobalUnixMakefileGenerator3.h | 4 +-- Source/cmGlobalVisualStudio10Generator.cxx | 24 ++++++++------- Source/cmGlobalVisualStudio10Generator.h | 7 +++-- Source/cmGlobalVisualStudio11Generator.cxx | 24 ++++++++------- Source/cmGlobalVisualStudio11Generator.h | 7 +++-- Source/cmGlobalVisualStudio12Generator.cxx | 24 ++++++++------- Source/cmGlobalVisualStudio12Generator.h | 7 +++-- Source/cmGlobalVisualStudio6Generator.h | 4 +-- Source/cmGlobalVisualStudio71Generator.cxx | 9 +++--- Source/cmGlobalVisualStudio71Generator.h | 8 ++--- Source/cmGlobalVisualStudio7Generator.cxx | 22 ++++++++------ Source/cmGlobalVisualStudio7Generator.h | 10 +++---- Source/cmGlobalVisualStudio8Generator.cxx | 29 +++++++++++-------- Source/cmGlobalVisualStudio8Generator.h | 9 +++--- Source/cmGlobalVisualStudio9Generator.cxx | 14 +++++---- Source/cmGlobalVisualStudio9Generator.h | 5 ++-- Source/cmGlobalVisualStudioGenerator.cxx | 4 +-- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmGlobalWatcomWMakeGenerator.h | 4 +-- Source/cmGlobalXCodeGenerator.cxx | 7 +++-- Source/cmGlobalXCodeGenerator.h | 4 +-- Source/cmLocalVisualStudio7Generator.h | 2 +- Source/cmMakefile.cxx | 4 +-- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmake.cxx | 16 +++++----- Source/cmake.h | 4 +-- 52 files changed, 221 insertions(+), 190 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index c60ded065..04eabd20d 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -101,8 +101,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() } if ( this->GlobalGenerator ) { - if ( strcmp(this->GlobalGenerator->GetName(), - cmakeGeneratorName) != 0 ) + if ( this->GlobalGenerator->GetName() != cmakeGeneratorName ) { delete this->GlobalGenerator; this->GlobalGenerator = 0; diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e4e204738..62eaec235 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1127,9 +1127,10 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) // Full path libraries should specify a valid library file name. // See documentation of CMP0008. + std::string generator = this->GlobalGenerator->GetName(); if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW && - (strstr(this->GlobalGenerator->GetName(), "Visual Studio") || - strstr(this->GlobalGenerator->GetName(), "Xcode"))) + (generator.find("Visual Studio") != generator.npos || + generator.find("Xcode") != generator.npos)) { std::string file = cmSystemTools::GetFilenameName(item); if(!this->ExtractAnyLibraryName.find(file.c_str())) diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index 0d42c3595..d89a1c83c 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -20,13 +20,13 @@ void cmExternalMakefileProjectGenerator } std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( - const char* globalGenerator, - const char* extraGenerator) + const std::string& globalGenerator, + const std::string& extraGenerator) { std::string fullName; - if (globalGenerator) + if (!globalGenerator.empty()) { - if (extraGenerator && *extraGenerator) + if (!extraGenerator.empty()) { fullName = extraGenerator; fullName += " - "; @@ -36,22 +36,22 @@ std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName( return fullName; } -const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( - const char* fullName) +std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( + const std::string& fullName) { // at least one global generator must be supported assert(!this->SupportedGlobalGenerators.empty()); - if (fullName==0) + if (fullName.empty()) { - return 0; + return ""; } std::string currentName = fullName; // if we get only the short name, take the first global generator as default if (currentName == this->GetName()) { - return this->SupportedGlobalGenerators[0].c_str(); + return this->SupportedGlobalGenerators[0]; } // otherwise search for the matching global generator @@ -63,8 +63,8 @@ const char* cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( if (this->CreateFullGeneratorName(it->c_str(), this->GetName()) == currentName) { - return it->c_str(); + return *it; } } - return 0; + return ""; } diff --git a/Source/cmExternalMakefileProjectGenerator.h b/Source/cmExternalMakefileProjectGenerator.h index bce441dba..cba1c76dd 100644 --- a/Source/cmExternalMakefileProjectGenerator.h +++ b/Source/cmExternalMakefileProjectGenerator.h @@ -37,10 +37,10 @@ public: virtual ~cmExternalMakefileProjectGenerator() {} ///! Get the name for this generator. - virtual const char* GetName() const = 0; + virtual std::string GetName() const = 0; /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const = 0; + const std::string& fullName) const = 0; virtual void EnableLanguage(std::vector const& languages, cmMakefile *, bool optional); @@ -53,12 +53,13 @@ public: {return this->SupportedGlobalGenerators;} ///! Get the name of the global generator for the given full name - const char* GetGlobalGeneratorName(const char* fullName); + std::string GetGlobalGeneratorName(const std::string& fullName); /** Create a full name from the given global generator name and the * extra generator name */ - static std::string CreateFullGeneratorName(const char* globalGenerator, - const char* extraGenerator); + static std::string CreateFullGeneratorName( + const std::string& globalGenerator, + const std::string& extraGenerator); ///! Generate the project files, the Makefiles have already been generated virtual void Generate() = 0; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 01d115505..4a5970492 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -38,7 +38,7 @@ http://forums.codeblocks.org/index.php/topic,6789.0.html //---------------------------------------------------------------------------- void cmExtraCodeBlocksGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates CodeBlocks project files."; @@ -761,7 +761,8 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( const std::string& target) { std::string command = make; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) + std::string generator = this->GlobalGenerator->GetName(); + if (generator == "NMake Makefiles") { // For Windows ConvertToOutputPath already adds quotes when required. // These need to be escaped, see @@ -772,7 +773,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( command += " VERBOSE=1 "; command += target; } - else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + else if (generator == "MinGW Makefiles") { // no escaping of spaces in this case, see // http://public.kitware.com/Bug/view.php?id=10014 @@ -783,7 +784,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( command += " VERBOSE=1 "; command += target; } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + else if (generator == "Ninja") { command += " -v "; command += target; diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h index 1cbc3f35f..0435ad8c9 100644 --- a/Source/cmExtraCodeBlocksGenerator.h +++ b/Source/cmExtraCodeBlocksGenerator.h @@ -28,14 +28,14 @@ class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator public: cmExtraCodeBlocksGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraCodeBlocksGenerator::GetActualName();} - static const char* GetActualName() { return "CodeBlocks";} + static std::string GetActualName() { return "CodeBlocks";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraCodeBlocksGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 1e34fe043..15fe8bbf2 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -28,7 +28,7 @@ //---------------------------------------------------------------------------- void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry, - const char*) const + const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates CodeLite project files."; diff --git a/Source/cmExtraCodeLiteGenerator.h b/Source/cmExtraCodeLiteGenerator.h index 984313e0b..6b4965d5a 100644 --- a/Source/cmExtraCodeLiteGenerator.h +++ b/Source/cmExtraCodeLiteGenerator.h @@ -35,14 +35,14 @@ protected: public: cmExtraCodeLiteGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraCodeLiteGenerator::GetActualName();} - static const char* GetActualName() { return "CodeLite";} + static std::string GetActualName() { return "CodeLite";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraCodeLiteGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); void CreateProjectFile(const std::vector& lgs); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 38a247034..4aabc7e20 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -45,7 +45,7 @@ cmExtraEclipseCDT4Generator //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Eclipse CDT 4.0 project files."; diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index d88b24774..ef99760e5 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -33,14 +33,14 @@ public: return new cmExtraEclipseCDT4Generator; } - virtual const char* GetName() const { + virtual std::string GetName() const { return cmExtraEclipseCDT4Generator::GetActualName(); } - static const char* GetActualName() { return "Eclipse CDT4"; } + static std::string GetActualName() { return "Eclipse CDT4"; } virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void EnableLanguage(std::vector const& languages, cmMakefile *, bool optional); diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index a0d37d4ef..567542e31 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -25,7 +25,7 @@ //---------------------------------------------------------------------------- void cmExtraKateGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Kate project files."; @@ -52,7 +52,7 @@ void cmExtraKateGenerator::Generate() this->ProjectName = this->GenerateProjectName(mf->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(mf->GetHomeOutputDirectory())); - this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0); + this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja"); this->CreateKateProjectFile(mf); this->CreateDummyKateProjectFile(mf); diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 6ced5fe0a..f800febe8 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -28,14 +28,14 @@ class cmExtraKateGenerator : public cmExternalMakefileProjectGenerator public: cmExtraKateGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraKateGenerator::GetActualName();} - static const char* GetActualName() { return "Kate";} + static std::string GetActualName() { return "Kate";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraKateGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 03c7c9297..f973a844c 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -41,7 +41,7 @@ http://sublimetext.info/docs/en/reference/build_systems.html //---------------------------------------------------------------------------- void cmExtraSublimeTextGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates Sublime Text 2 project files."; @@ -290,7 +290,7 @@ void cmExtraSublimeTextGenerator:: // Ninja uses ninja.build files (look for a way to get the output file name // from cmMakefile or something) std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + if (this->GlobalGenerator->GetName() == "Ninja") { makefileName = "build.ninja"; } @@ -320,7 +320,8 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( { std::string command = "\""; command += make + "\""; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) + std::string generator = this->GlobalGenerator->GetName(); + if (generator == "NMake Makefiles") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"/NOLOGO\", \"/f\", \""; @@ -329,7 +330,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( command += target; command += "\""; } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) + else if (generator == "Ninja") { std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); command += ", \"-f\", \""; @@ -341,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::BuildMakeCommand( else { std::string makefileName; - if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) + if (generator == "MinGW Makefiles") { // no escaping of spaces in this case, see // http://public.kitware.com/Bug/view.php?id=10014 diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index 44dfb3194..4173b7de3 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -31,15 +31,15 @@ public: typedef std::map > MapSourceFileFlags; cmExtraSublimeTextGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmExtraSublimeTextGenerator::GetActualName();} - static const char* GetActualName() + static std::string GetActualName() { return "Sublime Text 2";} static cmExternalMakefileProjectGenerator* New() { return new cmExtraSublimeTextGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmGlobalBorlandMakefileGenerator.h b/Source/cmGlobalBorlandMakefileGenerator.h index 70004ea3a..470dea43e 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.h +++ b/Source/cmGlobalBorlandMakefileGenerator.h @@ -28,9 +28,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalBorlandMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "Borland Makefiles";} + static std::string GetActualName() {return "Borland Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c1cce2ed6..5dee5d707 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2599,9 +2599,9 @@ void cmGlobalGenerator::SetExternalMakefileProjectGenerator( } } -const char* cmGlobalGenerator::GetExtraGeneratorName() const +std::string cmGlobalGenerator::GetExtraGeneratorName() const { - return this->ExtraGenerator==0 ? 0 : this->ExtraGenerator->GetName(); + return this->ExtraGenerator? this->ExtraGenerator->GetName() : std::string(); } void cmGlobalGenerator::FileReplacedDuringGenerate(const std::string& filename) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 761fb0760..38dc63aba 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -51,11 +51,11 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); ///! Get the name for this generator - virtual const char *GetName() const { return "Generic"; }; + virtual std::string GetName() const { return "Generic"; }; /** Check whether the given name matches the current generator. */ - virtual bool MatchesGeneratorName(const char* name) const - { return strcmp(this->GetName(), name) == 0; } + virtual bool MatchesGeneratorName(const std::string& name) const + { return this->GetName() == name; } /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ @@ -163,7 +163,7 @@ public: void SetExternalMakefileProjectGenerator( cmExternalMakefileProjectGenerator *extraGenerator); - const char* GetExtraGeneratorName() const; + std::string GetExtraGeneratorName() const; void AddInstallComponent(const char* component); diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index fd1d65fb5..3c2cd6042 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -29,7 +29,8 @@ public: virtual ~cmGlobalGeneratorFactory() {} /** Create a GlobalGenerator */ - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& n) const = 0; /** Get the documentation entry for this factory */ virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; @@ -43,8 +44,9 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory { public: /** Create a GlobalGenerator */ - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if (strcmp(name, T::GetActualName())) return 0; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if (name != T::GetActualName()) return 0; return new T; } /** Get the documentation entry for this factory */ diff --git a/Source/cmGlobalJOMMakefileGenerator.h b/Source/cmGlobalJOMMakefileGenerator.h index 28893bf27..344e01343 100644 --- a/Source/cmGlobalJOMMakefileGenerator.h +++ b/Source/cmGlobalJOMMakefileGenerator.h @@ -27,11 +27,11 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalJOMMakefileGenerator::GetActualName();} // use NMake Makefiles in the name so that scripts/tests that depend on the // name NMake Makefiles will work - static const char* GetActualName() {return "NMake Makefiles JOM";} + static std::string GetActualName() {return "NMake Makefiles JOM";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 2d485f658..71e08cc1a 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -25,7 +25,7 @@ //---------------------------------------------------------------------------- void cmGlobalKdevelopGenerator -::GetDocumentation(cmDocumentationEntry& entry, const char*) const +::GetDocumentation(cmDocumentationEntry& entry, const std::string&) const { entry.Name = this->GetName(); entry.Brief = "Generates KDevelop 3 project files."; diff --git a/Source/cmGlobalKdevelopGenerator.h b/Source/cmGlobalKdevelopGenerator.h index a1ad39d44..0d59fc578 100644 --- a/Source/cmGlobalKdevelopGenerator.h +++ b/Source/cmGlobalKdevelopGenerator.h @@ -33,14 +33,14 @@ class cmGlobalKdevelopGenerator : public cmExternalMakefileProjectGenerator public: cmGlobalKdevelopGenerator(); - virtual const char* GetName() const + virtual std::string GetName() const { return cmGlobalKdevelopGenerator::GetActualName();} - static const char* GetActualName() { return "KDevelop3";} + static std::string GetActualName() { return "KDevelop3";} static cmExternalMakefileProjectGenerator* New() { return new cmGlobalKdevelopGenerator; } /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry, - const char* fullName) const; + const std::string& fullName) const; virtual void Generate(); private: diff --git a/Source/cmGlobalMSYSMakefileGenerator.h b/Source/cmGlobalMSYSMakefileGenerator.h index 659de1186..c4825bdd1 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.h +++ b/Source/cmGlobalMSYSMakefileGenerator.h @@ -28,9 +28,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalMSYSMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "MSYS Makefiles";} + static std::string GetActualName() {return "MSYS Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalMinGWMakefileGenerator.h b/Source/cmGlobalMinGWMakefileGenerator.h index 7951e9886..428942235 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.h +++ b/Source/cmGlobalMinGWMakefileGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalMinGWMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "MinGW Makefiles";} + static std::string GetActualName() {return "MinGW Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalNMakeMakefileGenerator.h b/Source/cmGlobalNMakeMakefileGenerator.h index 5756fbd0d..2ff44e370 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.h +++ b/Source/cmGlobalNMakeMakefileGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalNMakeMakefileGenerator::GetActualName();} - static const char* GetActualName() {return "NMake Makefiles";} + static std::string GetActualName() {return "NMake Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 4a284864a..2467af9c7 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -173,11 +173,11 @@ public: virtual cmLocalGenerator* CreateLocalGenerator(); /// Overloaded methods. @see cmGlobalGenerator::GetName(). - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalNinjaGenerator::GetActualName(); } /// @return the name of this generator. - static const char* GetActualName() { return "Ninja"; } + static std::string GetActualName() { return "Ninja"; } /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation() static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 9ddbe5b45..08a1c6205 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -72,7 +72,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const { // If generating for an extra IDE, the edit_cache target cannot // launch a terminal-interactive tool, so always use cmake-gui. - if(this->GetExtraGeneratorName()) + if(!this->GetExtraGeneratorName().empty()) { return cmSystemTools::GetCMakeGUICommand(); } @@ -579,7 +579,7 @@ void cmGlobalUnixMakefileGenerator3 // Since we have full control over the invocation of nmake, let us // make it quiet. - if ( strcmp(this->GetName(), "NMake Makefiles") == 0 ) + if ( this->GetName() == "NMake Makefiles" ) { makeCommand.push_back("/NOLOGO"); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index d64afaf6f..ea2b6c045 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -60,9 +60,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalUnixMakefileGenerator3::GetActualName();} - static const char* GetActualName() {return "Unix Makefiles";} + static std::string GetActualName() {return "Unix Makefiles";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 3819a5be6..2dc658eae 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -21,13 +21,14 @@ static const char vs10generatorName[] = "Visual Studio 10 2010"; // Map generator name without year to name with year. -static const char* cmVS10GenName(const char* name, std::string& genName) +static const char* cmVS10GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs10generatorName, sizeof(vs10generatorName)-6) != 0) + if(strncmp(name.c_str(), vs10generatorName, + sizeof(vs10generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs10generatorName) - 6; + const char* p = name.c_str() + sizeof(vs10generatorName) - 6; if(cmHasLiteralPrefix(p, " 2010")) { p += 5; @@ -40,27 +41,27 @@ class cmGlobalVisualStudio10Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS10GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio10Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio10Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " IA64") == 0) { return new cmGlobalVisualStudio10Generator( - name, "Itanium", "CMAKE_FORCE_IA64"); + genName, "Itanium", "CMAKE_FORCE_IA64"); } return 0; } @@ -87,8 +88,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName, additionalPlatformDefinition) { @@ -102,7 +103,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio10Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio10Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS10GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 5d902eedb..d3ad69e51 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -24,11 +24,12 @@ class cmGlobalVisualStudio10Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio10Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio10Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual bool SetGeneratorToolset(std::string const& ts); diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 1f0c47a35..4caa7f2b3 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -16,13 +16,14 @@ static const char vs11generatorName[] = "Visual Studio 11 2012"; // Map generator name without year to name with year. -static const char* cmVS11GenName(const char* name, std::string& genName) +static const char* cmVS11GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs11generatorName, sizeof(vs11generatorName)-6) != 0) + if(strncmp(name.c_str(), vs11generatorName, + sizeof(vs11generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs11generatorName) - 6; + const char* p = name.c_str() + sizeof(vs11generatorName) - 6; if(cmHasLiteralPrefix(p, " 2012")) { p += 5; @@ -35,27 +36,27 @@ class cmGlobalVisualStudio11Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS11GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio11Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio11Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " ARM") == 0) { return new cmGlobalVisualStudio11Generator( - name, "ARM", NULL); + genName, "ARM", ""); } if(*p++ != ' ') @@ -107,8 +108,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio10Generator(name, platformName, additionalPlatformDefinition) { @@ -121,7 +122,8 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio11Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio11Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS11GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7ef77e7cc..48ea4891d 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -20,11 +20,12 @@ class cmGlobalVisualStudio11Generator: public cmGlobalVisualStudio10Generator { public: - cmGlobalVisualStudio11Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio11Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 3074794b8..6cd9f1235 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -16,13 +16,14 @@ static const char vs12generatorName[] = "Visual Studio 12 2013"; // Map generator name without year to name with year. -static const char* cmVS12GenName(const char* name, std::string& genName) +static const char* cmVS12GenName(const std::string& name, std::string& genName) { - if(strncmp(name, vs12generatorName, sizeof(vs12generatorName)-6) != 0) + if(strncmp(name.c_str(), vs12generatorName, + sizeof(vs12generatorName)-6) != 0) { return 0; } - const char* p = name + sizeof(vs12generatorName) - 6; + const char* p = name.c_str() + sizeof(vs12generatorName) - 6; if(cmHasLiteralPrefix(p, " 2013")) { p += 5; @@ -35,27 +36,27 @@ class cmGlobalVisualStudio12Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { std::string genName; const char* p = cmVS12GenName(name, genName); if(!p) { return 0; } - name = genName.c_str(); if(strcmp(p, "") == 0) { return new cmGlobalVisualStudio12Generator( - name, NULL, NULL); + genName, "", ""); } if(strcmp(p, " Win64") == 0) { return new cmGlobalVisualStudio12Generator( - name, "x64", "CMAKE_FORCE_WIN64"); + genName, "x64", "CMAKE_FORCE_WIN64"); } if(strcmp(p, " ARM") == 0) { return new cmGlobalVisualStudio12Generator( - name, "ARM", NULL); + genName, "ARM", ""); } return 0; } @@ -82,8 +83,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio12Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio11Generator(name, platformName, additionalPlatformDefinition) { @@ -96,7 +97,8 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( //---------------------------------------------------------------------------- bool -cmGlobalVisualStudio12Generator::MatchesGeneratorName(const char* name) const +cmGlobalVisualStudio12Generator::MatchesGeneratorName( + const std::string& name) const { std::string genName; if(cmVS12GenName(name, genName)) diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h index 5a4a78d0b..4557f28d0 100644 --- a/Source/cmGlobalVisualStudio12Generator.h +++ b/Source/cmGlobalVisualStudio12Generator.h @@ -20,11 +20,12 @@ class cmGlobalVisualStudio12Generator: public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio12Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio12Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); - virtual bool MatchesGeneratorName(const char* name) const; + virtual bool MatchesGeneratorName(const std::string& name) const; virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index eb3dddf97..14046f0c3 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -31,9 +31,9 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio6Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 6";} + static std::string GetActualName() {return "Visual Studio 6";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 08bcc5b71..4bea5acdd 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -17,7 +17,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator( - const char* platformName) : cmGlobalVisualStudio7Generator(platformName) + const std::string& platformName) + : cmGlobalVisualStudio7Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfiguration"; } @@ -279,10 +280,10 @@ void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + std::string const& platformMapping) { - const char* platformName = - platformMapping ? platformMapping : this->GetPlatformName(); + const std::string& platformName = + !platformMapping.empty() ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 75cc6aeb9..2b5259a76 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -23,15 +23,15 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator { public: - cmGlobalVisualStudio71Generator(const char* platformName = NULL); + cmGlobalVisualStudio71Generator(const std::string& platformName = ""); static cmGlobalGeneratorFactory* NewFactory() { return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio71Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 7 .NET 2003";} + static std::string GetActualName() {return "Visual Studio 7 .NET 2003";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -67,7 +67,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual void WriteExternalProject(std::ostream& fout, const std::string& name, const char* path, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 392710049..03772ddf7 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -19,16 +19,19 @@ #include cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( - const char* platformName) + const std::string& platformName) { this->IntelProjectVersion = 0; this->DevEnvCommandInitialized = false; - if (!platformName) + if (platformName.empty()) { - platformName = "Win32"; + this->PlatformName = "Win32"; + } + else + { + this->PlatformName = platformName; } - this->PlatformName = platformName; } cmGlobalVisualStudio7Generator::~cmGlobalVisualStudio7Generator() @@ -260,7 +263,7 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); + mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName().c_str()); mf->AddDefinition("CMAKE_VS_INTEL_Fortran_PROJECT_VERSION", this->GetIntelProjectVersion()); } @@ -381,9 +384,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( { std::set allConfigurations(this->Configurations.begin(), this->Configurations.end()); + const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING"); this->WriteProjectConfigurations( fout, target->GetName().c_str(), target->GetType(), - allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING")); + allConfigurations, mapping ? mapping : ""); } else { @@ -732,10 +736,10 @@ void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + const std::string& platformMapping) { - const char* platformName = - platformMapping ? platformMapping : this->GetPlatformName(); + const std::string& platformName = + !platformMapping.empty() ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b65948036..9ab04626a 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -26,7 +26,7 @@ struct cmIDEFlagTable; class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator { public: - cmGlobalVisualStudio7Generator(const char* platformName = NULL); + cmGlobalVisualStudio7Generator(const std::string& platformName = ""); ~cmGlobalVisualStudio7Generator(); static cmGlobalGeneratorFactory* NewFactory() { @@ -34,12 +34,12 @@ public: (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalVisualStudio7Generator::GetActualName();} - static const char* GetActualName() {return "Visual Studio 7";} + static std::string GetActualName() {return "Visual Studio 7";} ///! Get the name for the platform. - const char* GetPlatformName() const { return this->PlatformName.c_str(); } + const std::string& GetPlatformName() const { return this->PlatformName; } ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); @@ -131,7 +131,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual void WriteSLNGlobalSections(std::ostream& fout, cmLocalGenerator* root); virtual void WriteSLNFooter(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 2ae1bbc17..08c139734 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -23,17 +23,19 @@ class cmGlobalVisualStudio8Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if(strstr(name, vs8generatorName) != name) + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if(strncmp(name.c_str(), vs8generatorName, + sizeof(vs8generatorName) - 1) != 0) { return 0; } - const char* p = name + sizeof(vs8generatorName) - 1; + const char* p = name.c_str() + sizeof(vs8generatorName) - 1; if(p[0] == '\0') { return new cmGlobalVisualStudio8Generator( - name, NULL, NULL); + name, "", ""); } if(p[0] != ' ') @@ -57,7 +59,7 @@ public: } cmGlobalVisualStudio8Generator* ret = new cmGlobalVisualStudio8Generator( - name, p, NULL); + name, p, ""); ret->WindowsCEVersion = parser.GetOSVersion(); return ret; } @@ -90,14 +92,14 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio71Generator(platformName) { this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; this->Name = name; - if (additionalPlatformDefinition) + if (!additionalPlatformDefinition.empty()) { this->AdditionalPlatformDefinition = additionalPlatformDefinition; } @@ -374,7 +376,7 @@ cmGlobalVisualStudio8Generator ::WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping) + std::string const& platformMapping) { std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); @@ -382,7 +384,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; std::set::const_iterator ci = configsPartOfDefaultBuild.find(*i); @@ -390,7 +393,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; } bool needsDeploy = (type == cmTarget::EXECUTABLE || @@ -399,7 +403,8 @@ cmGlobalVisualStudio8Generator { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|" - << (platformMapping ? platformMapping : this->GetPlatformName()) + << (!platformMapping.empty()? + platformMapping : this->GetPlatformName()) << "\n"; } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index bafb9eb90..2459c05a5 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -23,12 +23,13 @@ class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator { public: - cmGlobalVisualStudio8Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio8Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - virtual const char* GetName() const {return this->Name.c_str();} + virtual std::string GetName() const {return this->Name;} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -81,7 +82,7 @@ protected: virtual void WriteProjectConfigurations( std::ostream& fout, const std::string& name, cmTarget::TargetType type, const std::set& configsPartOfDefaultBuild, - const char* platformMapping = NULL); + const std::string& platformMapping = ""); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const std::string& name, diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index ccc27ad6f..c0051c723 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -22,17 +22,19 @@ class cmGlobalVisualStudio9Generator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const { - if(strstr(name, vs9generatorName) != name) + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const { + if(strncmp(name.c_str(), vs9generatorName, + sizeof(vs9generatorName) - 1) != 0) { return 0; } - const char* p = name + sizeof(vs9generatorName) - 1; + const char* p = name.c_str() + sizeof(vs9generatorName) - 1; if(p[0] == '\0') { return new cmGlobalVisualStudio9Generator( - name, NULL, NULL); + name, "", ""); } if(p[0] != ' ') @@ -96,8 +98,8 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory() //---------------------------------------------------------------------------- cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( - const char* name, const char* platformName, - const char* additionalPlatformDefinition) + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) : cmGlobalVisualStudio8Generator(name, platformName, additionalPlatformDefinition) { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 202aa8d12..fb87bbefa 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -24,8 +24,9 @@ class cmGlobalVisualStudio9Generator : public cmGlobalVisualStudio8Generator { public: - cmGlobalVisualStudio9Generator(const char* name, - const char* platformName, const char* additionalPlatformDefinition); + cmGlobalVisualStudio9Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); static cmGlobalGeneratorFactory* NewFactory(); ///! create the correct local generator diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index b2a705ecc..69c893cc8 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -22,7 +22,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { - this->AdditionalPlatformDefinition = NULL; + this->AdditionalPlatformDefinition = ""; } //---------------------------------------------------------------------------- @@ -518,7 +518,7 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf) //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) { - if(this->AdditionalPlatformDefinition) + if(!this->AdditionalPlatformDefinition.empty()) { mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE"); } diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index dc0f9c71e..7e8dcf8b7 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -110,7 +110,7 @@ protected: std::string GetUtilityDepend(cmTarget const* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; - const char* AdditionalPlatformDefinition; + std::string AdditionalPlatformDefinition; private: virtual std::string GetVSMakeProgram() = 0; diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h index d5350efd1..2057a4295 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.h +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -27,9 +27,9 @@ public: return new cmGlobalGeneratorSimpleFactory (); } ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalWatcomWMakeGenerator::GetActualName();} - static const char* GetActualName() {return "Watcom WMake";} + static std::string GetActualName() {return "Watcom WMake";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e1f2a919a..30bded536 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -116,7 +116,8 @@ public: class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory { public: - virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const; + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& name) const; virtual void GetDocumentation(cmDocumentationEntry& entry) const { cmGlobalXCodeGenerator::GetDocumentation(entry); } @@ -152,9 +153,9 @@ cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory() //---------------------------------------------------------------------------- cmGlobalGenerator* cmGlobalXCodeGenerator::Factory -::CreateGlobalGenerator(const char* name) const +::CreateGlobalGenerator(const std::string& name) const { - if (strcmp(name, GetActualName())) + if (name != GetActualName()) return 0; #if defined(CMAKE_BUILD_WITH_CMAKE) cmXcodeVersionParser parser; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index aec795841..54c6f965c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -33,9 +33,9 @@ public: static cmGlobalGeneratorFactory* NewFactory(); ///! Get the name for the generator. - virtual const char* GetName() const { + virtual std::string GetName() const { return cmGlobalXCodeGenerator::GetActualName();} - static const char* GetActualName() {return "Xcode";} + static std::string GetActualName() {return "Xcode";} /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index d2e66a5c9..6c045594a 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -53,7 +53,7 @@ public: */ void SetBuildType(BuildType,const std::string& name); - void SetPlatformName(const char* n) { this->PlatformName = n;} + void SetPlatformName(const std::string& n) { this->PlatformName = n;} void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e61b12bf4..e8be29fe0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1378,8 +1378,8 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) // VS6 IDE does not support definition values with spaces in // combination with '"', '$', or ';'. - if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(), - "Visual Studio 6") == 0) && + if((this->LocalGenerator->GetGlobalGenerator()->GetName() == + "Visual Studio 6") && (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos)) { return false; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 48a6b38e3..c32f62480 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -251,7 +251,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) bool usePRE_BUILD = false; cmLocalGenerator* localGen = makefile->GetLocalGenerator(); cmGlobalGenerator* gg = localGen->GetGlobalGenerator(); - if(strstr(gg->GetName(), "Visual Studio")) + if(gg->GetName().find("Visual Studio") != std::string::npos) { cmLocalVisualStudioGenerator* vslg = static_cast(localGen); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 13572f418..abe27a5e9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -965,7 +965,7 @@ int cmake::AddCMakePaths() return 1; } -void cmake::AddExtraGenerator(const char* name, +void cmake::AddExtraGenerator(const std::string& name, CreateExtraGeneratorFunctionType newFunction) { cmExternalMakefileProjectGenerator* extraGenerator = newFunction(); @@ -1034,9 +1034,10 @@ void cmake::GetRegisteredGenerators(std::vector& names) } } -cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) +cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname) { cmExternalMakefileProjectGenerator* extraGenerator = 0; + std::string name = gname; RegisteredExtraGeneratorsMap::const_iterator extraGenIt = this->ExtraGenerators.find(name); if (extraGenIt != this->ExtraGenerators.end()) @@ -1324,7 +1325,8 @@ int cmake::ActualConfigure() if(genName) { std::string fullName = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(genName, extraGenName); + CreateFullGeneratorName(genName, + extraGenName ? extraGenName : ""); this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str()); } if(this->GlobalGenerator) @@ -1417,13 +1419,13 @@ int cmake::ActualConfigure() if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR")) { this->CacheManager->AddCacheEntry("CMAKE_GENERATOR", - this->GlobalGenerator->GetName(), + this->GlobalGenerator->GetName().c_str(), "Name of generator.", cmCacheManager::INTERNAL); this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR", - this->GlobalGenerator->GetExtraGeneratorName(), - "Name of external makefile project generator.", - cmCacheManager::INTERNAL); + this->GlobalGenerator->GetExtraGeneratorName().c_str(), + "Name of external makefile project generator.", + cmCacheManager::INTERNAL); } if(const char* tsName = diff --git a/Source/cmake.h b/Source/cmake.h index 933502a26..3134493a4 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -175,7 +175,7 @@ class cmake void PreLoadCMakeFiles(); ///! Create a GlobalGenerator - cmGlobalGenerator* CreateGlobalGenerator(const char* name); + cmGlobalGenerator* CreateGlobalGenerator(const std::string& name); ///! Return the global generator assigned to this instance of cmake cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; } @@ -380,7 +380,7 @@ protected: void AddDefaultCommands(); void AddDefaultGenerators(); void AddDefaultExtraGenerators(); - void AddExtraGenerator(const char* name, + void AddExtraGenerator(const std::string& name, CreateExtraGeneratorFunctionType newFunction); cmPolicies *Policies; From 6557382dcffef8ed6b11394cb65775d82f1c0aa7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 17:38:55 -0500 Subject: [PATCH 142/278] stringapi: Use strings for program paths --- Source/cmBuildCommand.cxx | 4 +-- Source/cmGlobalGenerator.cxx | 31 +++++++++++++--------- Source/cmGlobalGenerator.h | 8 +++--- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 2 +- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 2 +- Source/cmGlobalXCodeGenerator.h | 2 +- Source/cmake.cxx | 2 +- 16 files changed, 38 insertions(+), 31 deletions(-) diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index d8e1a2c22..780ffa86a 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -107,7 +107,7 @@ bool cmBuildCommand std::string makecommand = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->GenerateCMakeBuildCommand(target, configuration, - 0, true); + "", true); this->Makefile->AddDefinition(variable, makecommand.c_str()); @@ -137,7 +137,7 @@ bool cmBuildCommand std::string makecommand = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), - 0, true); + "", true); if(cacheValue) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5dee5d707..faed66a21 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -89,19 +89,25 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts) return false; } -std::string cmGlobalGenerator::SelectMakeProgram(const char* makeProgram, - std::string makeDefault) const +std::string cmGlobalGenerator::SelectMakeProgram( + const std::string& inMakeProgram, + const std::string& makeDefault) const { - if(cmSystemTools::IsOff(makeProgram)) + std::string makeProgram = inMakeProgram; + if(cmSystemTools::IsOff(makeProgram.c_str())) { - makeProgram = + const char* makeProgramCSTR = this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - if(cmSystemTools::IsOff(makeProgram)) + if(cmSystemTools::IsOff(makeProgramCSTR)) { - makeProgram = makeDefault.c_str(); + makeProgram = makeDefault; } - if(cmSystemTools::IsOff(makeProgram) && - !(makeProgram && *makeProgram)) + else + { + makeProgram = makeProgramCSTR; + } + if(cmSystemTools::IsOff(makeProgram.c_str()) && + !makeProgram.empty()) { makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND"; } @@ -1660,13 +1666,14 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, newTarget.c_str(), - output,0,config,false,fast, + output,"",config,false,fast, this->TryCompileTimeout); } void cmGlobalGenerator::GenerateBuildCommand( - std::vector& makeCommand, const char*, const std::string&, - const std::string&, const std::string&, const std::string&, bool, + std::vector& makeCommand, const std::string&, + const std::string&, const std::string&, const std::string&, + const std::string&, bool, std::vector const&) { makeCommand.push_back( @@ -1677,7 +1684,7 @@ int cmGlobalGenerator::Build( const std::string&, const std::string& bindir, const std::string& projectName, const std::string& target, std::string *output, - const char *makeCommandCSTR, + const std::string& makeCommandCSTR, const std::string& config, bool clean, bool fast, double timeout, diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 38dc63aba..91e71a82d 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -120,7 +120,7 @@ public: int Build(const std::string& srcdir, const std::string& bindir, const std::string& projectName, const std::string& targetName, std::string *output, - const char *makeProgram, const std::string& config, + const std::string& makeProgram, const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, @@ -129,7 +129,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, const std::string& config, bool fast, std::vector const& makeOptions = std::vector() @@ -345,8 +345,8 @@ protected: cmTarget const*> > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); - std::string SelectMakeProgram(const char* makeProgram, - std::string makeDefault = "") const; + std::string SelectMakeProgram(const std::string& makeProgram, + const std::string& makeDefault = "") const; // Fill the ProjectMap, this must be called after LocalGenerators // has been populated. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 73a6245d5..785b9029c 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -551,7 +551,7 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false; // cmGlobalGenerator::Build() void cmGlobalNinjaGenerator ::GenerateBuildCommand(std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 2467af9c7..7725cf352 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -193,7 +193,7 @@ public: /// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand() virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 08a1c6205..d41cee62c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -565,7 +565,7 @@ cmGlobalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3 ::GenerateBuildCommand(std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& /*projectName*/, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index ea2b6c045..811517627 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -109,7 +109,7 @@ public: // change the build command for speed virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 2dc658eae..840e8888e 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -312,7 +312,7 @@ std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index d3ad69e51..999a9d54c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -35,7 +35,7 @@ public: virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 3a51fce80..7397bbb95 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -116,7 +116,7 @@ std::string cmGlobalVisualStudio6Generator::FindMSDevCommand() void cmGlobalVisualStudio6Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 14046f0c3..2797e11b1 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -54,7 +54,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 03772ddf7..320b4403a 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -186,7 +186,7 @@ const char* cmGlobalVisualStudio7Generator::ExternalProjectType( //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 9ab04626a..0d2e410c8 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -62,7 +62,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 30bded536..30a2a1ec3 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -261,7 +261,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vectorconst& void cmGlobalXCodeGenerator::GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& /*projectDir*/, const std::string& targetName, diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 54c6f965c..93315ba8a 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -55,7 +55,7 @@ public: */ virtual void GenerateBuildCommand( std::vector& makeCommand, - const char* makeProgram, + const std::string& makeProgram, const std::string& projectName, const std::string& projectDir, const std::string& targetName, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index abe27a5e9..ab1241146 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2672,7 +2672,7 @@ int cmake::Build(const std::string& dir, return gen->Build("", dir.c_str(), projName.c_str(), target.c_str(), &output, - 0, + "", config.c_str(), clean, false, 0, cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions); From 85fc9f26a703f28b356c93d405446c39bba43846 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:19:17 -0500 Subject: [PATCH 143/278] stringapi: Command names --- Source/CTest/cmCTestBuildCommand.h | 2 +- Source/CTest/cmCTestConfigureCommand.h | 2 +- Source/CTest/cmCTestCoverageCommand.h | 2 +- Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h | 2 +- Source/CTest/cmCTestMemCheckCommand.h | 2 +- Source/CTest/cmCTestReadCustomFilesCommand.h | 2 +- Source/CTest/cmCTestRunScriptCommand.h | 2 +- Source/CTest/cmCTestSleepCommand.h | 2 +- Source/CTest/cmCTestStartCommand.h | 2 +- Source/CTest/cmCTestSubmitCommand.h | 2 +- Source/CTest/cmCTestTestCommand.h | 2 +- Source/CTest/cmCTestTestHandler.cxx | 8 ++++---- Source/CTest/cmCTestUpdateCommand.h | 2 +- Source/CTest/cmCTestUploadCommand.h | 2 +- Source/cmAddCompileOptionsCommand.h | 2 +- Source/cmAddCustomCommandCommand.h | 2 +- Source/cmAddCustomTargetCommand.h | 2 +- Source/cmAddDefinitionsCommand.h | 2 +- Source/cmAddDependenciesCommand.h | 2 +- Source/cmAddExecutableCommand.h | 2 +- Source/cmAddLibraryCommand.h | 2 +- Source/cmAddSubDirectoryCommand.h | 2 +- Source/cmAddTestCommand.h | 2 +- Source/cmAuxSourceDirectoryCommand.h | 2 +- Source/cmBreakCommand.h | 2 +- Source/cmBuildCommand.h | 2 +- Source/cmBuildNameCommand.h | 2 +- Source/cmCMakeHostSystemInformationCommand.h | 2 +- Source/cmCMakeMinimumRequired.h | 2 +- Source/cmCMakePolicyCommand.h | 2 +- Source/cmCommand.h | 2 +- Source/cmConfigureFileCommand.h | 2 +- Source/cmCreateTestSourceList.h | 2 +- Source/cmDefinePropertyCommand.h | 2 +- Source/cmDocumentationSection.h | 4 ++-- Source/cmElseCommand.h | 2 +- Source/cmElseIfCommand.h | 2 +- Source/cmEnableLanguageCommand.h | 2 +- Source/cmEnableTestingCommand.h | 2 +- Source/cmEndForEachCommand.h | 2 +- Source/cmEndFunctionCommand.h | 2 +- Source/cmEndIfCommand.h | 2 +- Source/cmEndMacroCommand.h | 2 +- Source/cmEndWhileCommand.h | 2 +- Source/cmExecProgramCommand.h | 2 +- Source/cmExecuteProcessCommand.h | 2 +- Source/cmExportCommand.h | 2 +- Source/cmExportLibraryDependenciesCommand.h | 2 +- Source/cmFLTKWrapUICommand.h | 2 +- Source/cmFileCommand.h | 2 +- Source/cmFindFileCommand.h | 2 +- Source/cmFindLibraryCommand.h | 2 +- Source/cmFindPackageCommand.h | 2 +- Source/cmFindPathCommand.h | 2 +- Source/cmFindProgramCommand.h | 2 +- Source/cmForEachCommand.h | 2 +- Source/cmFunctionCommand.cxx | 2 +- Source/cmFunctionCommand.h | 2 +- Source/cmGetCMakePropertyCommand.h | 2 +- Source/cmGetDirectoryPropertyCommand.h | 2 +- Source/cmGetFilenameComponentCommand.h | 2 +- Source/cmGetPropertyCommand.h | 2 +- Source/cmGetSourceFilePropertyCommand.h | 2 +- Source/cmGetTargetPropertyCommand.h | 2 +- Source/cmGetTestPropertyCommand.h | 2 +- Source/cmIfCommand.h | 2 +- Source/cmIncludeCommand.h | 2 +- Source/cmIncludeDirectoryCommand.h | 2 +- Source/cmIncludeExternalMSProjectCommand.h | 2 +- Source/cmIncludeRegularExpressionCommand.h | 2 +- Source/cmInstallCommand.h | 2 +- Source/cmInstallFilesCommand.h | 2 +- Source/cmInstallProgramsCommand.h | 2 +- Source/cmInstallTargetsCommand.h | 2 +- Source/cmLinkDirectoriesCommand.h | 2 +- Source/cmLinkLibrariesCommand.h | 2 +- Source/cmListCommand.h | 2 +- Source/cmLoadCacheCommand.h | 2 +- Source/cmLoadCommandCommand.cxx | 2 +- Source/cmLoadCommandCommand.h | 2 +- Source/cmMacroCommand.cxx | 2 +- Source/cmMacroCommand.h | 2 +- Source/cmMakeDirectoryCommand.h | 2 +- Source/cmMarkAsAdvancedCommand.h | 2 +- Source/cmMathCommand.h | 2 +- Source/cmMessageCommand.h | 2 +- Source/cmOptionCommand.h | 2 +- Source/cmOutputRequiredFilesCommand.h | 2 +- Source/cmProjectCommand.h | 2 +- Source/cmQTWrapCPPCommand.h | 2 +- Source/cmQTWrapUICommand.h | 2 +- Source/cmRemoveCommand.h | 2 +- Source/cmRemoveDefinitionsCommand.h | 2 +- Source/cmReturnCommand.h | 2 +- Source/cmSeparateArgumentsCommand.h | 2 +- Source/cmSetCommand.h | 2 +- Source/cmSetDirectoryPropertiesCommand.h | 2 +- Source/cmSetPropertyCommand.h | 2 +- Source/cmSetSourceFilesPropertiesCommand.h | 2 +- Source/cmSetTargetPropertiesCommand.h | 2 +- Source/cmSetTestsPropertiesCommand.h | 2 +- Source/cmSiteNameCommand.h | 2 +- Source/cmSourceGroupCommand.h | 2 +- Source/cmStringCommand.h | 2 +- Source/cmSubdirCommand.h | 2 +- Source/cmSubdirDependsCommand.h | 2 +- Source/cmTargetCompileDefinitionsCommand.h | 2 +- Source/cmTargetCompileOptionsCommand.h | 2 +- Source/cmTargetIncludeDirectoriesCommand.h | 2 +- Source/cmTargetLinkLibrariesCommand.h | 2 +- Source/cmTryCompileCommand.h | 2 +- Source/cmTryRunCommand.h | 2 +- Source/cmUnsetCommand.h | 2 +- Source/cmUseMangledMesaCommand.h | 2 +- Source/cmUtilitySourceCommand.h | 2 +- Source/cmVariableRequiresCommand.h | 2 +- Source/cmVariableWatchCommand.h | 2 +- Source/cmWhileCommand.h | 2 +- Source/cmWriteFileCommand.h | 2 +- Source/cmake.cxx | 9 +++++---- Source/cmake.h | 8 ++++---- 121 files changed, 132 insertions(+), 131 deletions(-) diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 08887fe8e..2632ebc47 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_build";} + virtual std::string GetName() const { return "ctest_build";} virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index b592c5a2c..7941d4e3c 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -38,7 +38,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_configure";} + virtual std::string GetName() const { return "ctest_configure";} cmTypeMacro(cmCTestConfigureCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestCoverageCommand.h b/Source/CTest/cmCTestCoverageCommand.h index 37315922c..5762e0731 100644 --- a/Source/CTest/cmCTestCoverageCommand.h +++ b/Source/CTest/cmCTestCoverageCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_coverage";} + virtual std::string GetName() const { return "ctest_coverage";} cmTypeMacro(cmCTestCoverageCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index 07e59a46c..d182d1794 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_empty_binary_directory";} + virtual std::string GetName() const { return "ctest_empty_binary_directory";} cmTypeMacro(cmCTestEmptyBinaryDirectoryCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestMemCheckCommand.h b/Source/CTest/cmCTestMemCheckCommand.h index b50170df1..e239d4642 100644 --- a/Source/CTest/cmCTestMemCheckCommand.h +++ b/Source/CTest/cmCTestMemCheckCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_memcheck";} + virtual std::string GetName() const { return "ctest_memcheck";} cmTypeMacro(cmCTestMemCheckCommand, cmCTestTestCommand); diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index 9c0af8198..c95694ae5 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/Source/CTest/cmCTestReadCustomFilesCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_read_custom_files";} + virtual std::string GetName() const { return "ctest_read_custom_files";} cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index f34bd133c..0998e5c62 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/Source/CTest/cmCTestRunScriptCommand.h @@ -47,7 +47,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_run_script";} + virtual std::string GetName() const { return "ctest_run_script";} cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand); }; diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index c6baf1c57..740a7e12a 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -47,7 +47,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_sleep";} + virtual std::string GetName() const { return "ctest_sleep";} cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index e5535c110..3b8843f35 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/Source/CTest/cmCTestStartCommand.h @@ -55,7 +55,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_start";} + virtual std::string GetName() const { return "ctest_start";} cmTypeMacro(cmCTestStartCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 64c6cae26..3673fbdec 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_submit";} + virtual std::string GetName() const { return "ctest_submit";} cmTypeMacro(cmCTestSubmitCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 451ac99ff..a1e5f368f 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_test";} + virtual std::string GetName() const { return "ctest_test";} cmTypeMacro(cmCTestTestCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b1dddcb03..59706568f 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -60,7 +60,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "subdirs";} + virtual std::string GetName() const { return "subdirs";} cmTypeMacro(cmCTestSubdirCommand, cmCommand); @@ -157,7 +157,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_subdirectory";} + virtual std::string GetName() const { return "add_subdirectory";} cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand); @@ -243,7 +243,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_test";} + virtual std::string GetName() const { return "add_test";} cmTypeMacro(cmCTestAddTestCommand, cmCommand); @@ -287,7 +287,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_tests_properties";} + virtual std::string GetName() const { return "set_tests_properties";} cmTypeMacro(cmCTestSetTestsPropertiesCommand, cmCommand); diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index a785bd860..fb80333b7 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_update";} + virtual std::string GetName() const { return "ctest_update";} cmTypeMacro(cmCTestUpdateCommand, cmCTestHandlerCommand); diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index e867fb687..4a07608d2 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ctest_upload";} + virtual std::string GetName() const { return "ctest_upload";} cmTypeMacro(cmCTestUploadCommand, cmCTestHandlerCommand); diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h index 38ed2089f..f147ec04e 100644 --- a/Source/cmAddCompileOptionsCommand.h +++ b/Source/cmAddCompileOptionsCommand.h @@ -35,7 +35,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_compile_options";} + virtual std::string GetName() const {return "add_compile_options";} cmTypeMacro(cmAddCompileOptionsCommand, cmCommand); }; diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 114957f18..1d6ddb288 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_custom_command";} + virtual std::string GetName() const {return "add_custom_command";} cmTypeMacro(cmAddCustomCommandCommand, cmCommand); protected: diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index d0fcdad77..d2b00adf4 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/Source/cmAddCustomTargetCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "add_custom_target";} cmTypeMacro(cmAddCustomTargetCommand, cmCommand); diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index d05f1875e..9800fd291 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/Source/cmAddDefinitionsCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "add_definitions";} + virtual std::string GetName() const {return "add_definitions";} cmTypeMacro(cmAddDefinitionsCommand, cmCommand); }; diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 247cc5465..db3712a24 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_dependencies";} + virtual std::string GetName() const { return "add_dependencies";} cmTypeMacro(cmAddDependenciesCommand, cmCommand); }; diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 30ecce3df..e134077b5 100644 --- a/Source/cmAddExecutableCommand.h +++ b/Source/cmAddExecutableCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_executable";} + virtual std::string GetName() const { return "add_executable";} cmTypeMacro(cmAddExecutableCommand, cmCommand); }; diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index 10010439f..350708b23 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_library";} + virtual std::string GetName() const { return "add_library";} cmTypeMacro(cmAddLibraryCommand, cmCommand); }; diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index 1e5b1abdd..abf3efcd9 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/Source/cmAddSubDirectoryCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_subdirectory";} + virtual std::string GetName() const { return "add_subdirectory";} cmTypeMacro(cmAddSubDirectoryCommand, cmCommand); }; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 9173454dc..624288f57 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "add_test";} + virtual std::string GetName() const { return "add_test";} cmTypeMacro(cmAddTestCommand, cmCommand); private: diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 8b5fa8ab1..6615273bb 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/Source/cmAuxSourceDirectoryCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "aux_source_directory";} + virtual std::string GetName() const { return "aux_source_directory";} cmTypeMacro(cmAuxSourceDirectoryCommand, cmCommand); }; diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h index 52f0e9c47..1fcae505a 100644 --- a/Source/cmBreakCommand.h +++ b/Source/cmBreakCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "break";} + virtual std::string GetName() const {return "break";} cmTypeMacro(cmBreakCommand, cmCommand); }; diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 21606555e..3fb618f9c 100644 --- a/Source/cmBuildCommand.h +++ b/Source/cmBuildCommand.h @@ -50,7 +50,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "build_command";} + virtual std::string GetName() const {return "build_command";} cmTypeMacro(cmBuildCommand, cmCommand); }; diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index 2f7acdeb7..8f8038feb 100644 --- a/Source/cmBuildNameCommand.h +++ b/Source/cmBuildNameCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmBuildNameCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const {return "build_name";} + virtual std::string GetName() const {return "build_name";} virtual bool IsScriptable() const { return true; } virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmCMakeHostSystemInformationCommand.h b/Source/cmCMakeHostSystemInformationCommand.h index 27ba638e8..463b180b3 100644 --- a/Source/cmCMakeHostSystemInformationCommand.h +++ b/Source/cmCMakeHostSystemInformationCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const { return "cmake_host_system_information"; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 0cdd4c523..31b727198 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "cmake_minimum_required";} + virtual std::string GetName() const {return "cmake_minimum_required";} cmTypeMacro(cmCMakeMinimumRequired, cmCommand); diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index 7e3f4e6e2..8dc8fbeed 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "cmake_policy";} + virtual std::string GetName() const {return "cmake_policy";} cmTypeMacro(cmCMakePolicyCommand, cmCommand); private: diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 2378ef0f8..b15869a70 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -124,7 +124,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const = 0; + virtual std::string GetName() const = 0; /** * Enable the command. diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 86de92c1d..8155ef736 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -34,7 +34,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "configure_file";} + virtual std::string GetName() const { return "configure_file";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 8b1e4deaf..2f6b541f8 100644 --- a/Source/cmCreateTestSourceList.h +++ b/Source/cmCreateTestSourceList.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "create_test_sourcelist";} + virtual std::string GetName() const {return "create_test_sourcelist";} cmTypeMacro(cmCreateTestSourceList, cmCommand); }; diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 8dc4d963a..bc5c8a4f8 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/Source/cmDefinePropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "define_property";} + virtual std::string GetName() const { return "define_property";} cmTypeMacro(cmDefinePropertyCommand, cmCommand); private: diff --git a/Source/cmDocumentationSection.h b/Source/cmDocumentationSection.h index 636860d35..d796da84b 100644 --- a/Source/cmDocumentationSection.h +++ b/Source/cmDocumentationSection.h @@ -34,8 +34,8 @@ public: void Clear() { this->Entries.clear(); } /** Return the name of this section. */ - const char* GetName() const - { return this->Name.c_str(); } + std::string GetName() const + { return this->Name; } /** Return a pointer to the first entry of this section. */ const std::vector &GetEntries() const diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index d472e99a7..dde5fcc61 100644 --- a/Source/cmElseCommand.h +++ b/Source/cmElseCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "else";} + virtual std::string GetName() const { return "else";} cmTypeMacro(cmElseCommand, cmCommand); }; diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index d811b35cc..c627cbe5e 100644 --- a/Source/cmElseIfCommand.h +++ b/Source/cmElseIfCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "elseif";} + virtual std::string GetName() const { return "elseif";} cmTypeMacro(cmElseIfCommand, cmCommand); }; diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index a248042ac..2b09e1186 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/Source/cmEnableLanguageCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "enable_language";} + virtual std::string GetName() const {return "enable_language";} cmTypeMacro(cmEnableLanguageCommand, cmCommand); }; diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index e102f5e43..d028c59b4 100644 --- a/Source/cmEnableTestingCommand.h +++ b/Source/cmEnableTestingCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "enable_testing";} + virtual std::string GetName() const { return "enable_testing";} cmTypeMacro(cmEnableTestingCommand, cmCommand); diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 44d29b56f..c3be3879b 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endforeach";} + virtual std::string GetName() const { return "endforeach";} cmTypeMacro(cmEndForEachCommand, cmCommand); }; diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 4fdca6bc6..3a42c1743 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endfunction";} + virtual std::string GetName() const { return "endfunction";} cmTypeMacro(cmEndFunctionCommand, cmCommand); }; diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 634da60cc..a8248c81a 100644 --- a/Source/cmEndIfCommand.h +++ b/Source/cmEndIfCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endif";} + virtual std::string GetName() const { return "endif";} cmTypeMacro(cmEndIfCommand, cmCommand); }; diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index db15f2742..fdc04eebb 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endmacro";} + virtual std::string GetName() const { return "endmacro";} cmTypeMacro(cmEndMacroCommand, cmCommand); }; diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index 41138d1a9..ec1cb652f 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "endwhile";} + virtual std::string GetName() const { return "endwhile";} cmTypeMacro(cmEndWhileCommand, cmCommand); }; diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index 6d28cdcc7..23d10f9f1 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "exec_program";} /** diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index bd0f783b6..6906a08a8 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/Source/cmExecuteProcessCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const + virtual std::string GetName() const {return "execute_process";} /** diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index c0e445f8a..f9506bbdd 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "export";} + virtual std::string GetName() const { return "export";} cmTypeMacro(cmExportCommand, cmCommand); diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 29b568fc8..2ea4e79b9 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmExportLibraryDependenciesCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "export_library_dependencies";} + virtual std::string GetName() const { return "export_library_dependencies";} virtual bool IsDiscouraged() const { return true; } virtual void FinalPass(); diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index b94390ca9..617fcd955 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -52,7 +52,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "fltk_wrap_ui";} + virtual std::string GetName() const { return "fltk_wrap_ui";} private: /** diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index ba4581516..8d66fdf18 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "file";} + virtual std::string GetName() const { return "file";} cmTypeMacro(cmFileCommand, cmCommand); diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h index 3f0baa2cd..daf1d6582 100644 --- a/Source/cmFindFileCommand.h +++ b/Source/cmFindFileCommand.h @@ -33,7 +33,7 @@ public: { return new cmFindFileCommand; } - virtual const char* GetName() const { return "find_file";} + virtual std::string GetName() const { return "find_file";} cmTypeMacro(cmFindFileCommand, cmFindPathCommand); }; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index a9ec40e93..e25717446 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "find_library";} + virtual std::string GetName() const {return "find_library";} cmTypeMacro(cmFindLibraryCommand, cmFindBase); diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 72c1e3c9e..224945948 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "find_package";} + virtual std::string GetName() const { return "find_package";} cmTypeMacro(cmFindPackageCommand, cmFindCommon); private: diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 8df4540dc..a51da7920 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -49,7 +49,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "find_path";} + virtual std::string GetName() const {return "find_path";} cmTypeMacro(cmFindPathCommand, cmFindBase); bool IncludeFileInPath; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 7f4811c0a..70f758ff8 100644 --- a/Source/cmFindProgramCommand.h +++ b/Source/cmFindProgramCommand.h @@ -48,7 +48,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "find_program";} + virtual std::string GetName() const { return "find_program";} cmTypeMacro(cmFindProgramCommand, cmFindBase); diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index e548ba8d8..9b7c85a4d 100644 --- a/Source/cmForEachCommand.h +++ b/Source/cmForEachCommand.h @@ -59,7 +59,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "foreach";} + virtual std::string GetName() const { return "foreach";} cmTypeMacro(cmForEachCommand, cmCommand); private: diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 85b89d9ab..9b981a320 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -64,7 +64,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return this->Args[0].c_str(); } + virtual std::string GetName() const { return this->Args[0]; } cmTypeMacro(cmFunctionHelperCommand, cmCommand); diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index a8bd3e784..2df435e71 100644 --- a/Source/cmFunctionCommand.h +++ b/Source/cmFunctionCommand.h @@ -57,7 +57,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "function";} + virtual std::string GetName() const { return "function";} cmTypeMacro(cmFunctionCommand, cmCommand); }; diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index 6c58bb44a..15114064e 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/Source/cmGetCMakePropertyCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_cmake_property";} + virtual std::string GetName() const { return "get_cmake_property";} cmTypeMacro(cmGetCMakePropertyCommand, cmCommand); }; diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index aea04ad17..6c5750a9c 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/Source/cmGetDirectoryPropertyCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_directory_property";} + virtual std::string GetName() const { return "get_directory_property";} cmTypeMacro(cmGetDirectoryPropertyCommand, cmCommand); }; diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index e2cd21960..534de53d1 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/Source/cmGetFilenameComponentCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_filename_component";} + virtual std::string GetName() const { return "get_filename_component";} cmTypeMacro(cmGetFilenameComponentCommand, cmCommand); }; diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index e1630ffb3..8c3738fbd 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_property";} + virtual std::string GetName() const { return "get_property";} cmTypeMacro(cmGetPropertyCommand, cmCommand); private: diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 338318eb5..ab8ce365b 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_source_file_property";} + virtual std::string GetName() const { return "get_source_file_property";} cmTypeMacro(cmGetSourceFilePropertyCommand, cmCommand); }; diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 4985b3c62..a35c6fe9d 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_target_property";} + virtual std::string GetName() const { return "get_target_property";} cmTypeMacro(cmGetTargetPropertyCommand, cmCommand); }; diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 2dccabe77..2819492ee 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "get_test_property";} + virtual std::string GetName() const { return "get_test_property";} cmTypeMacro(cmGetTestPropertyCommand, cmCommand); }; diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 02d87edee..b9de84572 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -63,7 +63,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "if";} + virtual std::string GetName() const { return "if";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index 267723d49..0dcd7de8b 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.h @@ -46,7 +46,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include";} + virtual std::string GetName() const {return "include";} cmTypeMacro(cmIncludeCommand, cmCommand); }; diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index c621dcbc7..6cc2c8335 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "include_directories";} + virtual std::string GetName() const { return "include_directories";} cmTypeMacro(cmIncludeDirectoryCommand, cmCommand); diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 8ca674fb1..081f77a01 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include_external_msproject";} + virtual std::string GetName() const {return "include_external_msproject";} cmTypeMacro(cmIncludeExternalMSProjectCommand, cmCommand); }; diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 0c5fa6f93..c58f01876 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "include_regular_expression";} + virtual std::string GetName() const {return "include_regular_expression";} cmTypeMacro(cmIncludeRegularExpressionCommand, cmCommand); }; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 9db2490ba..8e14a0828 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install";} + virtual std::string GetName() const { return "install";} cmTypeMacro(cmInstallCommand, cmCommand); diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 5583fe455..4551ab14f 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_files";} + virtual std::string GetName() const { return "install_files";} /** * This is called at the end after all the information diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 95acfa298..90c7ba3ac 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_programs";} + virtual std::string GetName() const { return "install_programs";} /** * This is called at the end after all the information diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index 2aa34dbe3..e6cbe6e35 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "install_targets";} + virtual std::string GetName() const { return "install_targets";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index c6eb40ce5..8e04bafcd 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "link_directories";} + virtual std::string GetName() const { return "link_directories";} cmTypeMacro(cmLinkDirectoriesCommand, cmCommand); private: diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index 74de23c53..c572439e5 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "link_libraries";} + virtual std::string GetName() const { return "link_libraries";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index b79ff0d72..5ea1d9f18 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "list";} + virtual std::string GetName() const { return "list";} cmTypeMacro(cmListCommand, cmCommand); protected: diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index ff8625f37..04207d0dd 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "load_cache";} + virtual std::string GetName() const { return "load_cache";} cmTypeMacro(cmLoadCacheCommand, cmCommand); protected: diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 21ee0fe45..36e9980a4 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -69,7 +69,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return info.Name; } + virtual std::string GetName() const { return info.Name; } static const char* LastName; static void TrapsForSignals(int sig) diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index 11bcf097d..45812694f 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -20,7 +20,7 @@ public: virtual cmCommand* Clone() { return new cmLoadCommandCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const {return "load_command";} + virtual std::string GetName() const {return "load_command";} virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmLoadCommandCommand, cmCommand); }; diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 499d3c675..9d253b8fc 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -65,7 +65,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return this->Args[0].c_str(); } + virtual std::string GetName() const { return this->Args[0]; } cmTypeMacro(cmMacroHelperCommand, cmCommand); diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 4c585d850..5c1cc000a 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -57,7 +57,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "macro";} + virtual std::string GetName() const { return "macro";} cmTypeMacro(cmMacroCommand, cmCommand); }; diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index 49a4009f2..71b97eb28 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "make_directory";} + virtual std::string GetName() const { return "make_directory";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index b65e4a87e..38064a326 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "mark_as_advanced";} + virtual std::string GetName() const {return "mark_as_advanced";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index c826ef162..76dc102bd 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "math";} + virtual std::string GetName() const { return "math";} cmTypeMacro(cmMathCommand, cmCommand); protected: diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index fec9a3233..c0ae2a322 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -39,7 +39,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "message";} + virtual std::string GetName() const { return "message";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index 89e3ac122..12a647227 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "option";} + virtual std::string GetName() const {return "option";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index dd5ed6c83..95eba38ec 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -22,7 +22,7 @@ public: virtual cmCommand* Clone() { return new cmOutputRequiredFilesCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "output_required_files";} + virtual std::string GetName() const { return "output_required_files";} virtual bool IsDiscouraged() const { return true; } void ListDependencies(cmDependInformation const *info, diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index f7d086d36..7aacb5537 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "project";} + virtual std::string GetName() const {return "project";} cmTypeMacro(cmProjectCommand, cmCommand); }; diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 868eb91fa..85729ddc9 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "qt_wrap_cpp";} + virtual std::string GetName() const { return "qt_wrap_cpp";} }; diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 3406dac3f..4aa9a614a 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -43,7 +43,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "qt_wrap_ui";} + virtual std::string GetName() const { return "qt_wrap_ui";} }; diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index ad739088f..94161f8e3 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "remove";} + virtual std::string GetName() const {return "remove";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 4e291fc38..cac94bef2 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "remove_definitions";} + virtual std::string GetName() const {return "remove_definitions";} cmTypeMacro(cmRemoveDefinitionsCommand, cmCommand); }; diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h index 2822b62c4..4ff81effa 100644 --- a/Source/cmReturnCommand.h +++ b/Source/cmReturnCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "return";} + virtual std::string GetName() const {return "return";} cmTypeMacro(cmReturnCommand, cmCommand); }; diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index ce0236043..a527ae7b2 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "separate_arguments";} + virtual std::string GetName() const {return "separate_arguments";} cmTypeMacro(cmSeparateArgumentsCommand, cmCommand); }; diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 6cef0a0f5..4adc2d9f0 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "set";} + virtual std::string GetName() const {return "set";} cmTypeMacro(cmSetCommand, cmCommand); }; diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 6240598ad..f444a1bb2 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_directory_properties";} + virtual std::string GetName() const { return "set_directory_properties";} /** * Static entry point for use by other commands diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 5757d219c..eaa023362 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -34,7 +34,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_property";} + virtual std::string GetName() const { return "set_property";} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index 8541a9678..5fa5a3ac7 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_source_files_properties";} + virtual std::string GetName() const { return "set_source_files_properties";} cmTypeMacro(cmSetSourceFilesPropertiesCommand, cmCommand); diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index cfe35df38..3981ef3d1 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_target_properties";} + virtual std::string GetName() const { return "set_target_properties";} /** * Used by this command and cmSetPropertiesCommand diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 7f8d57d13..dabe9448d 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -32,7 +32,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "set_tests_properties";} + virtual std::string GetName() const { return "set_tests_properties";} cmTypeMacro(cmSetTestsPropertiesCommand, cmCommand); diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index eb9d4d87e..ec63ef860 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "site_name";} + virtual std::string GetName() const {return "site_name";} cmTypeMacro(cmSiteNameCommand, cmCommand); }; diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 5d8b48ce9..410411be9 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.h @@ -41,7 +41,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "source_group";} + virtual std::string GetName() const {return "source_group";} cmTypeMacro(cmSourceGroupCommand, cmCommand); }; diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 66b48e69f..b8053c504 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -50,7 +50,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "string";} + virtual std::string GetName() const { return "string";} cmTypeMacro(cmStringCommand, cmCommand); static void ClearMatches(cmMakefile* mf); diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index 8be8335d0..6addd8f85 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "subdirs";} + virtual std::string GetName() const { return "subdirs";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index f78cfb701..75a568594 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -20,7 +20,7 @@ public: virtual cmCommand* Clone() { return new cmSubdirDependsCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "subdir_depends";} + virtual std::string GetName() const { return "subdir_depends";} virtual bool IsDiscouraged() const { return true; } cmTypeMacro(cmSubdirDependsCommand, cmCommand); }; diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index 7405e90a9..5ba9e03cd 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -36,7 +36,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_compile_definitions";} + virtual std::string GetName() const { return "target_compile_definitions";} cmTypeMacro(cmTargetCompileDefinitionsCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 3713e5a48..d58dc0785 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -36,7 +36,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_compile_options";} + virtual std::string GetName() const { return "target_compile_options";} cmTypeMacro(cmTargetCompileOptionsCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 6863ee5a3..c8b22fbe3 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -37,7 +37,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_include_directories";} + virtual std::string GetName() const { return "target_include_directories";} cmTypeMacro(cmTargetIncludeDirectoriesCommand, cmTargetPropCommandBase); diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index e2f374372..47dd8bd6c 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -42,7 +42,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "target_link_libraries";} + virtual std::string GetName() const { return "target_link_libraries";} cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand); private: diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 8e6bbc13d..a09c47ff3 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "try_compile";} + virtual std::string GetName() const { return "try_compile";} cmTypeMacro(cmTryCompileCommand, cmCoreTryCompile); diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index d0bf9ce70..9b97b16a2 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.h @@ -40,7 +40,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "try_run";} + virtual std::string GetName() const { return "try_run";} cmTypeMacro(cmTryRunCommand, cmCoreTryCompile); private: diff --git a/Source/cmUnsetCommand.h b/Source/cmUnsetCommand.h index 2308139f9..62c2bd39b 100644 --- a/Source/cmUnsetCommand.h +++ b/Source/cmUnsetCommand.h @@ -45,7 +45,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const {return "unset";} + virtual std::string GetName() const {return "unset";} cmTypeMacro(cmUnsetCommand, cmCommand); }; diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index dca75a5c7..da927c72b 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "use_mangled_mesa";} + virtual std::string GetName() const { return "use_mangled_mesa";} virtual bool IsScriptable() const { return true; } virtual bool IsDiscouraged() const { return true; } protected: diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 83d115c38..23afdbe0d 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmUtilitySourceCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "utility_source";} + virtual std::string GetName() const { return "utility_source";} virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 881b14996..7e68de11d 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -21,7 +21,7 @@ public: virtual cmCommand* Clone() { return new cmVariableRequiresCommand; } virtual bool InitialPass(std::vector const& args, cmExecutionStatus &status); - virtual const char* GetName() const { return "variable_requires";} + virtual std::string GetName() const { return "variable_requires";} virtual bool IsDiscouraged() const { return true; } }; diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index fb6062c48..c1ee9b14e 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -54,7 +54,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "variable_watch";} + virtual std::string GetName() const { return "variable_watch";} cmTypeMacro(cmVariableWatchCommand, cmCommand); diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index 45badd00d..9fafffc09 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -66,7 +66,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "while";} + virtual std::string GetName() const { return "while";} cmTypeMacro(cmWhileCommand, cmCommand); }; diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 84a38fcfb..0d06878c0 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -44,7 +44,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "write_file";} + virtual std::string GetName() const { return "write_file";} /** This command is kept for compatibility with older CMake versions. */ virtual bool IsDiscouraged() const diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ab1241146..d37bd940f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -221,13 +221,13 @@ void cmake::CleanupCommandsAndMacros() } } -bool cmake::CommandExists(const char* name) const +bool cmake::CommandExists(const std::string& name) const { std::string sName = cmSystemTools::LowerCase(name); return (this->Commands.find(sName) != this->Commands.end()); } -cmCommand *cmake::GetCommand(const char *name) +cmCommand *cmake::GetCommand(const std::string& name) { cmCommand* rm = 0; std::string sName = cmSystemTools::LowerCase(name); @@ -239,7 +239,8 @@ cmCommand *cmake::GetCommand(const char *name) return rm; } -void cmake::RenameCommand(const char*oldName, const char* newName) +void cmake::RenameCommand(const std::string& oldName, + const std::string& newName) { // if the command already exists, free the old one std::string sOldName = cmSystemTools::LowerCase(oldName); @@ -262,7 +263,7 @@ void cmake::RenameCommand(const char*oldName, const char* newName) this->Commands.erase(pos); } -void cmake::RemoveCommand(const char* name) +void cmake::RemoveCommand(const std::string& name) { std::string sName = cmSystemTools::LowerCase(name); RegisteredCommandsMap::iterator pos = this->Commands.find(sName); diff --git a/Source/cmake.h b/Source/cmake.h index 3134493a4..6772740d1 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -218,20 +218,20 @@ class cmake * Add a command to this cmake instance */ void AddCommand(cmCommand* ); - void RenameCommand(const char* oldName, const char* newName); - void RemoveCommand(const char* name); + void RenameCommand(const std::string& oldName, const std::string& newName); + void RemoveCommand(const std::string& name); void RemoveUnscriptableCommands(); /** * Get a command by its name */ - cmCommand *GetCommand(const char *name); + cmCommand *GetCommand(const std::string& name); /** Get list of all commands */ RegisteredCommandsMap* GetCommands() { return &this->Commands; } /** Check if a command exists. */ - bool CommandExists(const char* name) const; + bool CommandExists(const std::string& name) const; ///! Parse command line arguments void SetArgs(const std::vector&, From 94fc63e2d5402bc4fa570a92e1f5fe6aba088392 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:24:01 -0500 Subject: [PATCH 144/278] stringapi: Use strings for cache iterator values --- Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 5 +++-- Source/QtDialog/QCMake.cxx | 12 ++++++------ Source/cmCacheManager.h | 6 +++--- Source/cmMakefile.cxx | 8 ++++++-- Source/cmOptionCommand.cxx | 5 +---- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 7929ce76a..682f95f9e 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -51,7 +51,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( { case cmCacheManager::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); - if (cmSystemTools::IsOn(it.GetValue())) + if (cmSystemTools::IsOn(it.GetValue().c_str())) { static_cast(this->Entry)->SetValueAsBool(true); } @@ -94,7 +94,8 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; case cmCacheManager::UNINITIALIZED: - cmSystemTools::Error("Found an undefined variable: ", it.GetName()); + cmSystemTools::Error("Found an undefined variable: ", + it.GetName().c_str()); break; default: // TODO : put warning message here diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 0fe5f8cb8..12da3209d 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -111,7 +111,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) cmCacheManager::CacheIterator itm = cachem->NewIterator(); if ( itm.Find("CMAKE_HOME_DIRECTORY")) { - setSourceDirectory(QString::fromLocal8Bit(itm.GetValue())); + setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str())); } if ( itm.Find("CMAKE_GENERATOR")) { @@ -201,11 +201,11 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName()); + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); int idx = props.indexOf(prop); if(idx == -1) { - toremove.append(QString::fromLocal8Bit(i.GetName())); + toremove.append(QString::fromLocal8Bit(i.GetName().c_str())); } else { @@ -286,15 +286,15 @@ QCMakePropertyList QCMake::properties() const } QCMakeProperty prop; - prop.Key = QString::fromLocal8Bit(i.GetName()); + prop.Key = QString::fromLocal8Bit(i.GetName().c_str()); prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING")); - prop.Value = QString::fromLocal8Bit(i.GetValue()); + prop.Value = QString::fromLocal8Bit(i.GetValue().c_str()); prop.Advanced = i.GetPropertyAsBool("ADVANCED"); if(i.GetType() == cmCacheManager::BOOL) { prop.Type = QCMakeProperty::BOOL; - prop.Value = cmSystemTools::IsOn(i.GetValue()); + prop.Value = cmSystemTools::IsOn(i.GetValue().c_str()); } else if(i.GetType() == cmCacheManager::PATH) { diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 07a8675b1..d9a91123f 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -56,8 +56,8 @@ public: bool Find(const std::string&); bool IsAtEnd() const; void Next(); - const char *GetName() const { - return this->Position->first.c_str(); } + std::string GetName() const { + return this->Position->first; } const char* GetProperty(const std::string&) const ; bool GetPropertyAsBool(const std::string&) const ; bool PropertyExists(const std::string&) const; @@ -65,7 +65,7 @@ public: void AppendProperty(const std::string& property, const char* value, bool asString=false); void SetProperty(const std::string& property, bool value); - const char* GetValue() const { return this->GetEntry().Value.c_str(); } + std::string GetValue() const { return this->GetEntry().Value; } bool GetValueAsBool() const; void SetValue(const char*); CacheEntryType GetType() const { return this->GetEntry().Type; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e8be29fe0..a083c7802 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1796,7 +1796,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, cmCacheManager::CacheEntryType type, bool force) { - const char* val = value; + bool haveVal = value ? true : false; + std::string val = haveVal ? value : ""; cmCacheManager::CacheIterator it = this->GetCacheManager()->GetCacheIterator(name.c_str()); if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) && @@ -1807,6 +1808,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, if(!force) { val = it.GetValue(); + haveVal = true; } if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH ) { @@ -1829,10 +1831,12 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type); val = it.GetValue(); + haveVal = true; } } - this->GetCacheManager()->AddCacheEntry(name, val, doc, type); + this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc, + type); // if there was a definition then remove it this->Internal->VarStack.top().Set(name, 0); } diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 776a3a443..dbe247868 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -55,10 +55,7 @@ bool cmOptionCommand it.SetProperty("HELPSTRING", args[1].c_str()); return true; } - if ( it.GetValue() ) - { - initialValue = it.GetValue(); - } + initialValue = it.GetValue(); } if(args.size() == 3) { From 7abf4e313d8e8d59c38f402efaf9cca4e4a2d3ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:32:55 -0500 Subject: [PATCH 145/278] stringapi: Use strings for dependency information --- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefile.cxx | 14 +++++++------- Source/cmMakefile.h | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 10 ++++------ Source/cmMakefileTargetGenerator.h | 2 +- Source/cmQTWrapCPPCommand.cxx | 2 +- Source/cmQTWrapUICommand.cxx | 2 +- 11 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 4dd81be96..dd99c4397 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand commandLines.push_back(commandLine); // Add command for generating the .h and .cxx files - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 08c139734..ab4380c3f 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -316,7 +316,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() // file as the main dependency because it would get // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cd9f9bdb8..761db489c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->Makefile->AddCustomCommandToOutput( targetFullPath.c_str(), objVector, - 0, + "", commandLines, comment.c_str(), this->Makefile->GetStartOutputDirectory() diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0e246a52a..f1fd99461 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -578,7 +578,7 @@ cmLocalVisualStudio6Generator std::string comment = this->ConstructComment(origCommand, ""); // Add the rule with the given dependencies and commands. - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* outsf = this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 0bbafd80d..449114015 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force_command.push_back("."); cmCustomCommandLines force_commands; force_commands.push_back(force_command); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; std::string force = this->Makefile->GetStartOutputDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a083c7802..92177c897 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Choose a source file on which to store the custom command. cmSourceFile* file = 0; - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { // The main dependency was specified. Use it unless a different // custom command already used it. @@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Construct a complete list of dependencies. std::vector depends2(depends); - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { depends2.push_back(main_dependency); } @@ -1104,7 +1104,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -1123,7 +1123,7 @@ void cmMakefile::AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment) { @@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, else { // The source may not be a real file. Do not use a main dependency. - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; std::vector depends2 = depends; depends2.push_back(source); sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency, @@ -1251,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += cmake::GetCMakeFilesDirectory(); force += "/"; force += utilityName; - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; bool no_replace = false; this->AddCustomCommandToOutput(force.c_str(), depends, no_main_dependency, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fb40c1bbf..460a85c7f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -177,7 +177,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -185,7 +185,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -193,7 +193,7 @@ public: void AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f0c9a3f1b..28a8f04de 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1496,8 +1496,9 @@ cmMakefileTargetGenerator } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, - bool relink) +void cmMakefileTargetGenerator::WriteTargetDriverRule( + const std::string& main_output, + bool relink) { // Compute the name of the driver target. std::string dir = @@ -1510,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, // Build the list of target outputs to drive. std::vector depends; - if(main_output) - { - depends.push_back(main_output); - } + depends.push_back(main_output); const char* comment = 0; if(relink) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 573ce227f..bed945bb5 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -119,7 +119,7 @@ protected: std::string::size_type limit = std::string::npos); // write the driver rule to build target outputs - void WriteTargetDriverRule(const char* main_output, bool relink); + void WriteTargetDriverRule(const std::string& main_output, bool relink); void DriveCustomCommands(std::vector& depends); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 0d3c9941c..ca007cb60 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, depends.push_back(moc_exe); depends.push_back(hname); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(newName.c_str(), depends, diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index a6a4b5158..2a1129d28 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, std::vector depends; depends.push_back(uiName); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(hName.c_str(), From caaad357598ec8c92f15ab0d682add9e70e2223c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:47:20 -0500 Subject: [PATCH 146/278] speedup: Cache strings for comparisons --- Source/cmExtraCodeBlocksGenerator.cxx | 3 ++- Source/cmExtraCodeLiteGenerator.cxx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 4a5970492..03f59c40b 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -414,12 +414,13 @@ void cmExtraCodeBlocksGenerator std::string lang = (*si)->GetLanguage(); if (lang == "C" || lang == "CXX") { + std::string srcext = (*si)->GetExtension(); for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); ext != mf->GetSourceExtensions().end(); ++ext) { - if ((*si)->GetExtension() == *ext) + if (srcext == *ext) { isCFile = true; break; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 15fe8bbf2..5a9e12558 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -223,12 +223,13 @@ void cmExtraCodeLiteGenerator std::string lang = (*si)->GetLanguage(); if (lang == "C" || lang == "CXX") { + std::string srcext = (*si)->GetExtension(); for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); ext != mf->GetSourceExtensions().end(); ++ext) { - if ((*si)->GetExtension() == *ext) + if (srcext == *ext) { isCFile = true; break; From 219d6ad6101cb90f951b193d721a19896f7a6b20 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:31:04 -0500 Subject: [PATCH 147/278] speedup: Avoid excess iterator dereferences --- Source/cmGlobalUnixMakefileGenerator3.cxx | 125 ++++++++++++---------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index d41cee62c..2cdc97675 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -477,24 +477,26 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); ++l) { - if((l->second->GetType() == cmTarget::EXECUTABLE) || - (l->second->GetType() == cmTarget::STATIC_LIBRARY) || - (l->second->GetType() == cmTarget::SHARED_LIBRARY) || - (l->second->GetType() == cmTarget::MODULE_LIBRARY) || - (l->second->GetType() == cmTarget::OBJECT_LIBRARY) || - (l->second->GetType() == cmTarget::UTILITY)) + cmGeneratorTarget* gtarget = l->second; + int type = gtarget->GetType(); + if((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::UTILITY)) { - if(l->second->Target->IsImported()) + if(gtarget->Target->IsImported()) { continue; } // Add this to the list of depends rules in this directory. - if((!check_all || !l->second->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && + if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || - l->second->Target + gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))) { - std::string tname = lg->GetRelativeTargetDirectory(*l->second->Target); + std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); tname += "/"; tname += pass; depends.push_back(tname); @@ -643,45 +645,48 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if(t->second->Target->IsImported()) + cmGeneratorTarget* gtarget = t->second; + if(gtarget->Target->IsImported()) { continue; } // Don't emit the same rule twice (e.g. two targets with the same // simple name) - if(!t->second->GetName().empty() && - emitted.insert(t->second->GetName()).second && + int type = gtarget->GetType(); + std::string name = gtarget->GetName(); + if(!name.empty() && + emitted.insert(name).second && // Handle user targets here. Global targets are handled in // the local generator on a per-directory basis. - ((t->second->GetType() == cmTarget::EXECUTABLE) || - (t->second->GetType() == cmTarget::STATIC_LIBRARY) || - (t->second->GetType() == cmTarget::SHARED_LIBRARY) || - (t->second->GetType() == cmTarget::MODULE_LIBRARY) || - (t->second->GetType() == cmTarget::OBJECT_LIBRARY) || - (t->second->GetType() == cmTarget::UTILITY))) + ((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::UTILITY))) { // Add a rule to build the target by name. lg->WriteDivider(ruleFileStream); ruleFileStream << "# Target rules for targets named " - << t->second->GetName() << "\n\n"; + << name << "\n\n"; // Write the rule. commands.clear(); std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall - (tmp.c_str(),t->second->GetName())); + (tmp.c_str(),name)); depends.clear(); depends.push_back("cmake_check_build_system"); lg->WriteMakeRule(ruleFileStream, "Build rule for target.", - t->second->GetName(), depends, commands, + name, depends, commands, true); // Add a fast rule to build the target std::string localName = - lg->GetRelativeTargetDirectory(*t->second->Target); + lg->GetRelativeTargetDirectory(*gtarget->Target); std::string makefileName; makefileName = localName; makefileName += "/build.make"; @@ -689,7 +694,7 @@ cmGlobalUnixMakefileGenerator3 commands.clear(); std::string makeTargetName = localName; makeTargetName += "/build"; - localName = t->second->GetName(); + localName = name; localName += "/fast"; commands.push_back(lg->GetRecursiveMakeCall (makefileName.c_str(), makeTargetName.c_str())); @@ -698,12 +703,12 @@ cmGlobalUnixMakefileGenerator3 // Add a local name for the rule to relink the target before // installation. - if(t->second->Target + if(gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) { - makeTargetName = lg->GetRelativeTargetDirectory(*t->second->Target); + makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName += "/preinstall"; - localName = t->second->GetName(); + localName = name; localName += "/preinstall"; depends.clear(); commands.clear(); @@ -741,25 +746,28 @@ cmGlobalUnixMakefileGenerator3 for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if(t->second->Target->IsImported()) + cmGeneratorTarget* gtarget = t->second; + if(gtarget->Target->IsImported()) { continue; } - if (!t->second->GetName().empty() - && ((t->second->GetType() == cmTarget::EXECUTABLE) - || (t->second->GetType() == cmTarget::STATIC_LIBRARY) - || (t->second->GetType() == cmTarget::SHARED_LIBRARY) - || (t->second->GetType() == cmTarget::MODULE_LIBRARY) - || (t->second->GetType() == cmTarget::OBJECT_LIBRARY) - || (t->second->GetType() == cmTarget::UTILITY))) + int type = gtarget->GetType(); + std::string name = gtarget->GetName(); + if (!name.empty() + && ( (type == cmTarget::EXECUTABLE) + || (type == cmTarget::STATIC_LIBRARY) + || (type == cmTarget::SHARED_LIBRARY) + || (type == cmTarget::MODULE_LIBRARY) + || (type == cmTarget::OBJECT_LIBRARY) + || (type == cmTarget::UTILITY))) { std::string makefileName; // Add a rule to build the target by name. - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); makefileName = localName; makefileName += "/build.make"; - bool needRequiresStep = this->NeedRequiresStep(*t->second->Target); + bool needRequiresStep = this->NeedRequiresStep(*gtarget->Target); lg->WriteDivider(ruleFileStream); ruleFileStream @@ -801,7 +809,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalGenerator::SHELL); progCmd << " "; std::vector& progFiles = - this->ProgressMap[t->second->Target].Marks; + this->ProgressMap[gtarget->Target].Marks; for (std::vector::iterator i = progFiles.begin(); i != progFiles.end(); ++i) { @@ -810,15 +818,15 @@ cmGlobalUnixMakefileGenerator3 commands.push_back(progCmd.str()); } progressDir = "Built target "; - progressDir += t->second->GetName(); + progressDir += name; lg->AppendEcho(commands,progressDir.c_str()); - this->AppendGlobalTargetDepends(depends,*t->second->Target); + this->AppendGlobalTargetDepends(depends,*gtarget->Target); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName.c_str(), depends, commands, true); // add the all/all dependency - if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { depends.clear(); depends.push_back(localName); @@ -843,7 +851,7 @@ cmGlobalUnixMakefileGenerator3 // std::set emitted; progCmd << " " - << this->CountProgressMarksInTarget(t->second->Target, emitted); + << this->CountProgressMarksInTarget(gtarget->Target, emitted); commands.push_back(progCmd.str()); } std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); @@ -861,7 +869,7 @@ cmGlobalUnixMakefileGenerator3 } depends.clear(); depends.push_back("cmake_check_build_system"); - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/rule"; lg->WriteMakeRule(ruleFileStream, "Build rule for subdir invocation for target.", @@ -872,13 +880,13 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); depends.push_back(localName); lg->WriteMakeRule(ruleFileStream, "Convenience name for target.", - t->second->GetName(), depends, commands, true); + name, depends, commands, true); // Add rules to prepare the target for installation. - if(t->second->Target + if(gtarget->Target ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) { - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/preinstall"; depends.clear(); commands.clear(); @@ -888,7 +896,7 @@ cmGlobalUnixMakefileGenerator3 "Pre-install relink rule for target.", localName.c_str(), depends, commands, true); - if(!this->IsExcluded(this->LocalGenerators[0], *t->second->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { depends.clear(); depends.push_back(localName); @@ -899,7 +907,7 @@ cmGlobalUnixMakefileGenerator3 } // add the clean rule - localName = lg->GetRelativeTargetDirectory(*t->second->Target); + localName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName = localName; makeTargetName += "/clean"; depends.clear(); @@ -1066,18 +1074,21 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule cmTargets& targets = lg2->GetMakefile()->GetTargets(); for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { - if((t->second.GetType() == cmTarget::EXECUTABLE) || - (t->second.GetType() == cmTarget::STATIC_LIBRARY) || - (t->second.GetType() == cmTarget::SHARED_LIBRARY) || - (t->second.GetType() == cmTarget::MODULE_LIBRARY) || - (t->second.GetType() == cmTarget::OBJECT_LIBRARY) || - (t->second.GetType() == cmTarget::GLOBAL_TARGET) || - (t->second.GetType() == cmTarget::UTILITY)) + cmTarget const& target = t->second; + cmTarget::TargetType type = target.GetType(); + if((type == cmTarget::EXECUTABLE) || + (type == cmTarget::STATIC_LIBRARY) || + (type == cmTarget::SHARED_LIBRARY) || + (type == cmTarget::MODULE_LIBRARY) || + (type == cmTarget::OBJECT_LIBRARY) || + (type == cmTarget::GLOBAL_TARGET) || + (type == cmTarget::UTILITY)) { - if(emittedTargets.insert(t->second.GetName()).second) + std::string name = target.GetName(); + if(emittedTargets.insert(name).second) { path = "... "; - path += t->second.GetName(); + path += name; lg->AppendEcho(commands,path.c_str()); } } From 191f25e2bd0a8b63d5abfecfd403b9f1414dfc8d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 6 Mar 2014 17:22:09 -0500 Subject: [PATCH 148/278] stringapi: Prevent a NULL dereference in WiX --- Source/CPack/cmCPackGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index a8e104bd2..3915b31e8 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1089,7 +1089,7 @@ int cmCPackGenerator::DoPackage() * may update this during PackageFiles. * (either putting several names or updating the provided one) */ - packageFileNames.push_back(tempPackageFileName); + packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : ""); toplevel = tempDirectory; if ( !this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) { From b633b263082ae2c74a030aefb9048b0a20098b61 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Mar 2014 10:53:45 -0500 Subject: [PATCH 149/278] CPackWiX: Fix test to build with expected config --- Tests/CMakeLists.txt | 2 ++ Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 854b239d6..7b4d1494b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -829,6 +829,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ if(WIX_LIGHT_EXECUTABLE) add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND} + -C \${CTEST_CONFIGURATION_TYPE} --build-and-test "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator" "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" @@ -837,6 +838,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --build-options ${build_options} --test-command ${CMAKE_CMAKE_COMMAND} "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator" + "-Dconfig=\${CTEST_CONFIGURATION_TYPE}" -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake") endif() endif() diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake index 30e33cf22..ca9fd9049 100644 --- a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake +++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake @@ -10,7 +10,12 @@ message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}") +if(config) + set(_C_config -C ${config}) +endif() + execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} RESULT_VARIABLE CPack_result OUTPUT_VARIABLE CPack_output ERROR_VARIABLE CPack_error From 6aad93f407f341fae1afb80ebeab532451c39458 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 9 Mar 2014 00:01:06 -0500 Subject: [PATCH 150/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f1302da27..5355d8755 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140308) +set(CMake_VERSION_PATCH 20140309) #set(CMake_VERSION_RC 1) From 52285a993b714c81d8d79fddde2631612dab335c Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Tue, 4 Mar 2014 16:35:44 +0100 Subject: [PATCH 151/278] libarchive: Fix compliation with Open Watcom --- Utilities/cmlibarchive/libarchive/archive.h | 2 +- Utilities/cmlibarchive/libarchive/archive_entry.h | 4 ++-- Utilities/cmlibarchive/libarchive/archive_windows.h | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Utilities/cmlibarchive/libarchive/archive.h b/Utilities/cmlibarchive/libarchive/archive.h index 1a1d32a6d..83d2c1669 100644 --- a/Utilities/cmlibarchive/libarchive/archive.h +++ b/Utilities/cmlibarchive/libarchive/archive.h @@ -54,7 +54,7 @@ /* Get appropriate definitions of standard POSIX-style types. */ /* These should match the types used in 'struct stat' */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) # define __LA_INT64_T __int64 # if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) # define __LA_SSIZE_T ssize_t diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h index 85ea885f7..ae6a76e35 100644 --- a/Utilities/cmlibarchive/libarchive/archive_entry.h +++ b/Utilities/cmlibarchive/libarchive/archive_entry.h @@ -48,7 +48,7 @@ #endif /* Get a suitable 64-bit integer type. */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) # define __LA_INT64_T __int64 #else #include @@ -63,7 +63,7 @@ #if ARCHIVE_VERSION_NUMBER >= 3999000 /* Switch to plain 'int' for libarchive 4.0. It's less broken than 'mode_t' */ # define __LA_MODE_T int -#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) +#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && !defined(__WATCOMC__) # define __LA_MODE_T unsigned short #else # define __LA_MODE_T mode_t diff --git a/Utilities/cmlibarchive/libarchive/archive_windows.h b/Utilities/cmlibarchive/libarchive/archive_windows.h index 620810c1c..1dd61b64e 100644 --- a/Utilities/cmlibarchive/libarchive/archive_windows.h +++ b/Utilities/cmlibarchive/libarchive/archive_windows.h @@ -188,6 +188,9 @@ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ #endif + +#if !defined(__WATCOMC__) + #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */ #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */ @@ -227,6 +230,8 @@ #define S_IWOTH _S_IWOTH #define S_IROTH _S_IROTH +#endif + #define F_DUPFD 0 /* Duplicate file descriptor. */ #define F_GETFD 1 /* Get file descriptor flags. */ #define F_SETFD 2 /* Set file descriptor flags. */ From 4d8260921ffcdfac058c42a6ba7fd14cc81de4b6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 10 Mar 2014 00:01:06 -0400 Subject: [PATCH 152/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5355d8755..46264b121 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140309) +set(CMake_VERSION_PATCH 20140310) #set(CMake_VERSION_RC 1) From 45abfb0c4d622c86880b2b32619f79417410a6c8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 6 Mar 2014 15:06:22 +0100 Subject: [PATCH 153/278] find_dependency: Extend the tests for use of EXACT macro parameter. --- Tests/Module/FindDependency/CMakeLists.txt | 3 ++- Tests/Module/FindDependency/main.cpp | 12 ++++++++++++ .../FindDependency/packages/Pack4/Pack4Config.cmake | 9 +++++++++ .../packages/Pack4/Pack4ConfigVersion.cmake | 11 +++++++++++ .../FindDependency/packages/Pack5/Pack5Config.cmake | 3 +++ .../packages/Pack5/Pack5ConfigVersion.cmake | 11 +++++++++++ .../FindDependency/packages/Pack6/Pack6Config.cmake | 3 +++ .../packages/Pack6/Pack6ConfigVersion.cmake | 11 +++++++++++ 8 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake create mode 100644 Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake diff --git a/Tests/Module/FindDependency/CMakeLists.txt b/Tests/Module/FindDependency/CMakeLists.txt index b13f48ac8..dcb998a4b 100644 --- a/Tests/Module/FindDependency/CMakeLists.txt +++ b/Tests/Module/FindDependency/CMakeLists.txt @@ -5,6 +5,7 @@ project(FindDependency) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages") find_package(Pack1 REQUIRED) +find_package(Pack4 4.3 EXACT REQUIRED) add_executable(FindDependency main.cpp) -target_link_libraries(FindDependency Pack1::Lib) +target_link_libraries(FindDependency Pack1::Lib Pack4::Lib) diff --git a/Tests/Module/FindDependency/main.cpp b/Tests/Module/FindDependency/main.cpp index d635b3131..50c5958ca 100644 --- a/Tests/Module/FindDependency/main.cpp +++ b/Tests/Module/FindDependency/main.cpp @@ -11,6 +11,18 @@ #error Expected HAVE_PACK3 #endif +#ifndef HAVE_PACK4 +#error Expected HAVE_PACK4 +#endif + +#ifndef HAVE_PACK5 +#error Expected HAVE_PACK5 +#endif + +#ifndef HAVE_PACK6 +#error Expected HAVE_PACK6 +#endif + int main(int argc, char** argv) { return 0; diff --git a/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake b/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake new file mode 100644 index 000000000..62fddb1c5 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake @@ -0,0 +1,9 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack5 3.1) # Actual version is 3.3. EXACT not propagated. +find_dependency(Pack6 5.5 EXACT) + +add_library(Pack4::Lib INTERFACE IMPORTED) +set_property(TARGET Pack4::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK4) +set_property(TARGET Pack4::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack5::Lib Pack6::Lib) diff --git a/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake new file mode 100644 index 000000000..ae982b0ff --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "4.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake b/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake new file mode 100644 index 000000000..1edda9aa8 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake @@ -0,0 +1,3 @@ + +add_library(Pack5::Lib INTERFACE IMPORTED) +set_property(TARGET Pack5::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK5) diff --git a/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake new file mode 100644 index 000000000..e944f9668 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "3.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake b/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake new file mode 100644 index 000000000..d6c85fb37 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake @@ -0,0 +1,3 @@ + +add_library(Pack6::Lib INTERFACE IMPORTED) +set_property(TARGET Pack6::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK6) diff --git a/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake new file mode 100644 index 000000000..0dd00d22e --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "5.5") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() From d71db3a0d88fd41c7e8f3ef23368e919d5c5cded Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Mar 2014 16:18:56 -0500 Subject: [PATCH 154/278] FindSDL: Make FindSDL_*.cmake path suffixes consistent with main module Add the 'SDL' path suffix to the FindSDL_*.cmake modules. Add a comment explaining the purpose of suffixes as in commit v3.0.0-rc1~540^2 (FindSDL: Add path suffixes for /include/..., 2013-10-08). Inspired-by: Adrien Destugues --- Modules/FindSDL_image.cmake | 4 +++- Modules/FindSDL_mixer.cmake | 4 +++- Modules/FindSDL_net.cmake | 4 +++- Modules/FindSDL_sound.cmake | 4 +++- Modules/FindSDL_ttf.cmake | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake index e5173e3c7..fc2c04357 100644 --- a/Modules/FindSDL_image.cmake +++ b/Modules/FindSDL_image.cmake @@ -54,7 +54,9 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h HINTS ENV SDLIMAGEDIR ENV SDLDIR - PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include + PATH_SUFFIXES SDL + # path suffixes to search inside ENV{SDLDIR} + include/SDL include/SDL12 include/SDL11 include ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake index 8f2f066c9..176fee691 100644 --- a/Modules/FindSDL_mixer.cmake +++ b/Modules/FindSDL_mixer.cmake @@ -54,7 +54,9 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h HINTS ENV SDLMIXERDIR ENV SDLDIR - PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include + PATH_SUFFIXES SDL + # path suffixes to search inside ENV{SDLDIR} + include/SDL include/SDL12 include/SDL11 include ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake index e5c2cdb33..ef23573e8 100644 --- a/Modules/FindSDL_net.cmake +++ b/Modules/FindSDL_net.cmake @@ -54,7 +54,9 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h HINTS ENV SDLNETDIR ENV SDLDIR - PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include + PATH_SUFFIXES SDL + # path suffixes to search inside ENV{SDLDIR} + include/SDL include/SDL12 include/SDL11 include ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 3a6ab7b65..8b22ff701 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -98,7 +98,9 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h HINTS ENV SDLSOUNDDIR ENV SDLDIR - PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include + PATH_SUFFIXES SDL + # path suffixes to search inside ENV{SDLDIR} + include/SDL include/SDL12 include/SDL11 include ) find_library(SDL_SOUND_LIBRARY diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake index 3f58ac19f..4b527fabe 100644 --- a/Modules/FindSDL_ttf.cmake +++ b/Modules/FindSDL_ttf.cmake @@ -54,7 +54,9 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h HINTS ENV SDLTTFDIR ENV SDLDIR - PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include + PATH_SUFFIXES SDL + # path suffixes to search inside ENV{SDLDIR} + include/SDL include/SDL12 include/SDL11 include ) if(CMAKE_SIZEOF_VOID_P EQUAL 8) From b79a1f67195f6bb7fddd52215f442f319139b531 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 3 Mar 2014 16:01:23 +0100 Subject: [PATCH 155/278] FindFreetype: Add plain 'freetype2' path suffix On Haiku, the headers are not in an 'include' directory. --- Modules/FindFreetype.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 6f03c86b7..f0f9fe15f 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -62,7 +62,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] - PATH_SUFFIXES include/freetype2 include + PATH_SUFFIXES include/freetype2 include freetype2 ) find_path(FREETYPE_INCLUDE_DIR_freetype2 @@ -79,7 +79,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 ENV GTKMM_BASEPATH [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path] [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path] - PATH_SUFFIXES include/freetype2 include + PATH_SUFFIXES include/freetype2 include freetype2 ) find_library(FREETYPE_LIBRARY From 6c90f0a6938cf2ed2190db34ebc918a9e29fe4bf Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 3 Mar 2014 15:47:08 +0100 Subject: [PATCH 156/278] Ninja: Detect command-line length limit on Haiku --- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a49fc2d7b..c24c5e0a3 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -591,7 +591,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmSystemTools::GetEnv(forceRspFile) == 0) { #ifdef _WIN32 commandLineLengthLimit = 8000 - linkRuleLength; -#elif defined(__linux) || defined(__APPLE__) +#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__) // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000; #else From ef1c1153d34548863bcc5cb6d767881eb5b93b04 Mon Sep 17 00:00:00 2001 From: Volkan Gezer Date: Thu, 6 Mar 2014 09:15:23 +0100 Subject: [PATCH 157/278] CTest: Teach ctest_coverage() to read CTEST_COVERAGE_EXTRA_FLAGS Use it to set the CoverageExtraFlags value just as COVERAGE_EXTRA_FLAGS does in the CTest module for creating DartConfiguration.tcl. --- Source/CTest/cmCTestCoverageCommand.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index 72ff720d3..41f016bb9 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -25,7 +25,8 @@ cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() { this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND"); - + this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, + "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS"); cmCTestCoverageHandler* handler = static_cast( this->CTest->GetInitializedHandler("coverage")); if ( !handler ) From 93d5c4dc22e0c430320117a08e0faf081f31ffa0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Mar 2014 10:21:11 -0400 Subject: [PATCH 158/278] Help: Add release notes for topic 'ctest-coverage-extra' --- Help/release/dev/ctest-coverage-extra.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/ctest-coverage-extra.rst diff --git a/Help/release/dev/ctest-coverage-extra.rst b/Help/release/dev/ctest-coverage-extra.rst new file mode 100644 index 000000000..85d023b3b --- /dev/null +++ b/Help/release/dev/ctest-coverage-extra.rst @@ -0,0 +1,5 @@ +ctest-coverage-extra +-------------------- + +* The :command:`ctest_coverage` command learned to read variable + ``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``. From 172d8d94f4aa71a7c134513d48d8647d0d230215 Mon Sep 17 00:00:00 2001 From: Ryo ONODERA Date: Sat, 8 Mar 2014 20:35:00 -0500 Subject: [PATCH 159/278] cmELF: Fix typo in comment, 32-bit => 64-bit (#14799) --- Source/cmELF.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 353f2e95a..bc1c25ba1 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -181,7 +181,7 @@ struct cmELFTypes32 static const char* GetName() { return "32-bit"; } }; -// Configure the implementation template for 32-bit ELF files. +// Configure the implementation template for 64-bit ELF files. struct cmELFTypes64 { typedef Elf64_Ehdr ELF_Ehdr; From f1b689b64a96fbf1e6f3b154d1bd4ee28ea3d625 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Sun, 9 Mar 2014 10:41:06 +0100 Subject: [PATCH 160/278] Makefile: Improve handling of WMake verbose output and errors * The '-e' option has nothing to do with verbose output. It is now properly handled by .ERASE directive in make file * The '-s' option sets silent output globally, it cannot be switched off. It is now handled only by .SILENT directive in make file directive is simply controlled by a conditonal block. Remove SilentNoColon member variable as it is no longer needed. --- Source/cmGlobalWatcomWMakeGenerator.cxx | 3 +- Source/cmLocalUnixMakefileGenerator3.cxx | 37 ++++++++++++++++-------- Source/cmLocalUnixMakefileGenerator3.h | 7 ----- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 98ce68536..671166e51 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -43,11 +43,10 @@ void cmGlobalWatcomWMakeGenerator cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; - lg->SetSilentNoColon(true); lg->SetDefineWindowsNULL(true); lg->SetWindowsShell(true); lg->SetWatcomWMake(true); - lg->SetMakeSilentFlag("-s -h -e"); + lg->SetMakeSilentFlag("-h"); lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); lg->SetPassMakeflags(false); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f7088c2da..935da578c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -80,7 +80,6 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) //---------------------------------------------------------------------------- cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() { - this->SilentNoColon = false; this->WindowsShell = false; this->IncludeDirective = "include"; this->MakefileVariableSize = 0; @@ -758,15 +757,17 @@ cmLocalUnixMakefileGenerator3 depends.push_back(".hpux_make_needs_suffix_list"); this->WriteMakeRule(makefileStream, 0, ".SUFFIXES", depends, no_commands, false); - - cmGlobalUnixMakefileGenerator3* gg = - static_cast(this->GlobalGenerator); - // Write special target to silence make output. This must be after - // the default target in case VERBOSE is set (which changes the - // name). The setting of CMAKE_VERBOSE_MAKEFILE to ON will cause a - // "VERBOSE=1" to be added as a make variable which will change the - // name of this special target. This gives a make-time choice to - // the user. + if(this->WatcomWMake) + { + // Switch on WMake feature, if an error or interrupt occurs during + // makefile processing, the current target being made may be deleted + // without prompting (the same as command line -e option). + makefileStream << + "\n" + ".ERASE\n" + "\n" + ; + } if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { makefileStream @@ -774,12 +775,22 @@ cmLocalUnixMakefileGenerator3 << "VERBOSE = 1\n" << "\n"; } - if(this->SilentNoColon) + if(this->WatcomWMake) { - makefileStream << "$(VERBOSE).SILENT\n"; + makefileStream << + "!ifndef VERBOSE\n" + ".SILENT\n" + "!endif\n" + ; } else { + // Write special target to silence make output. This must be after + // the default target in case VERBOSE is set (which changes the + // name). The setting of CMAKE_VERBOSE_MAKEFILE to ON will cause a + // "VERBOSE=1" to be added as a make variable which will change the + // name of this special target. This gives a make-time choice to + // the user. this->WriteMakeRule(makefileStream, "Suppress display of executed commands.", "$(VERBOSE).SILENT", @@ -789,6 +800,8 @@ cmLocalUnixMakefileGenerator3 // Work-around for makes that drop rules that have no dependencies // or commands. + cmGlobalUnixMakefileGenerator3* gg = + static_cast(this->GlobalGenerator); std::string hack = gg->GetEmptyRuleHackDepends(); if(!hack.empty()) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 39f213b65..7987c961f 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -120,12 +120,6 @@ public: */ void SetUnixCD(bool v) {this->UnixCD = v;} - /** - * Set Support Verbose Variable. If true, then .SILENT will - * be not end with : i.e. .SILENT: or .SILENT - */ - void SetSilentNoColon(bool v) {this->SilentNoColon = v;} - /** * Set the string used to include one makefile into another default * is include. @@ -339,7 +333,6 @@ private: bool DefineWindowsNULL; bool UnixCD; bool PassMakeflags; - bool SilentNoColon; bool MakeCommandEscapeTargetTwice; bool BorlandMakeCurlyHack; //========================================================================== From e8c027bcc014eb2b84b663af9b79a5eefc437973 Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Sun, 9 Mar 2014 16:16:39 +0200 Subject: [PATCH 161/278] cmcurl: Include the local curl directories before all others. In some cases, it was possible for the include directory of the system-wide libcurl to be added to the include path before cmcurl's, which would result in them being picked up and causing the build to fail if the curl versions differ too much. One way to trigger this is to have OpenSSL installed into a non-default location together with libcurl (/usr/local, for example). If cmcurl is built with CMAKE_USE_OPENSSL on, -I/usr/local/include would end up being added before -I${PATH_TO_CMCURL}. --- Utilities/cmcurl/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index abf04d8b0..1b918c90a 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -172,6 +172,11 @@ IF(NOT CURL_SPECIAL_LIBZ) CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) ENDIF(NOT CURL_SPECIAL_LIBZ) +# Include the local directories before any others so that we do not end up +# including system curl's include directory first by mistake. +INCLUDE_DIRECTORIES(${LIBCURL_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${LIBCURL_BINARY_DIR}) + OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF) MARK_AS_ADVANCED(CMAKE_USE_OPENSSL) IF(CMAKE_USE_OPENSSL) @@ -679,8 +684,6 @@ INCLUDE(CMake/OtherTests.cmake) # The rest of the build -INCLUDE_DIRECTORIES(${LIBCURL_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${LIBCURL_BINARY_DIR}) OPTION(CMAKE_BUILD_CURL_SHARED "Should curl be built shared" TRUE) IF(CMAKE_BUILD_CURL_SHARED) SET(LIBRARY_TYPE SHARED) From 49ef91d7a6dc75b5bbc7a6b06ed909b23d13fd72 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 6 Mar 2014 18:54:52 +0100 Subject: [PATCH 162/278] FindPkgConfig: restructure documentation and document commands and variables --- Modules/FindPkgConfig.cmake | 253 +++++++++++++++++------------------- 1 file changed, 118 insertions(+), 135 deletions(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 7179d17d8..b0ceb2b24 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -2,141 +2,15 @@ # FindPkgConfig # ------------- # -# a pkg-config module for CMake +# A `pkg-config` module for CMake. # +# Finds the ``pkg-config`` executable and add the +# :command:`pkg_check_modules` and :command:`pkg_search_module` +# commands. # -# -# To find the pkg-config executable, it uses the variable -# PKG_CONFIG_EXECUTABLE or the environment variable PKG_CONFIG first. -# -# -# -# Usage: -# -# :: -# -# pkg_check_modules( [REQUIRED] [QUIET] []*) -# checks for all the given modules -# -# -# -# :: -# -# pkg_search_module( [REQUIRED] [QUIET] []*) -# checks for given modules and uses the first working one -# -# -# -# When the 'REQUIRED' argument was set, macros will fail with an error -# when module(s) could not be found -# -# When the 'QUIET' argument is set, no status messages will be printed. -# -# It sets the following variables: -# -# :: -# -# PKG_CONFIG_FOUND ... if pkg-config executable was found -# PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program -# PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found -# (since CMake 2.8.8) -# -# -# -# For the following variables two sets of values exist; first one is the -# common one and has the given PREFIX. The second set contains flags -# which are given out when pkgconfig was called with the '--static' -# option. -# -# :: -# -# _FOUND ... set to 1 if module(s) exist -# _LIBRARIES ... only the libraries (w/o the '-l') -# _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') -# _LDFLAGS ... all required linker flags -# _LDFLAGS_OTHER ... all other linker flags -# _INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') -# _CFLAGS ... all required cflags -# _CFLAGS_OTHER ... the other compiler flags -# -# -# -# :: -# -# = for common case -# = _STATIC for static linking -# -# -# -# There are some special variables whose prefix depends on the count of -# given modules. When there is only one module, stays -# unchanged. When there are multiple modules, the prefix will be -# changed to _: -# -# :: -# -# _VERSION ... version of the module -# _PREFIX ... prefix-directory of the module -# _INCLUDEDIR ... include-dir of the module -# _LIBDIR ... lib-dir of the module -# -# -# -# :: -# -# = when |MODULES| == 1, else -# = _ -# -# -# -# A parameter can have the following formats: -# -# :: -# -# {MODNAME} ... matches any version -# {MODNAME}>={VERSION} ... at least version is required -# {MODNAME}={VERSION} ... exactly version is required -# {MODNAME}<={VERSION} ... modules must not be newer than -# -# -# -# Examples -# -# :: -# -# pkg_check_modules (GLIB2 glib-2.0) -# -# -# -# :: -# -# pkg_check_modules (GLIB2 glib-2.0>=2.10) -# requires at least version 2.10 of glib2 and defines e.g. -# GLIB2_VERSION=2.10.3 -# -# -# -# :: -# -# pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) -# requires both glib2 and gtk2, and defines e.g. -# FOO_glib-2.0_VERSION=2.10.3 -# FOO_gtk+-2.0_VERSION=2.8.20 -# -# -# -# :: -# -# pkg_check_modules (XRENDER REQUIRED xrender) -# defines e.g.: -# XRENDER_LIBRARIES=Xrender;X11 -# XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp -# -# -# -# :: -# -# pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) +# In order to find the ``pkg-config`` executable, it uses the +# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG`` +# environment variable first. #============================================================================= # Copyright 2006-2014 Kitware, Inc. @@ -397,7 +271,94 @@ endmacro() ### User visible macros start here ### -### +#[========================================[.rst: +.. command:: pkg_check_modules + + Checks for all the given modules. :: + + pkg_check_modules( [REQUIRED] [QUIET] []*) + + When the ``REQUIRED`` argument was set, macros will fail with an error + when module(s) could not be found. + + When the ``QUIET`` argument is set, no status messages will be printed. + + It sets the following variables: :: + + PKG_CONFIG_FOUND ... if pkg-config executable was found + PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program + PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found + (since CMake 2.8.8) + + For the following variables two sets of values exist; first one is the + common one and has the given PREFIX. The second set contains flags + which are given out when ``pkg-config`` was called with the ``--static`` + option. :: + + _FOUND ... set to 1 if module(s) exist + _LIBRARIES ... only the libraries (w/o the '-l') + _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') + _LDFLAGS ... all required linker flags + _LDFLAGS_OTHER ... all other linker flags + _INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') + _CFLAGS ... all required cflags + _CFLAGS_OTHER ... the other compiler flags + + :: + + = for common case + = _STATIC for static linking + + There are some special variables whose prefix depends on the count of + given modules. When there is only one module, stays + unchanged. When there are multiple modules, the prefix will be + changed to _: :: + + _VERSION ... version of the module + _PREFIX ... prefix-directory of the module + _INCLUDEDIR ... include-dir of the module + _LIBDIR ... lib-dir of the module + + :: + + = when |MODULES| == 1, else + = _ + + A parameter can have the following formats: :: + + {MODNAME} ... matches any version + {MODNAME}>={VERSION} ... at least version is required + {MODNAME}={VERSION} ... exactly version is required + {MODNAME}<={VERSION} ... modules must not be newer than + + Examples + + .. code-block:: cmake + + pkg_check_modules (GLIB2 glib-2.0) + + .. code-block:: cmake + + pkg_check_modules (GLIB2 glib-2.0>=2.10) + + Requires at least version 2.10 of glib2 and defines e.g. + ``GLIB2_VERSION=2.10.3`` + + .. code-block:: cmake + + pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) + + Requires both glib2 and gtk2, and defines e.g. + ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20`` + + .. code-block:: cmake + + pkg_check_modules (XRENDER REQUIRED xrender) + + Defines e.g.: + ``XRENDER_LIBRARIES=Xrender;X11`` and + ``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp`` +#]========================================] macro(pkg_check_modules _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) @@ -408,7 +369,21 @@ macro(pkg_check_modules _prefix _module0) endif() endmacro() -### + +#[========================================[.rst: +.. command:: pkg_search_module + + Same as :command:`pkg_check_modules`, but instead it checks for given + modules and uses the first working one. :: + + pkg_search_module( [REQUIRED] [QUIET] []*) + + Examples + + .. code-block:: cmake + + pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) +#]========================================] macro(pkg_search_module _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) @@ -440,6 +415,14 @@ macro(pkg_search_module _prefix _module0) endif() endmacro() + +#[========================================[.rst: +.. variable:: PKG_CONFIG_EXECUTABLE + + Path to the pkg-config executable. +#]========================================] + + ### Local Variables: ### mode: cmake ### End: From 649789a736bb217f818696eae36ee6e6a2e1aa61 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Thu, 6 Mar 2014 23:23:52 -0700 Subject: [PATCH 163/278] Unicode: cmake-gui encoding now matches KWSys encoding. A UTF-8 QTextCodec is used with QString when KWSys is configured to treat strings as UTF-8. This means QString::toLocal8Bit() will convert to UTF-8. --- Source/QtDialog/CMakeLists.txt | 5 +++++ Source/QtDialog/CMakeSetup.cxx | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 4308a4d6f..0dd01d848 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -55,6 +55,11 @@ else() endif() endif() + +if(WIN32 AND KWSYS_ENCODING_DEFAULT_CODEPAGE MATCHES CP_UTF8) + add_definitions(-DKWSYS_CP_UTF8) +endif() + set(SRCS AddCacheEntry.cxx AddCacheEntry.h diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 821121e17..995929e3b 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include "QMacInstallDialog.h" #include "CMakeSetupDialog.h" #include "cmDocumentation.h" @@ -78,6 +79,13 @@ int main(int argc, char** argv) QApplication app(argc, argv); +#if defined(KWSYS_CP_UTF8) + QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); + QTextCodec::setCodecForCStrings(utf8_codec); + QTextCodec::setCodecForLocale(utf8_codec); + QTextCodec::setCodecForTr(utf8_codec); +#endif + // clean out standard Qt paths for plugins, which we don't use anyway // when creating Mac bundles, it potentially causes problems foreach(QString p, QApplication::libraryPaths()) From 64b93354dc6207ad270f2c5e72e43c54d7d3af67 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 11 Mar 2014 00:01:07 -0400 Subject: [PATCH 164/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 46264b121..18e328a9b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140310) +set(CMake_VERSION_PATCH 20140311) #set(CMake_VERSION_RC 1) From f74a8405b6caa8ac253ce0357642a244ab192410 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 14:36:58 +0100 Subject: [PATCH 165/278] Test error cases in find_dependency. --- Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/find_dependency/CMakeLists.txt | 4 ++++ .../find_dependency/EXACT-no-version-result.txt | 1 + .../find_dependency/EXACT-no-version-stderr.txt | 6 ++++++ Tests/RunCMake/find_dependency/EXACT-no-version.cmake | 4 ++++ .../RunCMake/find_dependency/Pack1/Pack1Config.cmake | 2 ++ .../find_dependency/Pack1/Pack1ConfigVersion.cmake | 11 +++++++++++ Tests/RunCMake/find_dependency/RunCMakeTest.cmake | 5 +++++ Tests/RunCMake/find_dependency/extra-args-result.txt | 1 + Tests/RunCMake/find_dependency/extra-args-stderr.txt | 5 +++++ Tests/RunCMake/find_dependency/extra-args.cmake | 4 ++++ .../RunCMake/find_dependency/invalid-arg-3-result.txt | 1 + .../RunCMake/find_dependency/invalid-arg-3-stderr.txt | 5 +++++ Tests/RunCMake/find_dependency/invalid-arg-3.cmake | 4 ++++ 14 files changed, 54 insertions(+) create mode 100644 Tests/RunCMake/find_dependency/CMakeLists.txt create mode 100644 Tests/RunCMake/find_dependency/EXACT-no-version-result.txt create mode 100644 Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt create mode 100644 Tests/RunCMake/find_dependency/EXACT-no-version.cmake create mode 100644 Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake create mode 100644 Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake create mode 100644 Tests/RunCMake/find_dependency/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/find_dependency/extra-args-result.txt create mode 100644 Tests/RunCMake/find_dependency/extra-args-stderr.txt create mode 100644 Tests/RunCMake/find_dependency/extra-args.cmake create mode 100644 Tests/RunCMake/find_dependency/invalid-arg-3-result.txt create mode 100644 Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt create mode 100644 Tests/RunCMake/find_dependency/invalid-arg-3.cmake diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d401a932d..499d12b38 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -49,6 +49,7 @@ add_RunCMake_test(GeneratorToolset) add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(Languages) add_RunCMake_test(ObjectLibrary) +add_RunCMake_test(find_dependency) if(NOT WIN32) add_RunCMake_test(PositionIndependentCode) set(SKIP_VISIBILITY 0) diff --git a/Tests/RunCMake/find_dependency/CMakeLists.txt b/Tests/RunCMake/find_dependency/CMakeLists.txt new file mode 100644 index 000000000..04d09f2ad --- /dev/null +++ b/Tests/RunCMake/find_dependency/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 2.8.4) +project(${RunCMake_TEST} NONE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}") +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt new file mode 100644 index 000000000..6f4fc0411 --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:35 \(message\): + Invalid arguments to find_dependency. EXACT may only be specified if a + VERSION is specified +Call Stack \(most recent call first\): + EXACT-no-version.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version.cmake b/Tests/RunCMake/find_dependency/EXACT-no-version.cmake new file mode 100644 index 000000000..b05665b7e --- /dev/null +++ b/Tests/RunCMake/find_dependency/EXACT-no-version.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 EXACT) diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake b/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake new file mode 100644 index 000000000..7d55ef61d --- /dev/null +++ b/Tests/RunCMake/find_dependency/Pack1/Pack1Config.cmake @@ -0,0 +1,2 @@ + +add_library(Pack1::Lib INTERFACE IMPORTED) diff --git a/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake b/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake new file mode 100644 index 000000000..dfb7b6c84 --- /dev/null +++ b/Tests/RunCMake/find_dependency/Pack1/Pack1ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "1.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake new file mode 100644 index 000000000..b85104aa6 --- /dev/null +++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(EXACT-no-version) +run_cmake(invalid-arg-3) +run_cmake(extra-args) diff --git a/Tests/RunCMake/find_dependency/extra-args-result.txt b/Tests/RunCMake/find_dependency/extra-args-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/extra-args-stderr.txt b/Tests/RunCMake/find_dependency/extra-args-stderr.txt new file mode 100644 index 000000000..1b523807e --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:47 \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + extra-args.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/extra-args.cmake b/Tests/RunCMake/find_dependency/extra-args.cmake new file mode 100644 index 000000000..209645a5d --- /dev/null +++ b/Tests/RunCMake/find_dependency/extra-args.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 EXACT PATHS "${CMAKE_BINARY_DIR}") diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt new file mode 100644 index 000000000..c36148fad --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:42 \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + invalid-arg-3.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3.cmake b/Tests/RunCMake/find_dependency/invalid-arg-3.cmake new file mode 100644 index 000000000..40ede07f4 --- /dev/null +++ b/Tests/RunCMake/find_dependency/invalid-arg-3.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 EXACTYPO) From 21c573f682f9eafbc8d4402f7febbb1bec1cb86a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 00:04:11 +0100 Subject: [PATCH 166/278] Remove some c_str() calls. Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms. --- Source/CPack/cmCPackDebGenerator.cxx | 6 +- Source/CPack/cmCPackGenerator.cxx | 76 ++++---- Source/CPack/cmCPackNSISGenerator.cxx | 2 +- Source/CPack/cmCPackRPMGenerator.cxx | 4 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 10 +- Source/CTest/cmCTestBuildCommand.cxx | 2 +- Source/CTest/cmCTestConfigureCommand.cxx | 2 +- Source/CTest/cmCTestCoverageHandler.cxx | 12 +- .../cmCTestEmptyBinaryDirectoryCommand.cxx | 2 +- Source/CTest/cmCTestGenericHandler.cxx | 6 +- Source/CTest/cmCTestHandlerCommand.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 4 +- Source/CTest/cmCTestP4.cxx | 2 +- Source/CTest/cmCTestRunScriptCommand.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 10 +- Source/CTest/cmCTestStartCommand.cxx | 4 +- Source/CTest/cmCTestSubmitHandler.cxx | 4 +- Source/CTest/cmCTestTestHandler.cxx | 30 ++-- Source/CTest/cmParseMumpsCoverage.cxx | 2 +- Source/CursesDialog/cmCursesLabelWidget.cxx | 2 +- Source/CursesDialog/cmCursesOptionsWidget.cxx | 4 +- Source/CursesDialog/cmCursesPathWidget.cxx | 4 +- Source/cmAddCustomCommandCommand.cxx | 22 +-- Source/cmAddCustomTargetCommand.cxx | 10 +- Source/cmAddDependenciesCommand.cxx | 4 +- Source/cmAddExecutableCommand.cxx | 24 +-- Source/cmAddLibraryCommand.cxx | 58 +++---- Source/cmAddSubDirectoryCommand.cxx | 6 +- Source/cmAddTestCommand.cxx | 14 +- Source/cmAuxSourceDirectoryCommand.cxx | 6 +- Source/cmBuildCommand.cxx | 4 +- Source/cmBuildNameCommand.cxx | 6 +- .../cmCMakeHostSystemInformationCommand.cxx | 4 +- Source/cmCMakeMinimumRequired.cxx | 4 +- Source/cmCMakePolicyCommand.cxx | 12 +- Source/cmCPluginAPI.cxx | 6 +- Source/cmCTest.cxx | 12 +- Source/cmCommandArgumentParserHelper.cxx | 12 +- Source/cmComputeLinkDepends.cxx | 10 +- Source/cmComputeLinkInformation.cxx | 38 ++-- Source/cmComputeTargetDepends.cxx | 18 +- Source/cmConfigureFileCommand.cxx | 6 +- Source/cmCoreTryCompile.cxx | 14 +- Source/cmCreateTestSourceList.cxx | 4 +- Source/cmCustomCommandGenerator.cxx | 4 +- Source/cmDefinePropertyCommand.cxx | 6 +- Source/cmDepends.cxx | 8 +- Source/cmDependsC.cxx | 6 +- Source/cmDependsFortran.cxx | 22 +-- Source/cmDocumentation.cxx | 2 +- Source/cmExecProgramCommand.cxx | 4 +- Source/cmExecuteProcessCommand.cxx | 16 +- Source/cmExportBuildFileGenerator.cxx | 8 +- Source/cmExportCommand.cxx | 24 +-- Source/cmExportFileGenerator.cxx | 12 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExportLibraryDependenciesCommand.cxx | 2 +- Source/cmExportTryCompileFileGenerator.cxx | 4 +- Source/cmExternalMakefileProjectGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 14 +- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 10 +- Source/cmExtraSublimeTextGenerator.cxx | 10 +- Source/cmFLTKWrapUICommand.cxx | 10 +- Source/cmFileCommand.cxx | 142 +++++++-------- Source/cmFindBase.cxx | 8 +- Source/cmFindCommon.cxx | 8 +- Source/cmFindLibraryCommand.cxx | 6 +- Source/cmFindPackageCommand.cxx | 110 ++++++------ Source/cmFindPathCommand.cxx | 6 +- Source/cmFindProgramCommand.cxx | 6 +- Source/cmForEachCommand.cxx | 16 +- Source/cmFunctionCommand.cxx | 12 +- Source/cmGeneratorExpression.cxx | 2 +- Source/cmGeneratorExpressionDAGChecker.cxx | 6 +- .../cmGeneratorExpressionEvaluationFile.cxx | 10 +- Source/cmGeneratorExpressionEvaluator.cxx | 16 +- Source/cmGeneratorTarget.cxx | 16 +- Source/cmGetCMakePropertyCommand.cxx | 4 +- Source/cmGetDirectoryPropertyCommand.cxx | 12 +- Source/cmGetFilenameComponentCommand.cxx | 12 +- Source/cmGetPropertyCommand.cxx | 50 +++--- Source/cmGetSourceFilePropertyCommand.cxx | 2 +- Source/cmGetTargetPropertyCommand.cxx | 10 +- Source/cmGetTestPropertyCommand.cxx | 8 +- Source/cmGlobalGenerator.cxx | 56 +++--- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 4 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 60 +++---- Source/cmGraphVizWriter.cxx | 12 +- Source/cmIfCommand.cxx | 12 +- Source/cmIncludeCommand.cxx | 8 +- Source/cmIncludeRegularExpressionCommand.cxx | 2 +- Source/cmInstallCommand.cxx | 76 ++++---- Source/cmInstallExportGenerator.cxx | 8 +- Source/cmInstallFilesCommand.cxx | 4 +- Source/cmInstallProgramsCommand.cxx | 2 +- Source/cmInstallTargetsCommand.cxx | 2 +- Source/cmLinkDirectoriesCommand.cxx | 2 +- Source/cmLinkLibrariesCommand.cxx | 6 +- Source/cmListCommand.cxx | 56 +++--- Source/cmListFileCache.cxx | 4 +- Source/cmLoadCacheCommand.cxx | 8 +- Source/cmLoadCommandCommand.cxx | 10 +- Source/cmLocalGenerator.cxx | 164 +++++++++--------- Source/cmLocalNinjaGenerator.cxx | 10 +- Source/cmLocalUnixMakefileGenerator3.cxx | 92 +++++----- Source/cmMacroCommand.cxx | 6 +- Source/cmMakeDepend.cxx | 8 +- Source/cmMakeDirectoryCommand.cxx | 2 +- Source/cmMakefile.cxx | 84 ++++----- .../cmMakefileExecutableTargetGenerator.cxx | 40 ++--- Source/cmMakefileLibraryTargetGenerator.cxx | 60 +++---- Source/cmMakefileTargetGenerator.cxx | 148 ++++++++-------- Source/cmMakefileUtilityTargetGenerator.cxx | 4 +- Source/cmMarkAsAdvancedCommand.cxx | 4 +- Source/cmMathCommand.cxx | 6 +- Source/cmMessageCommand.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 16 +- Source/cmNinjaTargetGenerator.cxx | 32 ++-- Source/cmOSXBundleGenerator.cxx | 6 +- Source/cmOptionCommand.cxx | 4 +- Source/cmOrderDirectories.cxx | 2 +- Source/cmOutputRequiredFilesCommand.cxx | 2 +- Source/cmPolicies.cxx | 6 +- Source/cmProjectCommand.cxx | 26 +-- Source/cmQTWrapCPPCommand.cxx | 10 +- Source/cmQTWrapUICommand.cxx | 16 +- Source/cmQtAutoGenerators.cxx | 62 +++---- Source/cmScriptGenerator.cxx | 2 +- Source/cmSeparateArgumentsCommand.cxx | 8 +- Source/cmSetCommand.cxx | 2 +- Source/cmSetDirectoryPropertiesCommand.cxx | 4 +- Source/cmSetPropertyCommand.cxx | 22 +-- Source/cmSetSourceFilesPropertiesCommand.cxx | 6 +- Source/cmSetTargetPropertiesCommand.cxx | 8 +- Source/cmSetTestsPropertiesCommand.cxx | 6 +- Source/cmSiteNameCommand.cxx | 4 +- Source/cmSourceFile.cxx | 6 +- Source/cmSourceGroupCommand.cxx | 6 +- Source/cmStringCommand.cxx | 76 ++++---- Source/cmSubdirCommand.cxx | 8 +- Source/cmSystemTools.cxx | 6 +- Source/cmTarget.cxx | 136 +++++++-------- Source/cmTargetLinkLibrariesCommand.cxx | 14 +- Source/cmTargetPropCommandBase.cxx | 8 +- Source/cmTestGenerator.cxx | 2 +- Source/cmTryRunCommand.cxx | 26 +-- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmUtilitySourceCommand.cxx | 6 +- Source/cmVariableRequiresCommand.cxx | 8 +- Source/cmVariableWatchCommand.cxx | 2 +- Source/cmWriteFileCommand.cxx | 4 +- Source/cmake.cxx | 112 ++++++------ Source/cmcmd.cxx | 16 +- Source/kwsys/SystemTools.cxx | 4 +- 157 files changed, 1384 insertions(+), 1384 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0162d5562..9ae58395f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -506,7 +506,7 @@ int cmCPackDebGenerator::createDeb() controlExtraList.begin(); i != controlExtraList.end(); ++i) { std::string filenamename = - cmsys::SystemTools::GetFilenameName(i->c_str()); + cmsys::SystemTools::GetFilenameName(*i); std::string localcopy = this->GetOption("WDIR"); localcopy += "/"; localcopy += filenamename; @@ -588,9 +588,9 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (NULL != GetOption(groupVar.c_str())) + if (NULL != GetOption(groupVar)) { - return std::string(GetOption(groupVar.c_str())); + return std::string(GetOption(groupVar)); } else { diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3915b31e8..cf514aa0d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -357,9 +357,9 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::list > symlinkedFiles; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); cmsys::Glob gl; - std::string top = it->c_str(); + std::string top = *it; it ++; - std::string subdir = it->c_str(); + std::string subdir = *it; std::string findExpr = top; findExpr += "/*"; cmCPackLogger(cmCPackLog::LOG_OUTPUT, @@ -473,7 +473,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( it != cmakeScriptsVector.end(); ++it ) { - std::string installScript = it->c_str(); + std::string installScript = *it; cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install script: " << installScript << std::endl); @@ -562,13 +562,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << std::endl); return 0; } - std::string installDirectory = it->c_str(); + std::string installDirectory = *it; ++it; - std::string installProjectName = it->c_str(); + std::string installProjectName = *it; ++it; - std::string installComponent = it->c_str(); + std::string installComponent = *it; ++it; - std::string installSubDirectory = it->c_str(); + std::string installSubDirectory = *it; std::string installFile = installDirectory + "/cmake_install.cmake"; std::vector componentsVector; @@ -586,7 +586,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; - const char *installTypes = this->GetOption(installTypesVar.c_str()); + const char *installTypes = this->GetOption(installTypesVar); if (installTypes && *installTypes) { std::vector installTypesVector; @@ -596,15 +596,15 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( installTypeIt != installTypesVector.end(); ++installTypeIt) { - this->GetInstallationType(installProjectName.c_str(), - installTypeIt->c_str()); + this->GetInstallationType(installProjectName, + *installTypeIt); } } // Determine the set of components that will be used in this project std::string componentsVar = "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); - const char *components = this->GetOption(componentsVar.c_str()); + const char *components = this->GetOption(componentsVar); if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); @@ -613,7 +613,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( compIt != componentsVector.end(); ++compIt) { - GetComponent(installProjectName.c_str(), compIt->c_str()); + GetComponent(installProjectName, *compIt); } componentInstall = true; } @@ -641,7 +641,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM"); std::vector buildCommand; globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, - installProjectName.c_str(), installDirectory.c_str(), + installProjectName, installDirectory, globalGenerator->GetPreinstallTargetName(), buildConfig, false); std::string buildCommandStr = @@ -932,19 +932,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string absoluteDestFileComponent = std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + GetComponentInstallDirNameSuffix(installComponent); - if (NULL != this->GetOption(absoluteDestFileComponent.c_str())) + if (NULL != this->GetOption(absoluteDestFileComponent)) { std::string absoluteDestFilesListComponent = - this->GetOption(absoluteDestFileComponent.c_str()); + this->GetOption(absoluteDestFileComponent); absoluteDestFilesListComponent +=";"; absoluteDestFilesListComponent += mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - this->SetOption(absoluteDestFileComponent.c_str(), + this->SetOption(absoluteDestFileComponent, absoluteDestFilesListComponent.c_str()); } else { - this->SetOption(absoluteDestFileComponent.c_str(), + this->SetOption(absoluteDestFileComponent, mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); } } @@ -1428,14 +1428,14 @@ std::string cmCPackGenerator::GetComponentPackageFileName( std::string suffix="-"+groupOrComponentName; /* check if we should use DISPLAY name */ std::string dispNameVar = "CPACK_"+Name+"_USE_DISPLAY_NAME_IN_FILENAME"; - if (IsOn(dispNameVar.c_str())) + if (IsOn(dispNameVar)) { /* the component Group case */ if (isGroupName) { std::string groupDispVar = "CPACK_COMPONENT_GROUP_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* groupDispName = GetOption(groupDispVar.c_str()); + const char* groupDispName = GetOption(groupDispVar); if (groupDispName) { suffix = "-"+std::string(groupDispName); @@ -1446,7 +1446,7 @@ std::string cmCPackGenerator::GetComponentPackageFileName( { std::string dispVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* dispName = GetOption(dispVar.c_str()); + const char* dispName = GetOption(dispVar); if(dispName) { suffix = "-"+std::string(dispName); @@ -1497,7 +1497,7 @@ cmCPackGenerator::GetInstallationType(const std::string& projectName, installType->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { installType->DisplayName = displayName; @@ -1527,7 +1527,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, + cmsys::SystemTools::UpperCase(name); component->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { component->DisplayName = displayName; @@ -1537,23 +1537,23 @@ cmCPackGenerator::GetComponent(const std::string& projectName, component->DisplayName = component->Name; } component->IsHidden - = this->IsOn((macroPrefix + "_HIDDEN").c_str()); + = this->IsOn(macroPrefix + "_HIDDEN"); component->IsRequired - = this->IsOn((macroPrefix + "_REQUIRED").c_str()); + = this->IsOn(macroPrefix + "_REQUIRED"); component->IsDisabledByDefault - = this->IsOn((macroPrefix + "_DISABLED").c_str()); + = this->IsOn(macroPrefix + "_DISABLED"); component->IsDownloaded - = this->IsOn((macroPrefix + "_DOWNLOADED").c_str()) + = this->IsOn(macroPrefix + "_DOWNLOADED") || cmSystemTools::IsOn(this->GetOption("CPACK_DOWNLOAD_ALL")); - const char* archiveFile = this->GetOption((macroPrefix + - "_ARCHIVE_FILE").c_str()); + const char* archiveFile = this->GetOption(macroPrefix + + "_ARCHIVE_FILE"); if (archiveFile && *archiveFile) { component->ArchiveFile = archiveFile; } - const char* groupName = this->GetOption((macroPrefix + "_GROUP").c_str()); + const char* groupName = this->GetOption(macroPrefix + "_GROUP"); if (groupName && *groupName) { component->Group = GetComponentGroup(projectName, groupName); @@ -1565,7 +1565,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, } const char* description - = this->GetOption((macroPrefix + "_DESCRIPTION").c_str()); + = this->GetOption(macroPrefix + "_DESCRIPTION"); if (description && *description) { component->Description = description; @@ -1573,7 +1573,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, // Determine the installation types. const char *installTypes - = this->GetOption((macroPrefix + "_INSTALL_TYPES").c_str()); + = this->GetOption(macroPrefix + "_INSTALL_TYPES"); if (installTypes && *installTypes) { std::vector installTypesVector; @@ -1589,7 +1589,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, } // Determine the component dependencies. - const char *depends = this->GetOption((macroPrefix + "_DEPENDS").c_str()); + const char *depends = this->GetOption(macroPrefix + "_DEPENDS"); if (depends && *depends) { std::vector dependsVector; @@ -1600,7 +1600,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, ++dependIt) { cmCPackComponent *child = GetComponent(projectName, - dependIt->c_str()); + *dependIt); component->Dependencies.push_back(child); child->ReverseDependencies.push_back(component); } @@ -1624,7 +1624,7 @@ cmCPackGenerator::GetComponentGroup(const std::string& projectName, // Define the group group->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { group->DisplayName = displayName; @@ -1635,17 +1635,17 @@ cmCPackGenerator::GetComponentGroup(const std::string& projectName, } const char* description - = this->GetOption((macroPrefix + "_DESCRIPTION").c_str()); + = this->GetOption(macroPrefix + "_DESCRIPTION"); if (description && *description) { group->Description = description; } group->IsBold - = this->IsOn((macroPrefix + "_BOLD_TITLE").c_str()); + = this->IsOn(macroPrefix + "_BOLD_TITLE"); group->IsExpandedByDefault - = this->IsOn((macroPrefix + "_EXPANDED").c_str()); + = this->IsOn(macroPrefix + "_EXPANDED"); const char* parentGroupName - = this->GetOption((macroPrefix + "_PARENT_GROUP").c_str()); + = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (parentGroupName && *parentGroupName) { group->ParentGroup = GetComponentGroup(projectName, parentGroupName); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 62bfa91d4..f43383465 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -629,7 +629,7 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str, // if so add a desktop link std::string desktop = "CPACK_CREATE_DESKTOP_LINK_"; desktop += linkName; - if(this->IsSet(desktop.c_str())) + if(this->IsSet(desktop)) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 66a419405..c6171dc4e 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -272,9 +272,9 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (NULL != GetOption(groupVar.c_str())) + if (NULL != GetOption(groupVar)) { - return std::string(GetOption(groupVar.c_str())); + return std::string(GetOption(groupVar)); } else { diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d74c38d04..d1a16f0c4 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -326,7 +326,7 @@ int main (int argc, char const* const* argv) cdit != definitions.Map.end(); ++cdit ) { - globalMF->AddDefinition(cdit->first.c_str(), cdit->second.c_str()); + globalMF->AddDefinition(cdit->first, cdit->second.c_str()); } const char* cpackModulesPath = diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 0fac1368d..4a3eec5b1 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -241,11 +241,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) { // Make the generator available for the Build call below. cm.SetGlobalGenerator(cm.CreateGlobalGenerator( - this->BuildGenerator.c_str())); + this->BuildGenerator)); cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.GetCacheManager()->LoadCache(this->BinaryDir.c_str()); + cm.GetCacheManager()->LoadCache(this->BinaryDir); } else { @@ -295,9 +295,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) config = "Debug"; } int retVal = cm.GetGlobalGenerator()->Build( - this->SourceDir.c_str(), this->BinaryDir.c_str(), - this->BuildProject.c_str(), tarIt->c_str(), - &output, this->BuildMakeProgram.c_str(), + this->SourceDir, this->BinaryDir, + this->BuildProject, *tarIt, + &output, this->BuildMakeProgram, config, !this->BuildNoClean, false, remainingTime); diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 04eabd20d..de42e2bba 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -151,7 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() "\n" "Alternatively, set CTEST_BUILD_COMMAND to build the project " "with a custom command line."; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return 0; } } diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 5eed40972..1aa876897 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -69,7 +69,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmOStringStream e; e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return 0; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2e35b7575..2c21a1319 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -157,7 +157,7 @@ void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log) logGlob += this->CTest->GetCurrentTag(); logGlob += "/CoverageLog*"; cmsys::Glob gl; - gl.FindFiles(logGlob.c_str()); + gl.FindFiles(logGlob); std::vector const& files = gl.GetFiles(); for(std::vector::const_iterator fi = files.begin(); fi != files.end(); ++fi) @@ -241,7 +241,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), fBinDir.c_str()); // Always check parent directory of the file. - std::string fileDir = cmSystemTools::GetFilenamePath(fFile.c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(fFile); std::string checkDir; // We also need to check the binary/source directory pair. @@ -296,7 +296,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, checkDir = fSrcDir; } fFile = checkDir + "/" + relPath; - fFile = cmSystemTools::GetFilenamePath(fFile.c_str()); + fFile = cmSystemTools::GetFilenamePath(fFile); if ( fileDir == fFile ) { @@ -503,7 +503,7 @@ int cmCTestCoverageHandler::ProcessHandler() } const std::string fileName - = cmSystemTools::GetFilenameName(fullFileName.c_str()); + = cmSystemTools::GetFilenameName(fullFileName); std::string shortFileName = this->CTest->GetShortPathToFile(fullFileName.c_str()); const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov @@ -947,7 +947,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // Call gcov to get coverage data for this *.gcda file: // - std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(*it); std::string command = "\"" + gcovCommand + "\" " + gcovExtraFlags + " " + "-o \"" + fileDir + "\" " + @@ -1814,7 +1814,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( total_tested += functionsCalled; total_untested += (totalFunctions - functionsCalled); - std::string fileName = cmSystemTools::GetFilenameName(file.c_str()); + std::string fileName = cmSystemTools::GetFilenameName(file); std::string shortFileName = this->CTest->GetShortPathToFile(file.c_str()); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index abc33de68..a470b3bba 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -26,7 +26,7 @@ bool cmCTestEmptyBinaryDirectoryCommand { cmOStringStream ostr; ostr << "problem removing the binary directory: " << args[0].c_str(); - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index ae498ea44..08cfaeca6 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -75,7 +75,7 @@ void cmCTestGenericHandler::Initialize() it != this->PersistentOptions.end(); ++ it ) { - this->Options[it->first.c_str()] = it->second.c_str(); + this->Options[it->first] = it->second.c_str(); } } @@ -121,7 +121,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, return false; } if( !this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), - ostr.str().c_str(), xofs, true) ) + ostr.str(), xofs, true) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create resulting XML file: " << ostr.str().c_str() @@ -153,7 +153,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, ostr << "_" << this->CTest->GetCurrentTag(); } ostr << ".log"; - if( !this->CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) ) + if( !this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: " << ostr.str().c_str() << std::endl); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 2e2feb047..0e29160dd 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -48,7 +48,7 @@ bool cmCTestHandlerCommand { cmOStringStream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index c9f9e9e50..10a5199eb 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -680,8 +680,8 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname) continue; } - if(this->Match(line.c_str(), this->RegexWarning) && - !this->Match(line.c_str(), this->RegexWarningSuppress)) + if(this->Match(line, this->RegexWarning) && + !this->Match(line, this->RegexWarningSuppress)) { return true; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 1ad94bc40..0bb1a9960 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -352,7 +352,7 @@ void cmCTestP4::SetP4Options(std::vector &CommandOptions) for(std::vector::const_iterator ai = args.begin(); ai != args.end(); ++ai) { - P4Options.push_back(ai->c_str()); + P4Options.push_back(*ai); } } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index fe429bd9d..bdf9b9cae 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -56,7 +56,7 @@ bool cmCTestRunScriptCommand &ret); cmOStringStream str; str << ret; - this->Makefile->AddDefinition(returnVariable.c_str(), str.str().c_str()); + this->Makefile->AddDefinition(returnVariable, str.str().c_str()); } } return true; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7f13855b7..4d419c251 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -337,8 +337,8 @@ void cmCTestScriptHandler::CreateCMake() // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. // Also, some commands need Makefile->GetCurrentDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->Makefile->SetStartDirectory(cwd.c_str()); - this->Makefile->SetStartOutputDirectory(cwd.c_str()); + this->Makefile->SetStartDirectory(cwd); + this->Makefile->SetStartOutputDirectory(cwd); // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts @@ -436,7 +436,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) for (std::map::const_iterator it = defs.begin(); it != defs.end(); ++it) { - this->Makefile->AddDefinition(it->first.c_str(), it->second.c_str()); + this->Makefile->AddDefinition(it->first, it->second.c_str()); } // finally read in the script @@ -646,7 +646,7 @@ int cmCTestScriptHandler::RunCurrentScript() if (!this->CTestEnv.empty()) { std::vector envArgs; - cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs); + cmSystemTools::ExpandListArgument(this->CTestEnv,envArgs); cmSystemTools::AppendEnv(envArgs); } @@ -772,7 +772,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() ++ it ) { std::vector cvsArgs; - cmSystemTools::ExpandListArgument(it->c_str(),cvsArgs); + cmSystemTools::ExpandListArgument(*it,cvsArgs); if (cvsArgs.size() == 2) { std::string fullCommand = command; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 228a17300..da46f4ab8 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -131,7 +131,7 @@ bool cmCTestStartCommand << " " << sourceDir << "\n" << "which is not an existing directory. " << "Set CTEST_CHECKOUT_COMMAND to a command line to create it."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -160,7 +160,7 @@ bool cmCTestStartCommand::InitialCheckout( { // Use a generic VC object to run and log the command. cmCTestVC vc(this->CTest, ofs); - vc.SetSourceDirectory(sourceDir.c_str()); + vc.SetSourceDirectory(sourceDir); if(!vc.InitialCheckout(initialCheckoutCommand)) { return false; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3173f1564..bc3c33377 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -339,7 +339,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector args; - cmSystemTools::ExpandListArgument(curlopt.c_str(), args); + cmSystemTools::ExpandListArgument(curlopt, args); bool verifyPeerOff = false; bool verifyHostOff = false; for( std::vector::iterator i = args.begin(); @@ -461,7 +461,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, else { char md5[33]; - cmSystemTools::ComputeFileMD5(local_file.c_str(), md5); + cmSystemTools::ComputeFileMD5(local_file, md5); md5[32] = 0; upload_as += md5; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 59706568f..efeb658be 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -125,7 +125,7 @@ bool cmCTestSubdirCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } } @@ -213,7 +213,7 @@ bool cmCTestAddSubdirectoryCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } return true; @@ -1506,7 +1506,7 @@ std::string cmCTestTestHandler // then try with the exe extension else { - failed.push_back(attempted[ai].c_str()); + failed.push_back(attempted[ai]); tempPath = attempted[ai]; tempPath += cmSystemTools::GetExecutableExtension(); if(cmSystemTools::FileExists(tempPath.c_str()) @@ -1517,7 +1517,7 @@ std::string cmCTestTestHandler } else { - failed.push_back(tempPath.c_str()); + failed.push_back(tempPath); } } } @@ -2154,7 +2154,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2165,7 +2165,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES_ON_FAIL" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2176,7 +2176,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "RESOURCE_LOCK" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2196,7 +2196,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "REQUIRED_FILES" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2211,14 +2211,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "FAIL_REGULAR_EXPRESSION" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->ErrorRegularExpressions.push_back( std::pair( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "PROCESSORS" ) @@ -2240,7 +2240,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "DEPENDS" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2250,7 +2250,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ENVIRONMENT" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2260,7 +2260,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "LABELS" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2284,14 +2284,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "PASS_REGULAR_EXPRESSION" ) { std::vector lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->RequiredRegularExpressions.push_back( std::pair( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "WORKING_DIRECTORY" ) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index fe98964c5..623621148 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -122,7 +122,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) glob.RecurseOn(); std::string pat = d; pat += "/*.m"; - glob.FindFiles(pat.c_str()); + glob.FindFiles(pat); std::vector& files = glob.GetFiles(); std::vector::iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index b5ed3128c..b50eb644d 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -19,7 +19,7 @@ cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, field_opts_off(this->Field, O_EDIT); field_opts_off(this->Field, O_ACTIVE); field_opts_off(this->Field, O_STATIC); - this->SetValue(name.c_str()); + this->SetValue(name); } cmCursesLabelWidget::~cmCursesLabelWidget() diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index aa680fb9a..d76ba2a9d 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -74,7 +74,7 @@ void cmCursesOptionsWidget::NextOption() { this->CurrentOption = 0; } - this->SetValue(this->Options[this->CurrentOption].c_str()); + this->SetValue(this->Options[this->CurrentOption]); } void cmCursesOptionsWidget::PreviousOption() { @@ -86,7 +86,7 @@ void cmCursesOptionsWidget::PreviousOption() { this->CurrentOption--; } - this->SetValue(this->Options[this->CurrentOption].c_str()); + this->SetValue(this->Options[this->CurrentOption]); } void cmCursesOptionsWidget::SetOption(const std::string& value) diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 893ca9914..cd93bc3c1 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } std::vector dirs; - cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0)); + cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) { cstr = dirs[this->CurrentIndex]; @@ -74,7 +74,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) cstr += "/"; } - this->SetString(cstr.c_str()); + this->SetString(cstr); touchwin(w); wrefresh(w); form_driver(form, REQ_END_FIELD); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 3de04f5f2..c3a9a16d4 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -273,7 +273,7 @@ bool cmAddCustomCommandCommand { // Lookup an existing command. if(cmSourceFile* sf = - this->Makefile->GetSourceFileWithOutput(output[0].c_str())) + this->Makefile->GetSourceFileWithOutput(output[0])) { if(cmCustomCommand* cc = sf->GetCustomCommand()) { @@ -288,7 +288,7 @@ bool cmAddCustomCommandCommand cmOStringStream e; e << "given APPEND option with output \"" << output[0].c_str() << "\" which is not already a custom command output."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -305,7 +305,7 @@ bool cmAddCustomCommandCommand { // Source is empty, use the target. std::vector no_depends; - this->Makefile->AddCustomCommandToTarget(target.c_str(), no_depends, + this->Makefile->AddCustomCommandToTarget(target, no_depends, commandLines, cctype, comment, working.c_str(), escapeOldStyle); @@ -314,7 +314,7 @@ bool cmAddCustomCommandCommand { // Target is empty, use the output. this->Makefile->AddCustomCommandToOutput(output, depends, - main_dependency.c_str(), + main_dependency, commandLines, comment, working.c_str(), false, escapeOldStyle); @@ -324,7 +324,7 @@ bool cmAddCustomCommandCommand { bool okay = false; if(cmSourceFile* sf = - this->Makefile->GetSourceFileWithOutput(output[0].c_str())) + this->Makefile->GetSourceFileWithOutput(output[0])) { if(cmCustomCommand* cc = sf->GetCustomCommand()) { @@ -337,7 +337,7 @@ bool cmAddCustomCommandCommand cmOStringStream e; e << "could not locate source file with a custom command producing \"" << output[0] << "\" even though this command tried to create it!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -367,7 +367,7 @@ bool cmAddCustomCommandCommand { e << "The SOURCE signatures of add_custom_command are no longer " "supported."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -375,8 +375,8 @@ bool cmAddCustomCommandCommand } // Use the old-style mode for backward compatibility. - this->Makefile->AddCustomCommandOldStyle(target.c_str(), outputs, depends, - source.c_str(), commandLines, + this->Makefile->AddCustomCommandOldStyle(target, outputs, depends, + source, commandLines, comment); } @@ -397,7 +397,7 @@ cmAddCustomCommandCommand { std::string e = "attempted to have a file \"" + *o + "\" in a source directory as an output of custom command."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -409,7 +409,7 @@ cmAddCustomCommandCommand cmOStringStream msg; msg << "called with OUTPUT containing a \"" << (*o)[pos] << "\". This character is not allowed."; - this->SetError(msg.str().c_str()); + this->SetError(msg.str()); return false; } } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ef6252327..da02f008e 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -34,7 +34,7 @@ bool cmAddCustomTargetCommand e << "called with invalid target name \"" << targetName << "\". Target names may not contain a slash. " << "Use ADD_CUSTOM_COMMAND to generate files."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -149,7 +149,7 @@ bool cmAddCustomTargetCommand cmOStringStream msg; msg << "called with target name containing a \"" << targetName[pos] << "\". This character is not allowed."; - this->SetError(msg.str().c_str()); + this->SetError(msg.str()); return false; } @@ -187,7 +187,7 @@ bool cmAddCustomTargetCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -208,7 +208,7 @@ bool cmAddCustomTargetCommand std::string msg; if(!this->Makefile->EnforceUniqueName(targetName, msg, true)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } @@ -224,7 +224,7 @@ bool cmAddCustomTargetCommand // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; cmTarget* target = - this->Makefile->AddUtilityCommand(targetName.c_str(), excludeFromAll, + this->Makefile->AddUtilityCommand(targetName, excludeFromAll, working_directory.c_str(), depends, commandLines, escapeOldStyle, comment); diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index b55334f85..e897d81b6 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -38,7 +38,7 @@ bool cmAddDependenciesCommand cmOStringStream e; e << "Cannot add target-level dependencies to INTERFACE library " "target \"" << target_name << "\".\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -46,7 +46,7 @@ bool cmAddDependenciesCommand ++s; // skip over target_name for (; s != args.end(); ++s) { - target->AddUtility(s->c_str(), this->Makefile); + target->AddUtility(*s, this->Makefile); } } else diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 62b666766..6e48e90bb 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -101,7 +101,7 @@ bool cmAddExecutableCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -132,9 +132,9 @@ bool cmAddExecutableCommand } if (isAlias) { - if(!cmGeneratorExpression::IsValidTargetName(exename.c_str())) + if(!cmGeneratorExpression::IsValidTargetName(exename)) { - this->SetError(("Invalid name for ALIAS: " + exename).c_str()); + this->SetError("Invalid name for ALIAS: " + exename); return false; } if(excludeFromAll) @@ -151,7 +151,7 @@ bool cmAddExecutableCommand { cmOStringStream e; e << "ALIAS requires exactly one target argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -161,7 +161,7 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is itself an ALIAS."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget *aliasedTarget = @@ -172,7 +172,7 @@ bool cmAddExecutableCommand e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" does not already " "exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget::TargetType type = aliasedTarget->GetType(); @@ -182,7 +182,7 @@ bool cmAddExecutableCommand e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is not an " "executable."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if(aliasedTarget->IsImported()) @@ -190,10 +190,10 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddAlias(exename.c_str(), aliasedTarget); + this->Makefile->AddAlias(exename, aliasedTarget); return true; } @@ -206,12 +206,12 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create imported target \"" << exename << "\" because another target with the same name already exists."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Create the imported target. - this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE, + this->Makefile->AddImportedTarget(exename, cmTarget::EXECUTABLE, importGlobal); return true; } @@ -221,7 +221,7 @@ bool cmAddExecutableCommand std::string msg; if(!this->Makefile->EnforceUniqueName(exename, msg)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 009b1caa4..6159f868a 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -53,7 +53,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting STATIC type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -66,7 +66,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting SHARED type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -79,7 +79,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting MODULE type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -92,7 +92,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting OBJECT type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -105,7 +105,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting UNKNOWN type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -118,7 +118,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting ALIAS type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -130,21 +130,21 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting/multiple types."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (isAlias) { cmOStringStream e; e << "INTERFACE library specified with conflicting ALIAS type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (excludeFromAll) { cmOStringStream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -157,7 +157,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -177,7 +177,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "GLOBAL option may only be used with IMPORTED libraries."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } else @@ -192,14 +192,14 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library requires no source arguments."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (importGlobal && !importTarget) { cmOStringStream e; e << "INTERFACE library specified as GLOBAL, but not as IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -236,7 +236,7 @@ bool cmAddLibraryCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -247,9 +247,9 @@ bool cmAddLibraryCommand if (isAlias) { - if(!cmGeneratorExpression::IsValidTargetName(libName.c_str())) + if(!cmGeneratorExpression::IsValidTargetName(libName)) { - this->SetError(("Invalid name for ALIAS: " + libName).c_str()); + this->SetError("Invalid name for ALIAS: " + libName); return false; } if(excludeFromAll) @@ -266,7 +266,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "ALIAS requires exactly one target argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -276,7 +276,7 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is itself an ALIAS."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget *aliasedTarget = @@ -287,7 +287,7 @@ bool cmAddLibraryCommand e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" does not already " "exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget::TargetType aliasedType = aliasedTarget->GetType(); @@ -300,7 +300,7 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is not a library."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if(aliasedTarget->IsImported()) @@ -308,10 +308,10 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddAlias(libName.c_str(), aliasedTarget); + this->Makefile->AddAlias(libName, aliasedTarget); return true; } @@ -364,7 +364,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "Invalid name for IMPORTED INTERFACE library target: " << libName; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -375,12 +375,12 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create imported target \"" << libName << "\" because another target with the same name already exists."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Create the imported target. - this->Makefile->AddImportedTarget(libName.c_str(), type, importGlobal); + this->Makefile->AddImportedTarget(libName, type, importGlobal); return true; } @@ -399,7 +399,7 @@ bool cmAddLibraryCommand std::string msg; if(!this->Makefile->EnforceUniqueName(libName, msg)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } @@ -413,11 +413,11 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "Invalid name for INTERFACE library target: " << libName; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddLibrary(libName.c_str(), + this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll); @@ -439,7 +439,7 @@ bool cmAddLibraryCommand ++s; } - this->Makefile->AddLibrary(libName.c_str(), type, srclists, excludeFromAll); + this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll); return true; } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 5b1c9c668..4ea252496 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -66,7 +66,7 @@ bool cmAddSubDirectoryCommand::InitialPass std::string error = "given source \""; error += srcArg; error += "\" which is not an existing directory."; - this->SetError(error.c_str()); + this->SetError(error); return false; } srcPath = cmSystemTools::CollapseFullPath(srcPath.c_str()); @@ -87,7 +87,7 @@ bool cmAddSubDirectoryCommand::InitialPass << this->Makefile->GetCurrentDirectory() << "\". " << "When specifying an out-of-tree source a binary directory " << "must be explicitly specified."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -121,7 +121,7 @@ bool cmAddSubDirectoryCommand::InitialPass binPath = cmSystemTools::CollapseFullPath(binPath.c_str()); // Add the subdirectory using the computed full paths. - this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false, true); return true; diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index a9165f5b1..2531a1a76 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -44,7 +44,7 @@ bool cmAddTestCommand // Create the test but add a generator only the first time it is // seen. This preserves behavior from before test generators. - cmTest* test = this->Makefile->GetTest(args[0].c_str()); + cmTest* test = this->Makefile->GetTest(args[0]); if(test) { // If the test was already added by a new-style signature do not @@ -54,13 +54,13 @@ bool cmAddTestCommand cmOStringStream e; e << " given test name \"" << args[0] << "\" which already exists in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } else { - test = this->Makefile->CreateTest(args[0].c_str()); + test = this->Makefile->CreateTest(args[0]); test->SetOldStyle(true); this->Makefile->AddTestGenerator(new cmTestGenerator(test)); } @@ -137,7 +137,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) { cmOStringStream e; e << " given unknown argument:\n " << args[i] << "\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -157,17 +157,17 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) } // Require a unique test name within the directory. - if(this->Makefile->GetTest(name.c_str())) + if(this->Makefile->GetTest(name)) { cmOStringStream e; e << " given test NAME \"" << name << "\" which already exists in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Add the test. - cmTest* test = this->Makefile->CreateTest(name.c_str()); + cmTest* test = this->Makefile->CreateTest(name); test->SetOldStyle(false); test->SetCommand(command); if(!working_directory.empty()) diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 01f64b730..d8c3c4329 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -40,7 +40,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass } // was the list already populated - const char *def = this->Makefile->GetDefinition(args[1].c_str()); + const char *def = this->Makefile->GetDefinition(args[1]); if (def) { sourceListValue = def; @@ -72,7 +72,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass // add the file as a class file so // depends can be done cmSourceFile* sf = - this->Makefile->GetOrCreateSource(fullname.c_str()); + this->Makefile->GetOrCreateSource(fullname); sf->SetProperty("ABSTRACT","0"); if(!sourceListValue.empty()) { @@ -83,7 +83,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass } } } - this->Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str()); + this->Makefile->AddDefinition(args[1], sourceListValue.c_str()); return true; } diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 780ffa86a..93f780125 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -80,7 +80,7 @@ bool cmBuildCommand { cmOStringStream e; e << "unknown argument \"" << args[i] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -136,7 +136,7 @@ bool cmBuildCommand } std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), + ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType, "", true); if(cacheValue) diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index e3528e136..c64209f88 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -25,7 +25,7 @@ bool cmBuildNameCommand this->SetError("called with incorrect number of arguments"); return false; } - const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); + const char* cacheValue = this->Makefile->GetDefinition(args[0]); if(cacheValue) { // do we need to correct the value? @@ -36,7 +36,7 @@ bool cmBuildNameCommand cmSystemTools::ReplaceString(cv,"/", "_"); cmSystemTools::ReplaceString(cv,"(", "_"); cmSystemTools::ReplaceString(cv,")", "_"); - this->Makefile->AddCacheDefinition(args[0].c_str(), + this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", cmCacheManager::STRING); @@ -71,7 +71,7 @@ bool cmBuildNameCommand cmSystemTools::ReplaceString(buildname, ")", "_"); - this->Makefile->AddCacheDefinition(args[0].c_str(), + this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), "Name of build.", cmCacheManager::STRING); diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 62f238369..52345389c 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -53,7 +53,7 @@ bool cmCMakeHostSystemInformationCommand result_list += value; } - this->Makefile->AddDefinition(variable.c_str(), result_list.c_str()); + this->Makefile->AddDefinition(variable, result_list.c_str()); return true; } @@ -97,7 +97,7 @@ bool cmCMakeHostSystemInformationCommand else { std::string e = "does not recognize " + key; - this->SetError(e.c_str()); + this->SetError(e); return false; } diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 6e2ca64fa..ba3a83245 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -80,7 +80,7 @@ bool cmCMakeMinimumRequired { cmOStringStream e; e << "could not parse VERSION \"" << version_string.c_str() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -135,7 +135,7 @@ bool cmCMakeMinimumRequired::EnforceUnknownArguments() cmOStringStream e; e << "called with unknown argument \"" << this->UnknownArguments[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index f4be55930..ddd5d6ad5 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -58,7 +58,7 @@ bool cmCMakePolicyCommand cmOStringStream e; e << "given unknown first argument \"" << args[0] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -84,7 +84,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector const& args) { cmOStringStream e; e << "SET given unrecognized policy status \"" << args[2] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -116,7 +116,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) cmOStringStream e; e << "GET given policy \"" << id << "\" which is not known to this " << "version of CMake."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -126,15 +126,15 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector const& args) { case cmPolicies::OLD: // Report that the policy is set to OLD. - this->Makefile->AddDefinition(var.c_str(), "OLD"); + this->Makefile->AddDefinition(var, "OLD"); break; case cmPolicies::WARN: // Report that the policy is not set. - this->Makefile->AddDefinition(var.c_str(), ""); + this->Makefile->AddDefinition(var, ""); break; case cmPolicies::NEW: // Report that the policy is set to NEW. - this->Makefile->AddDefinition(var.c_str(), "NEW"); + this->Makefile->AddDefinition(var, "NEW"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index cb62f21e6..dd2a1b8f7 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -557,9 +557,9 @@ void CCONV *cmGetSource(void *arg, const char *name) sf->RealSourceFile = rsf; sf->FullPath = rsf->GetFullPath(); sf->SourceName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath.c_str()); + cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath); sf->SourceExtension = - cmSystemTools::GetFilenameLastExtension(sf->FullPath.c_str()); + cmSystemTools::GetFilenameLastExtension(sf->FullPath); // Store the proxy in the map so it can be re-used and deleted later. cmCPluginAPISourceFileMap::value_type entry(rsf, sf); @@ -583,7 +583,7 @@ void * CCONV cmAddSource(void *arg, void *arg2) } // Create the real cmSourceFile instance and copy over saved information. - cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath.c_str()); + cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath); rsf->GetProperties() = osf->Properties; for(std::vector::iterator i = osf->Depends.begin(); i != osf->Depends.end(); ++i) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index ee9b664d6..678b497f4 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -649,8 +649,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { std::string src_dir - = this->GetCTestConfiguration("SourceDirectory").c_str(); - std::string bld_dir = this->GetCTestConfiguration("BuildDirectory").c_str(); + = this->GetCTestConfiguration("SourceDirectory"); + std::string bld_dir = this->GetCTestConfiguration("BuildDirectory"); this->DartVersion = 1; this->DropSiteCDash = false; for(Part p = PartStart; p != PartCount; p = Part(p+1)) @@ -688,7 +688,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { std::string m = "Could not find include file: "; m += fname; - command->SetError(m.c_str()); + command->SetError(m); return false; } } @@ -930,7 +930,7 @@ bool cmCTest::AddIfExists(Part part, const char* file) { std::string name = file; name += ".gz"; - if ( this->CTestFileExists(name.c_str()) ) + if ( this->CTestFileExists(name) ) { this->AddSubmitFile(part, file); } @@ -2246,7 +2246,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if (cmCacheManager::ParseEntry(arg.c_str(), name, value, type)) + if (cmCacheManager::ParseEntry(arg, name, value, type)) { this->Definitions[name] = value; return true; @@ -2611,7 +2611,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, for ( it = slist.begin(); it != slist.end(); ++it ) { cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl); - vec.push_back(it->c_str()); + vec.push_back(*it); } } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 6284cb77c..c9490ca53 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -79,7 +79,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, { if (this->EscapeQuotes) { - return this->AddString(cmSystemTools::EscapeQuotes(ptr).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(ptr)); } else { @@ -94,7 +94,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, { if(this->EscapeQuotes) { - return this->AddString(cmSystemTools::EscapeQuotes(c).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(c)); } else { @@ -120,7 +120,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { cmOStringStream ostr; ostr << this->FileLine; - return this->AddString(ostr.str().c_str()); + return this->AddString(ostr.str()); } const char* value = this->Makefile->GetDefinition(var); if(!value && !this->RemoveEmpty) @@ -144,14 +144,14 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) bt.push_back(lfc); msg << "uninitialized variable \'" << var << "\'"; this->Makefile->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, - msg.str().c_str(), bt); + msg.str(), bt); } } return 0; } if (this->EscapeQuotes && value) { - return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(value)); } return this->AddString(value ? value : ""); } @@ -181,7 +181,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) std::string ref = "@"; ref += var; ref += "@"; - return this->AddString(ref.c_str()); + return this->AddString(ref); } char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 2d1da558a..995f191bd 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -312,7 +312,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, int index = lei->second; LinkEntry& entry = this->EntryList[index]; entry.Item = item; - entry.Target = this->FindTargetToLink(depender_index, entry.Item.c_str()); + entry.Target = this->FindTargetToLink(depender_index, entry.Item); entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && item.substr(0, 10) != "-framework"); @@ -328,7 +328,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, // Look for an old-style _LIB_DEPENDS variable. std::string var = entry.Item; var += "_LIB_DEPENDS"; - if(const char* val = this->Makefile->GetDefinition(var.c_str())) + if(const char* val = this->Makefile->GetDefinition(var)) { // The item dependencies are known. Follow them. BFSEntry qe = {index, val}; @@ -435,7 +435,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) LinkEntry& entry = this->EntryList[lei->second]; entry.Item = dep.Item; entry.Target = this->FindTargetToLink(dep.DependerIndex, - dep.Item.c_str()); + dep.Item); // This item was added specifically because it is a dependent // shared library. It may get special treatment @@ -506,7 +506,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, { std::string var = *di; var += "_LINK_TYPE"; - if(const char* val = this->Makefile->GetDefinition(var.c_str())) + if(const char* val = this->Makefile->GetDefinition(var)) { if(strcmp(val, "debug") == 0) { @@ -1000,7 +1000,7 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, // directories of targets linked in another configuration as link // directories. if(cmTarget const* tgt - = this->FindTargetToLink(depender_index, item.c_str())) + = this->FindTargetToLink(depender_index, item)) { if(!tgt->IsImported()) { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 62eaec235..ea8536fc0 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -293,7 +293,7 @@ cmComputeLinkInformation std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; loader_flag_var += this->LinkLanguage; loader_flag_var += "_FLAG"; - this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var.c_str()); + this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var); } // Get options needed to link libraries. @@ -317,8 +317,8 @@ cmComputeLinkInformation rtVar += this->LinkLanguage; rtVar += "_FLAG"; std::string rtSepVar = rtVar + "_SEP"; - this->RuntimeFlag = this->Makefile->GetSafeDefinition(rtVar.c_str()); - this->RuntimeSep = this->Makefile->GetSafeDefinition(rtSepVar.c_str()); + this->RuntimeFlag = this->Makefile->GetSafeDefinition(rtVar); + this->RuntimeSep = this->Makefile->GetSafeDefinition(rtSepVar); this->RuntimeAlways = (this->Makefile-> GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH")); @@ -330,7 +330,7 @@ cmComputeLinkInformation rlVar += "_RPATH_LINK_"; rlVar += this->LinkLanguage; rlVar += "_FLAG"; - this->RPathLinkFlag = this->Makefile->GetSafeDefinition(rlVar.c_str()); + this->RPathLinkFlag = this->Makefile->GetSafeDefinition(rlVar); } // Check if we need to include the runtime search path at link time. @@ -338,7 +338,7 @@ cmComputeLinkInformation std::string var = "CMAKE_SHARED_LIBRARY_LINK_"; var += this->LinkLanguage; var += "_WITH_RUNTIME_PATH"; - this->LinkWithRuntimePath = this->Makefile->IsOn(var.c_str()); + this->LinkWithRuntimePath = this->Makefile->IsOn(var); } // Check the platform policy for missing soname case. @@ -505,7 +505,7 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config.c_str(), + cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -593,7 +593,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) std::string libVar = "CMAKE_"; libVar += lang; libVar += "_IMPLICIT_LINK_LIBRARIES"; - if(const char* libs = this->Makefile->GetDefinition(libVar.c_str())) + if(const char* libs = this->Makefile->GetDefinition(libVar)) { std::vector libsVec; cmSystemTools::ExpandListArgument(libs, libsVec); @@ -602,7 +602,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) { if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end()) { - this->AddItem(i->c_str(), 0); + this->AddItem(*i, 0); } } } @@ -612,7 +612,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) std::string dirVar = "CMAKE_"; dirVar += lang; dirVar += "_IMPLICIT_LINK_DIRECTORIES"; - if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str())) + if(const char* dirs = this->Makefile->GetDefinition(dirVar)) { std::vector dirsVec; cmSystemTools::ExpandListArgument(dirs, dirsVec); @@ -820,7 +820,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() static_link_type_flag_var += this->LinkLanguage; static_link_type_flag_var += "_FLAGS"; static_link_type_flag = - this->Makefile->GetDefinition(static_link_type_flag_var.c_str()); + this->Makefile->GetDefinition(static_link_type_flag_var); std::string shared_link_type_flag_var = "CMAKE_"; shared_link_type_flag_var += target_type_str; @@ -828,7 +828,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() shared_link_type_flag_var += this->LinkLanguage; shared_link_type_flag_var += "_FLAGS"; shared_link_type_flag = - this->Makefile->GetDefinition(shared_link_type_flag_var.c_str()); + this->Makefile->GetDefinition(shared_link_type_flag_var); } // We can support link type switching only if all needed flags are @@ -1370,7 +1370,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) // Add the item using the -framework option. this->Items.push_back(Item("-framework", false)); - fw = this->LocalGenerator->EscapeForShell(fw.c_str()); + fw = this->LocalGenerator->EscapeForShell(fw); this->Items.push_back(Item(fw, false)); } @@ -1419,7 +1419,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() implicitDirVar += this->LinkLanguage; implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"; if(const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar.c_str())) + this->Makefile->GetDefinition(implicitDirVar)) { cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); } @@ -1506,9 +1506,9 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, // Print the warning at most once for this item. std::string wid = "CMP0008-WARNING-GIVEN-"; wid += item; - if(!this->CMakeInstance->GetPropertyAsBool(wid.c_str())) + if(!this->CMakeInstance->GetPropertyAsBool(wid)) { - this->CMakeInstance->SetProperty(wid.c_str(), "1"); + this->CMakeInstance->SetProperty(wid, "1"); cmOStringStream w; w << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n" @@ -1692,7 +1692,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() implicitDirVar += this->LinkLanguage; implicitDirVar += "_IMPLICIT_LINK_DIRECTORIES"; if(const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar.c_str())) + this->Makefile->GetDefinition(implicitDirVar)) { cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); } @@ -1710,7 +1710,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() implicitLibVar += this->LinkLanguage; implicitLibVar += "_IMPLICIT_LINK_LIBRARIES"; if(const char* implicitLibs = - this->Makefile->GetDefinition(implicitLibVar.c_str())) + this->Makefile->GetDefinition(implicitLibVar)) { cmSystemTools::ExpandListArgument(implicitLibs, implicitLibVec); } @@ -1978,11 +1978,11 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, { std::string useVar = "CMAKE_" + *li + "_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH"; - if(this->Makefile->IsOn(useVar.c_str())) + if(this->Makefile->IsOn(useVar)) { std::string dirVar = "CMAKE_" + *li + "_IMPLICIT_LINK_DIRECTORIES"; - if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str())) + if(const char* dirs = this->Makefile->GetDefinition(dirVar)) { cmCLI_ExpandListUnique(dirs, runtimeDirs, emitted); } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 5c739b87a..b4dbce7a5 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -223,8 +223,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -235,7 +235,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) it != configs.end(); ++it) { std::vector tlibs; - depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender); + depender->GetDirectLinkLibraries(*it, tlibs, depender); // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -245,8 +245,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -265,7 +265,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same utility twice for this target. if(emitted.insert(*util).second) { - this->AddTargetDepend(depender_index, util->c_str(), false); + this->AddTargetDepend(depender_index, *util, false); } } } @@ -288,8 +288,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -326,7 +326,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, // A target should not depend on itself. emitted.insert(depender->GetName()); this->AddInterfaceDepends(depender_index, dependee, - it->c_str(), emitted); + *it, emitted); } } } diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index f8ec6429a..395e6c8b6 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -38,7 +38,7 @@ bool cmConfigureFileCommand e << "input location\n" << " " << this->InputFile << "\n" << "is a directory but a file was expected."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -61,14 +61,14 @@ bool cmConfigureFileCommand { std::string e = "attempted to configure a file: " + this->OutputFile + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } std::string errorMessage; if (!this->NewLineStyle.ReadFromArguments(args, errorMessage)) { - this->SetError(errorMessage.c_str()); + this->SetError(errorMessage); return false; } this->CopyOnly = false; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ab7b024bf..3987283bc 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -307,13 +307,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE"; std::string rulesOverrideLang = rulesOverrideBase + "_" + *li; if(const char* rulesOverridePath = - this->Makefile->GetDefinition(rulesOverrideLang.c_str())) + this->Makefile->GetDefinition(rulesOverrideLang)) { fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), rulesOverridePath); } else if(const char* rulesOverridePath2 = - this->Makefile->GetDefinition(rulesOverrideBase.c_str())) + this->Makefile->GetDefinition(rulesOverrideBase)) { fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(), rulesOverridePath2); @@ -325,7 +325,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) li != testLangs.end(); ++li) { std::string langFlags = "CMAKE_" + *li + "_FLAGS"; - const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); + const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), lg->EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" @@ -484,7 +484,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) std::string output; // actually do the try compile now that everything is setup int res = this->Makefile->TryCompile(sourceDirectory, - this->BinaryDirectory.c_str(), + this->BinaryDirectory, projectName, targetName, this->SrcFileSignature, @@ -496,14 +496,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) } // set the result var to the return value to indicate success or failure - this->Makefile->AddCacheDefinition(argv[0].c_str(), + this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", cmCacheManager::INTERNAL); if ( outputVariable.size() > 0 ) { - this->Makefile->AddDefinition(outputVariable.c_str(), output.c_str()); + this->Makefile->AddDefinition(outputVariable, output.c_str()); } if (this->SrcFileSignature) @@ -540,7 +540,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) if(!copyFileError.empty()) { - this->Makefile->AddDefinition(copyFileError.c_str(), + this->Makefile->AddDefinition(copyFileError, copyFileErrorMessage.c_str()); } } diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index de20cb7ef..02fb8cb01 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -169,13 +169,13 @@ bool cmCreateTestSourceList // Construct the source list. std::string sourceListValue; { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(driver.c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(driver); sf->SetProperty("ABSTRACT","0"); sourceListValue = args[1]; } for(i = testsBegin; i != tests.end(); ++i) { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(i->c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); sf->SetProperty("ABSTRACT","0"); sourceListValue += ";"; sourceListValue += *i; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d8a756dc9..b9cf777a8 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -63,11 +63,11 @@ cmCustomCommandGenerator cmd += " "; if(this->OldStyle) { - cmd += this->LG->EscapeForShellOldStyle(arg.c_str()); + cmd += this->LG->EscapeForShellOldStyle(arg); } else { - cmd += this->LG->EscapeForShell(arg.c_str(), this->MakeVars); + cmd += this->LG->EscapeForShell(arg, this->MakeVars); } } } diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 1ad98afd3..6b729de1e 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -58,7 +58,7 @@ bool cmDefinePropertyCommand << "Valid scopes are " << "GLOBAL, DIRECTORY, TARGET, SOURCE, " << "TEST, VARIABLE, CACHED_VARIABLE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -102,7 +102,7 @@ bool cmDefinePropertyCommand { cmOStringStream e; e << "given invalid argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -128,7 +128,7 @@ bool cmDefinePropertyCommand // Actually define the property. this->Makefile->GetCMakeInstance()->DefineProperty - (this->PropertyName.c_str(), scope, + (this->PropertyName, scope, this->BriefDocs.c_str(), this->FullDocs.c_str(), inherited); return true; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 51150f2e8..50a395e36 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -47,7 +47,7 @@ bool cmDepends::Write(std::ostream &makeDepends, std::string srcLang = "CMAKE_DEPENDS_CHECK_"; srcLang += this->Language; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - const char* srcStr = mf->GetSafeDefinition(srcLang.c_str()); + const char* srcStr = mf->GetSafeDefinition(srcLang); std::vector pairs; cmSystemTools::ExpandListArgument(srcStr, pairs); @@ -61,7 +61,7 @@ bool cmDepends::Write(std::ostream &makeDepends, std::string obj = *si++; // Make sure the object file is relative to the top of the build tree. - obj = this->LocalGenerator->Convert(obj.c_str(), + obj = this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); dependencies[obj].insert(src); @@ -305,7 +305,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang) includePathVar += lang; includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - includePath = mf->GetDefinition(includePathVar.c_str()); + includePath = mf->GetDefinition(includePathVar); if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); @@ -316,7 +316,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang) includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_INCLUDE_PATH"; - includePath = mf->GetDefinition(includePathVar.c_str()); + includePath = mf->GetDefinition(includePathVar); if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 57a66da31..56ef6e2f3 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -54,14 +54,14 @@ cmDependsC::cmDependsC(cmLocalGenerator* lg, std::string scanRegexVar = "CMAKE_"; scanRegexVar += lang; scanRegexVar += "_INCLUDE_REGEX_SCAN"; - if(const char* sr = mf->GetDefinition(scanRegexVar.c_str())) + if(const char* sr = mf->GetDefinition(scanRegexVar)) { scanRegex = sr; } std::string complainRegexVar = "CMAKE_"; complainRegexVar += lang; complainRegexVar += "_INCLUDE_REGEX_COMPLAIN"; - if(const char* cr = mf->GetDefinition(complainRegexVar.c_str())) + if(const char* cr = mf->GetDefinition(complainRegexVar)) { complainRegex = cr; } @@ -274,7 +274,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, i != dependencies.end(); ++i) { makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), + this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b3fbaa230..1d91b4aa8 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -292,15 +292,15 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, stamp += ".mod.stamp"; fcStream << "\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_lower.c_str(), + this->LocalGenerator->Convert(mod_lower, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_upper.c_str(), + this->LocalGenerator->Convert(mod_upper, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(stamp.c_str(), + this->LocalGenerator->Convert(stamp, cmLocalGenerator::START_OUTPUT) << "\"\n"; } @@ -449,7 +449,7 @@ cmDependsFortran i != info.Includes.end(); ++i) { makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), + this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; @@ -480,7 +480,7 @@ cmDependsFortran proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); @@ -497,7 +497,7 @@ cmDependsFortran { // This module is known. Depend on its timestamp file. std::string stampFile = - this->LocalGenerator->Convert(required->second.c_str(), + this->LocalGenerator->Convert(required->second, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << stampFile << "\n"; @@ -510,7 +510,7 @@ cmDependsFortran if(this->FindModule(*i, module)) { module = - this->LocalGenerator->Convert(module.c_str(), + this->LocalGenerator->Convert(module, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << module << "\n"; @@ -526,7 +526,7 @@ cmDependsFortran proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << proxy << ": " << obj << ".provides" << std::endl; @@ -552,7 +552,7 @@ cmDependsFortran modFile += "/"; modFile += *i; modFile = - this->LocalGenerator->Convert(modFile.c_str(), + this->LocalGenerator->Convert(modFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); std::string stampFile = stamp_dir; @@ -560,7 +560,7 @@ cmDependsFortran stampFile += m; stampFile += ".mod.stamp"; stampFile = - this->LocalGenerator->Convert(stampFile.c_str(), + this->LocalGenerator->Convert(stampFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " @@ -582,7 +582,7 @@ cmDependsFortran // the target finishes building. std::string driver = this->TargetDirectory; driver += "/build"; - driver = this->LocalGenerator->Convert(driver.c_str(), + driver = this->LocalGenerator->Convert(driver, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << driver << ": " << obj << ".provides.build\n"; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 96b5f0449..a4bc83d1f 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -672,7 +672,7 @@ bool cmDocumentation::PrintFiles(std::ostream& os, for (std::vector::const_iterator i = files.begin(); i != files.end(); ++i) { - found = r.ProcessFile(i->c_str()) || found; + found = r.ProcessFile(*i) || found; } return found; } diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 6c11345b7..9b5908899 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -132,14 +132,14 @@ bool cmExecProgramCommand } std::string coutput = std::string(output, first, last-first+1); - this->Makefile->AddDefinition(output_variable.c_str(), coutput.c_str()); + this->Makefile->AddDefinition(output_variable, coutput.c_str()); } if ( return_variable.size() > 0 ) { char buffer[100]; sprintf(buffer, "%d", retVal); - this->Makefile->AddDefinition(return_variable.c_str(), buffer); + this->Makefile->AddDefinition(return_variable, buffer); } return true; diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 994c1707b..40f70b8c7 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -191,7 +191,7 @@ bool cmExecuteProcessCommand { cmOStringStream e; e << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -200,7 +200,7 @@ bool cmExecuteProcessCommand { std::string e = "attempted to output into a file: " + output_file + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -326,12 +326,12 @@ bool cmExecuteProcessCommand // Store the output obtained. if(!output_variable.empty() && tempOutput.size()) { - this->Makefile->AddDefinition(output_variable.c_str(), + this->Makefile->AddDefinition(output_variable, &*tempOutput.begin()); } if(!merge_output && !error_variable.empty() && tempError.size()) { - this->Makefile->AddDefinition(error_variable.c_str(), + this->Makefile->AddDefinition(error_variable, &*tempError.begin()); } @@ -345,19 +345,19 @@ bool cmExecuteProcessCommand int v = cmsysProcess_GetExitValue(cp); char buf[100]; sprintf(buf, "%d", v); - this->Makefile->AddDefinition(result_variable.c_str(), buf); + this->Makefile->AddDefinition(result_variable, buf); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, "Process terminated due to timeout"); break; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index f991f457a..e79206dee 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -47,7 +47,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) cmOStringStream e; e << "given target \"" << te->GetName() << "\" more than once."; this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), this->Backtrace); + ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); return false; } if (te->GetType() == cmTarget::INTERFACE_LIBRARY) @@ -106,7 +106,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - this->GenerateImportConfig(os, ci->c_str(), missingTargets); + this->GenerateImportConfig(os, *ci, missingTargets); } this->GenerateMissingTargetsCheckCode(os, missingTargets); @@ -315,7 +315,7 @@ cmExportBuildFileGenerator << "consider using the APPEND option with multiple separate calls."; this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), this->Backtrace); + ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); } std::string @@ -328,7 +328,7 @@ cmExportBuildFileGenerator::InstallNameDir(cmTarget* target, if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = - target->GetInstallNameDirForBuildTree(config.c_str()); + target->GetInstallNameDirForBuildTree(config); } return install_name_dir; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index bda8ddadc..dcb77bab5 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -92,7 +92,7 @@ bool cmExportCommand cmOStringStream e; e << "FILE option given filename \"" << this->Filename.GetString() << "\" which does not have an extension of \".cmake\".\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } fname = this->Filename.GetString(); @@ -106,7 +106,7 @@ bool cmExportCommand cmOStringStream e; e << "FILE option given filename \"" << fname << "\" which is in the source tree.\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -128,7 +128,7 @@ bool cmExportCommand { cmOStringStream e; e << "EXPORT signature does not recognise the APPEND option."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -137,7 +137,7 @@ bool cmExportCommand cmOStringStream e; e << "EXPORT signature does not recognise the " "EXPORT_LINK_INTERFACE_LIBRARIES option."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -147,7 +147,7 @@ bool cmExportCommand { cmOStringStream e; e << "Export set \"" << setName << "\" not found."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } this->ExportSet = setMap[setName]; @@ -164,18 +164,18 @@ bool cmExportCommand cmOStringStream e; e << "given ALIAS target \"" << *currentTarget << "\" which may not be exported."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - if(cmTarget* target = gg->FindTarget(currentTarget->c_str())) + if(cmTarget* target = gg->FindTarget(*currentTarget)) { if(target->GetType() == cmTarget::OBJECT_LIBRARY) { cmOStringStream e; e << "given OBJECT library \"" << *currentTarget << "\" which may not be exported."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -184,7 +184,7 @@ bool cmExportCommand cmOStringStream e; e << "given target \"" << *currentTarget << "\" which is not built by this project."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } targets.push_back(*currentTarget); @@ -229,7 +229,7 @@ bool cmExportCommand ci = configurationTypes.begin(); ci != configurationTypes.end(); ++ci) { - ebfg->AddConfiguration(ci->c_str()); + ebfg->AddConfiguration(*ci); } } else @@ -266,7 +266,7 @@ bool cmExportCommand::HandlePackage(std::vector const& args) { cmOStringStream e; e << "PACKAGE given unknown argument: " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -284,7 +284,7 @@ bool cmExportCommand::HandlePackage(std::vector const& args) cmOStringStream e; e << "PACKAGE given invalid package name \"" << package << "\". " << "Package names must match \"" << packageExpr << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 3c3c6df48..b38c48b5e 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -275,7 +275,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n" " \"" << *li << "\""; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } if (isSubDirectory(li->c_str(), installDir)) { @@ -286,7 +286,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } if (!inSourceBuild) { @@ -295,7 +295,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } } } @@ -498,14 +498,14 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( for (std::vector::const_iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { - getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str()); + getCompatibleInterfaceProperties(target, ifaceProperties, *ci); } } for (std::set::const_iterator it = ifaceProperties.begin(); it != ifaceProperties.end(); ++it) { - this->PopulateInterfaceProperty(("INTERFACE_" + *it).c_str(), + this->PopulateInterfaceProperty("INTERFACE_" + *it, target, properties); } } @@ -712,7 +712,7 @@ cmExportFileGenerator const char *propContent; if (const char *prop_suffixed = target->GetProperty( - ("LINK_INTERFACE_LIBRARIES" + suffix).c_str())) + "LINK_INTERFACE_LIBRARIES" + suffix)) { propContent = prop_suffixed; } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 5e7d5e44c..3dc1f6cea 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -211,7 +211,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets)) + if(!this->GenerateImportFileConfig(*ci, missingTargets)) { result = false; } diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index b04b93799..688d2ebf8 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const break; } std::string lib = li->first; - if(cmTarget* libtgt = global->FindTarget(lib.c_str())) + if(cmTarget* libtgt = global->FindTarget(lib)) { // Handle simple output name changes. This command is // deprecated so we do not support full target name diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index fe8c8ecad..3350d7c5d 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -102,7 +102,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, { const std::string libs = i->second.GetValue(); - std::string evalResult = this->FindTargets(i->first.c_str(), + std::string evalResult = this->FindTargets(i->first, target, emitted); std::vector depends; @@ -129,7 +129,7 @@ cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = - target->GetInstallNameDirForBuildTree(config.c_str()); + target->GetInstallNameDirForBuildTree(config); } return install_name_dir; diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index d89a1c83c..9264671a3 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -60,7 +60,7 @@ std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( it != this->SupportedGlobalGenerators.end(); ++it) { - if (this->CreateFullGeneratorName(it->c_str(), this->GetName()) + if (this->CreateFullGeneratorName(*it, this->GetName()) == currentName) { return *it; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 03f59c40b..edb9c38c0 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -334,7 +334,7 @@ void cmExtraCodeBlocksGenerator if (strcmp(makefile->GetStartOutputDirectory(), makefile->GetHomeOutputDirectory())==0) { - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first, 0, make.c_str(), makefile, compiler.c_str()); } } @@ -350,7 +350,7 @@ void cmExtraCodeBlocksGenerator break; } - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first, 0, make.c_str(), makefile, compiler.c_str()); break; case cmTarget::EXECUTABLE: @@ -359,11 +359,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::OBJECT_LIBRARY: { - this->AppendTarget(fout, ti->first.c_str(), &ti->second, + this->AppendTarget(fout, ti->first, &ti->second, make.c_str(), makefile, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget.c_str(), &ti->second, + this->AppendTarget(fout, fastTarget, &ti->second, make.c_str(), makefile, compiler.c_str()); } break; @@ -626,7 +626,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, if (!systemIncludeDirs.empty()) { std::vector dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); for(std::vector::const_iterator dirIt=dirs.begin(); dirIt != dirs.end(); ++dirIt) @@ -640,7 +640,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, if (!systemIncludeDirs.empty()) { std::vector dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); for(std::vector::const_iterator dirIt=dirs.begin(); dirIt != dirs.end(); ++dirIt) @@ -697,7 +697,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) std::string hostSystemName = mf->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME"); std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - std::string compilerId = mf->GetSafeDefinition(compilerIdVar.c_str()); + std::string compilerId = mf->GetSafeDefinition(compilerIdVar); std::string compiler = "gcc"; // default to gcc if (compilerId == "MSVC") { diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 5a9e12558..da397b191 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -404,7 +404,7 @@ cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(const cmMakefile* mf) const compilerIdVar = "CMAKE_C_COMPILER_ID"; } - std::string compilerId = mf->GetSafeDefinition(compilerIdVar.c_str()); + std::string compilerId = mf->GetSafeDefinition(compilerIdVar); std::string compiler = "gnu g++"; // default to g++ // Since we need the compiler for parsing purposes only diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 4aabc7e20..d02e54df6 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; const char* cacheValue = mf->GetCacheManager()->GetCacheValue( - cacheEntryName.c_str()); + cacheEntryName); // now we have both, decide which one to use std::string valueToUse; @@ -219,7 +219,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, // The variable is in the env, but not in the cache. Use it and put it // in the cache valueToUse = envVarValue; - mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); @@ -240,7 +240,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, if (valueToUse.find(envVarValue) == std::string::npos) { valueToUse = envVarValue; - mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); @@ -981,7 +981,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string systemIncludeDirs = mf->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); std::vector dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); this->AppendIncludeDirectories(fout, dirs, emmited); } compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); @@ -990,7 +990,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string systemIncludeDirs = mf->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS"); std::vector dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); this->AppendIncludeDirectories(fout, dirs, emmited); } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index f973a844c..ec5ffc291 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -177,7 +177,7 @@ void cmExtraSublimeTextGenerator:: if (strcmp(makefile->GetStartOutputDirectory(), makefile->GetHomeOutputDirectory())==0) { - this->AppendTarget(fout, ti->first.c_str(), *lg, 0, + this->AppendTarget(fout, ti->first, *lg, 0, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); } @@ -194,7 +194,7 @@ void cmExtraSublimeTextGenerator:: break; } - this->AppendTarget(fout, ti->first.c_str(), *lg, 0, + this->AppendTarget(fout, ti->first, *lg, 0, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); break; @@ -204,12 +204,12 @@ void cmExtraSublimeTextGenerator:: case cmTarget::MODULE_LIBRARY: case cmTarget::OBJECT_LIBRARY: { - this->AppendTarget(fout, ti->first.c_str(), *lg, &ti->second, + this->AppendTarget(fout, ti->first, *lg, &ti->second, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget.c_str(), *lg, &ti->second, + this->AppendTarget(fout, fastTarget, *lg, &ti->second, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); } @@ -440,7 +440,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(config); - lg->AppendDefines(defines, source->GetProperty(defPropName.c_str())); + lg->AppendDefines(defines, source->GetProperty(defPropName)); } std::string definesString; diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index dd99c4397..0a36b825b 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -48,7 +48,7 @@ bool cmFLTKWrapUICommand for(std::vector::iterator i = (newArgs.begin() + 1); i != newArgs.end(); i++) { - cmSourceFile *curr = this->Makefile->GetSource(i->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*i); // if we should use the source GUI // to generate .cxx and .h files if (!curr || !curr->GetPropertyAsBool("WRAP_EXCLUDE")) @@ -81,16 +81,16 @@ bool cmFLTKWrapUICommand std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), + this->Makefile->AddCustomCommandToOutput(cxxres, depends, no_main_dependency, commandLines, no_comment, no_working_dir); - this->Makefile->AddCustomCommandToOutput(hname.c_str(), + this->Makefile->AddCustomCommandToOutput(hname, depends, no_main_dependency, commandLines, no_comment, no_working_dir); - cmSourceFile *sf = this->Makefile->GetSource(cxxres.c_str()); + cmSourceFile *sf = this->Makefile->GetSource(cxxres); sf->AddDepend(hname.c_str()); sf->AddDepend(origname.c_str()); this->GeneratedSourcesClasses.push_back(sf); @@ -110,7 +110,7 @@ bool cmFLTKWrapUICommand } std::string varName = this->Target; varName += "_FLTK_UI_SRCS"; - this->Makefile->AddDefinition(varName.c_str(), sourceListValue.c_str()); + this->Makefile->AddDefinition(varName, sourceListValue.c_str()); return true; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index e79bc6c97..9fabdc753 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -174,7 +174,7 @@ bool cmFileCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -205,7 +205,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, std::string e = "attempted to write a file: " + fileName + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -235,7 +235,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for writing."; - this->SetError(error.c_str()); + this->SetError(error); return false; } file << message; @@ -295,7 +295,7 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for reading."; - this->SetError(error.c_str()); + this->SetError(error); return false; } @@ -359,7 +359,7 @@ bool cmFileCommand::HandleReadCommand(std::vector const& args) } } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } @@ -371,23 +371,23 @@ bool cmFileCommand::HandleHashCommand(std::vector const& args) { cmOStringStream e; e << args[0] << " requires a file name and output variable"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmsys::auto_ptr hash(cmCryptoHash::New(args[0].c_str())); if(hash.get()) { - std::string out = hash->HashFile(args[1].c_str()); + std::string out = hash->HashFile(args[1]); if(!out.empty()) { - this->Makefile->AddDefinition(args[2].c_str(), out.c_str()); + this->Makefile->AddDefinition(args[2], out.c_str()); return true; } cmOStringStream e; e << args[0] << " failed to read file \"" << args[1] << "\": " << cmSystemTools::GetLastSystemError(); - this->SetError(e.str().c_str()); + this->SetError(e.str()); } return false; #else @@ -481,7 +481,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option LIMIT_INPUT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } arg_mode = arg_none; @@ -494,7 +494,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option LIMIT_OUTPUT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } arg_mode = arg_none; @@ -507,7 +507,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option LIMIT_COUNT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } limit_count = count; @@ -521,7 +521,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option LENGTH_MINIMUM value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } minlen = len; @@ -535,7 +535,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option LENGTH_MAXIMUM value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } maxlen = len; @@ -548,7 +548,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS option REGEX value \"" << args[i] << "\" could not be compiled."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } have_regex = true; @@ -559,7 +559,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) cmOStringStream e; e << "STRINGS given unknown argument \"" << args[i] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -586,7 +586,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) { cmOStringStream e; e << "STRINGS file \"" << fileName << "\" cannot be read."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -709,7 +709,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) } // Save the output in a makefile variable. - this->Makefile->AddDefinition(outVar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outVar, output.c_str()); return true; } @@ -844,7 +844,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } @@ -873,14 +873,14 @@ bool cmFileCommand::HandleMakeDirectoryCommand( { std::string e = "attempted to create a directory: " + *cdir + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } if ( !cmSystemTools::MakeDirectory(cdir->c_str()) ) { std::string error = "problem creating directory: " + *cdir; - this->SetError(error.c_str()); + this->SetError(error); return false; } } @@ -926,7 +926,7 @@ cmFileCommand::HandleDifferentCommand(std::vector const& args) { cmOStringStream e; e << "DIFFERENT given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1041,7 +1041,7 @@ protected: { cmOStringStream e; e << this->Name << " cannot set permissions on \"" << toFile << "\""; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -1065,7 +1065,7 @@ protected: { cmOStringStream e; e << this->Name << " given invalid permission \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -1092,7 +1092,7 @@ protected: // The input file does not exist and installation is not optional. cmOStringStream e; e << this->Name << " cannot find \"" << fromFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1125,14 +1125,14 @@ protected: { cmOStringStream e; e << "option " << arg << " may not appear before PATTERN or REGEX."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } void NotAfterMatch(std::string const& arg) { cmOStringStream e; e << "option " << arg << " may not appear after PATTERN or REGEX."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } virtual void DefaultFilePermissions() @@ -1170,7 +1170,7 @@ bool cmFileCopier::Parse(std::vector const& args) { cmOStringStream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1186,7 +1186,7 @@ bool cmFileCopier::Parse(std::vector const& args) { cmOStringStream e; e << this->Name << " given no DESTINATION"; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1366,7 +1366,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) { cmOStringStream e; e << "could not compile PATTERN \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } } @@ -1382,7 +1382,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) { cmOStringStream e; e << "could not compile REGEX \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } break; @@ -1462,7 +1462,7 @@ bool cmFileCopier::Install(const char* fromFile, const char* toFile) { cmOStringStream e; e << "INSTALL encountered an empty string input file name."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1504,7 +1504,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile) cmOStringStream e; e << this->Name << " cannot read symlink \"" << fromFile << "\" to duplicate at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1537,7 +1537,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile) cmOStringStream e; e << this->Name << " cannot duplicate symlink \"" << fromFile << "\" at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } } @@ -1569,7 +1569,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, cmOStringStream e; e << this->Name << " cannot copy file \"" << fromFile << "\" to \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1588,7 +1588,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, cmOStringStream e; e << this->Name << " cannot set modification time on \"" << toFile << "\""; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } } @@ -1619,7 +1619,7 @@ bool cmFileCopier::InstallDirectory(const char* source, cmOStringStream e; e << this->Name << " cannot make directory \"" << destination << "\": " << cmSystemTools::GetLastSystemError(); - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1910,7 +1910,7 @@ bool cmFileInstaller::CheckKeyword(std::string const& arg) e << "INSTALL called with old-style " << arg << " argument. " << "This script was generated with an older version of CMake. " << "Re-run this cmake version on your build tree."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } else @@ -1976,7 +1976,7 @@ bool cmFileInstaller { cmOStringStream e; e << "Option TYPE given unknown value \"" << stype << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -2047,7 +2047,7 @@ bool cmFileInstaller::HandleInstallDestination() "absolute path or remove DESTDIR environment variable." "\nDESTINATION=\n"; message += destination; - this->FileCommand->SetError(message.c_str()); + this->FileCommand->SetError(message); return false; } } @@ -2061,7 +2061,7 @@ bool cmFileInstaller::HandleInstallDestination() { std::string errstring = "cannot create directory: " + destination + ". Maybe need administrative privileges."; - this->FileCommand->SetError(errstring.c_str()); + this->FileCommand->SetError(errstring); return false; } } @@ -2069,7 +2069,7 @@ bool cmFileInstaller::HandleInstallDestination() { std::string errstring = "INSTALL destination: " + destination + " is not a directory."; - this->FileCommand->SetError(errstring.c_str()); + this->FileCommand->SetError(errstring); return false; } return true; @@ -2118,7 +2118,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector const& args) { cmOStringStream e; e << "RPATH_CHANGE given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2141,7 +2141,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector const& args) { cmOStringStream e; e << "RPATH_CHANGE given FILE \"" << file << "\" that does not exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } bool success = true; @@ -2157,7 +2157,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector const& args) << "to the file:\n" << " " << file << "\n" << emsg; - this->SetError(e.str().c_str()); + this->SetError(e.str()); success = false; } if(success) @@ -2203,7 +2203,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector const& args) { cmOStringStream e; e << "RPATH_REMOVE given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2216,7 +2216,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector const& args) { cmOStringStream e; e << "RPATH_REMOVE given FILE \"" << file << "\" that does not exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } bool success = true; @@ -2230,7 +2230,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector const& args) e << "RPATH_REMOVE could not remove RPATH from file:\n" << " " << file << "\n" << emsg; - this->SetError(e.str().c_str()); + this->SetError(e.str()); success = false; } if(success) @@ -2284,7 +2284,7 @@ cmFileCommand::HandleRPathCheckCommand(std::vector const& args) { cmOStringStream e; e << "RPATH_CHECK given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2337,7 +2337,7 @@ bool cmFileCommand::HandleRelativePathCommand( std::string errstring = "RELATIVE_PATH must be passed a full path to the directory: " + directoryName; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } if(!cmSystemTools::FileIsFullPath(fileName.c_str())) @@ -2345,13 +2345,13 @@ bool cmFileCommand::HandleRelativePathCommand( std::string errstring = "RELATIVE_PATH must be passed a full path to the file: " + fileName; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } std::string res = cmSystemTools::RelativePath(directoryName.c_str(), fileName.c_str()); - this->Makefile->AddDefinition(outVar.c_str(), + this->Makefile->AddDefinition(outVar, res.c_str()); return true; } @@ -2389,7 +2389,7 @@ bool cmFileCommand::HandleRename(std::vector const& args) << "to\n" << " " << newname << "\n" << "because: " << err << "\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; @@ -2649,7 +2649,7 @@ namespace { { \ std::string e(errstr); \ e += ::curl_easy_strerror(result); \ - this->SetError(e.c_str()); \ + this->SetError(e); \ return false; \ } @@ -2785,7 +2785,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) std::string err = "DOWNLOAD EXPECTED_HASH expects ALGO=value but got: "; err += *i; - this->SetError(err.c_str()); + this->SetError(err); return false; } std::string algo = i->substr(0, pos); @@ -2795,7 +2795,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) { std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; err += algo; - this->SetError(err.c_str()); + this->SetError(err); return false; } hashMatchMSG = algo + " hash"; @@ -2809,7 +2809,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) if(cmSystemTools::FileExists(file.c_str()) && hash.get()) { std::string msg; - std::string actualHash = hash->HashFile(file.c_str()); + std::string actualHash = hash->HashFile(file); if(actualHash == expectedHash) { msg = "returning early; file already exists with expected "; @@ -2819,7 +2819,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) { cmOStringStream result; result << (int)0 << ";\"" << msg; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } return true; @@ -2828,14 +2828,14 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) // Make sure parent directory exists so we can write to the file // as we receive downloaded bits from curl... // - std::string dir = cmSystemTools::GetFilenamePath(file.c_str()); + std::string dir = cmSystemTools::GetFilenamePath(file); if(!cmSystemTools::FileExists(dir.c_str()) && !cmSystemTools::MakeDirectory(dir.c_str())) { std::string errstring = "DOWNLOAD error: cannot create directory '" + dir + "' - Specify file by full path name and verify that you " "have directory creation and file write privileges."; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } @@ -2954,7 +2954,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) { cmOStringStream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } @@ -2969,7 +2969,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) // if (hash.get()) { - std::string actualHash = hash->HashFile(file.c_str()); + std::string actualHash = hash->HashFile(file); if (actualHash.size() == 0) { this->SetError("DOWNLOAD cannot compute hash on downloaded file"); @@ -2986,7 +2986,7 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) << " status: [" << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"]" << std::endl ; - this->SetError(oss.str().c_str()); + this->SetError(oss.str()); return false; } } @@ -3000,12 +3000,12 @@ cmFileCommand::HandleDownloadCommand(std::vector const& args) if(verboseLog.size()) { - this->Makefile->AddDefinition(verboseLog.c_str(), + this->Makefile->AddDefinition(verboseLog, &*chunkDebug.begin()); } } - this->Makefile->AddDefinition(verboseLog.c_str(), + this->Makefile->AddDefinition(verboseLog, &*chunkDebug.begin()); } @@ -3102,7 +3102,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) { std::string errStr = "UPLOAD cannot open file '"; errStr += filename + "' for reading."; - this->SetError(errStr.c_str()); + this->SetError(errStr); return false; } @@ -3111,7 +3111,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) { std::string errStr = "UPLOAD cannot stat file '"; errStr += filename + "'."; - this->SetError(errStr.c_str()); + this->SetError(errStr); fclose(fin); return false; } @@ -3217,7 +3217,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) { cmOStringStream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } @@ -3246,7 +3246,7 @@ cmFileCommand::HandleUploadCommand(std::vector const& args) log += "\n"; } - this->Makefile->AddDefinition(logVar.c_str(), log.c_str()); + this->Makefile->AddDefinition(logVar, log.c_str()); } return true; @@ -3368,7 +3368,7 @@ bool cmFileCommand::HandleTimestampCommand( { std::string e = " TIMESTAMP sub-command does not recognize option " + args[argsIndex] + "."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } @@ -3376,7 +3376,7 @@ bool cmFileCommand::HandleTimestampCommand( cmTimestamp timestamp; std::string result = timestamp.FileModificationTime( filename.c_str(), formatString, utcFlag); - this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str()); + this->Makefile->AddDefinition(outputVariable, result.c_str()); return true; } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 86fd54b07..e4e819a00 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -237,7 +237,7 @@ void cmFindBase::AddPrefixPaths(std::vector const& in_paths, for(std::vector::const_iterator it = in_paths.begin(); it != in_paths.end(); ++it) { - std::string dir = it->c_str(); + std::string dir = *it; if(!subdir.empty() && !dir.empty() && dir[dir.size()-1] != '/') { dir += "/"; @@ -323,7 +323,7 @@ void cmFindBase::AddCMakeVariablePath() var += this->CMakePathName; var += "_PATH"; this->AddCMakePrefixPath("CMAKE_PREFIX_PATH"); - this->AddCMakePath(var.c_str()); + this->AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { @@ -360,7 +360,7 @@ void cmFindBase::AddCMakeSystemVariablePath() var += this->CMakePathName; var += "_PATH"; this->AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); - this->AddCMakePath(var.c_str()); + this->AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { @@ -466,7 +466,7 @@ void cmFindBase::PrintFindStuff() bool cmFindBase::CheckForVariableInCache() { if(const char* cacheValue = - this->Makefile->GetDefinition(this->VariableName.c_str())) + this->Makefile->GetDefinition(this->VariableName)) { cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index bd75e1054..10241f247 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -51,7 +51,7 @@ void cmFindCommon::SelectDefaultRootPathMode() std::string findRootPathVar = "CMAKE_FIND_ROOT_PATH_MODE_"; findRootPathVar += this->CMakePathName; std::string rootPathMode = - this->Makefile->GetSafeDefinition(findRootPathVar.c_str()); + this->Makefile->GetSafeDefinition(findRootPathVar); if (rootPathMode=="NEVER") { this->FindRootPathMode = RootPathModeNoRootPath; @@ -361,7 +361,7 @@ void cmFindCommon::AddUserPath(std::string const& p, // Expand using the view of the target application. std::string expanded = p; cmSystemTools::ExpandRegistryValues(expanded, view); - cmSystemTools::GlobDirs(expanded.c_str(), paths); + cmSystemTools::GlobDirs(expanded, paths); // Executables can be either 32-bit or 64-bit, so expand using the // alternative view. @@ -369,7 +369,7 @@ void cmFindCommon::AddUserPath(std::string const& p, { expanded = p; cmSystemTools::ExpandRegistryValues(expanded, other_view); - cmSystemTools::GlobDirs(expanded.c_str(), paths); + cmSystemTools::GlobDirs(expanded, paths); } } @@ -433,7 +433,7 @@ void cmFindCommon::AddPathInternal(std::string const& in_path, // Insert the path if has not already been emitted. if(this->SearchPathsEmitted.insert(fullPath).second) { - this->SearchPaths.push_back(fullPath.c_str()); + this->SearchPaths.push_back(fullPath); } } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 9345d157e..fe5e45f25 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -37,7 +37,7 @@ bool cmFindLibraryCommand // value. if(this->AlreadyInCacheWithoutMetaInfo) { - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "", + this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } @@ -69,14 +69,14 @@ bool cmFindLibraryCommand if(library != "") { // Save the value in the cache - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7a4e7f453..1d4e30c1e 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -223,7 +223,7 @@ bool cmFindPackageCommand } std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i]; - this->AddFindDefinition(req_var.c_str(), isRequired); + this->AddFindDefinition(req_var, isRequired); // Append to the list of required components. components += components_sep; @@ -255,7 +255,7 @@ bool cmFindPackageCommand e << "given CONFIGS option followed by invalid file name \"" << args[i] << "\". The names given must be file names without " << "a path and with a \".cmake\" extension."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } this->Configs.push_back(args[i]); @@ -269,7 +269,7 @@ bool cmFindPackageCommand { cmOStringStream e; e << "called with invalid argument \"" << args[i].c_str() << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -286,7 +286,7 @@ bool cmFindPackageCommand { e << " " << doubledComponents[i] << "\n"; } - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -309,7 +309,7 @@ bool cmFindPackageCommand e << " " << args[*si] << "\n"; } e << "The options are incompatible."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -327,7 +327,7 @@ bool cmFindPackageCommand // another find_package() call. std::string mod = this->Name; mod += "_FIND_MODULE"; - if(this->Makefile->IsOn(mod.c_str())) + if(this->Makefile->IsOn(mod)) { if(this->Version.empty()) { @@ -335,17 +335,17 @@ bool cmFindPackageCommand // Requested version string. std::string ver = this->Name; ver += "_FIND_VERSION"; - this->Version = this->Makefile->GetSafeDefinition(ver.c_str()); + this->Version = this->Makefile->GetSafeDefinition(ver); // Whether an exact version is required. std::string exact = this->Name; exact += "_FIND_VERSION_EXACT"; - this->VersionExact = this->Makefile->IsOn(exact.c_str()); + this->VersionExact = this->Makefile->IsOn(exact); } if(components.empty()) { std::string components_var = this->Name + "_FIND_COMPONENTS"; - components = this->Makefile->GetSafeDefinition(components_var.c_str()); + components = this->Makefile->GetSafeDefinition(components_var); } } } @@ -373,7 +373,7 @@ bool cmFindPackageCommand std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_"; disableFindPackageVar += this->Name; - if(this->Makefile->IsOn(disableFindPackageVar.c_str())) + if(this->Makefile->IsOn(disableFindPackageVar)) { if (this->Required) { @@ -381,7 +381,7 @@ bool cmFindPackageCommand e << "for module " << this->Name << " called with REQUIRED, but " << disableFindPackageVar << " is enabled. A REQUIRED package cannot be disabled."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -488,7 +488,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // Store the list of components. std::string components_var = this->Name + "_FIND_COMPONENTS"; - this->AddFindDefinition(components_var.c_str(), components.c_str()); + this->AddFindDefinition(components_var, components.c_str()); if(this->Quiet) { @@ -496,7 +496,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // quietly. std::string quietly = this->Name; quietly += "_FIND_QUIETLY"; - this->AddFindDefinition(quietly.c_str(), "1"); + this->AddFindDefinition(quietly, "1"); } if(this->Required) @@ -505,7 +505,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // a fatal error if the package is not found. std::string req = this->Name; req += "_FIND_REQUIRED"; - this->AddFindDefinition(req.c_str(), "1"); + this->AddFindDefinition(req, "1"); } if(!this->Version.empty()) @@ -514,23 +514,23 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // package has been requested. std::string ver = this->Name; ver += "_FIND_VERSION"; - this->AddFindDefinition(ver.c_str(), this->Version.c_str()); + this->AddFindDefinition(ver, this->Version.c_str()); char buf[64]; sprintf(buf, "%u", this->VersionMajor); - this->AddFindDefinition((ver+"_MAJOR").c_str(), buf); + this->AddFindDefinition(ver+"_MAJOR", buf); sprintf(buf, "%u", this->VersionMinor); - this->AddFindDefinition((ver+"_MINOR").c_str(), buf); + this->AddFindDefinition(ver+"_MINOR", buf); sprintf(buf, "%u", this->VersionPatch); - this->AddFindDefinition((ver+"_PATCH").c_str(), buf); + this->AddFindDefinition(ver+"_PATCH", buf); sprintf(buf, "%u", this->VersionTweak); - this->AddFindDefinition((ver+"_TWEAK").c_str(), buf); + this->AddFindDefinition(ver+"_TWEAK", buf); sprintf(buf, "%u", this->VersionCount); - this->AddFindDefinition((ver+"_COUNT").c_str(), buf); + this->AddFindDefinition(ver+"_COUNT", buf); // Tell the module whether an exact version has been requested. std::string exact = this->Name; exact += "_FIND_VERSION_EXACT"; - this->AddFindDefinition(exact.c_str(), this->VersionExact? "1":"0"); + this->AddFindDefinition(exact, this->VersionExact? "1":"0"); } } @@ -559,11 +559,11 @@ void cmFindPackageCommand::RestoreFindDefinitions() OriginalDef const& od = i->second; if(od.exists) { - this->Makefile->AddDefinition(i->first.c_str(), od.value.c_str()); + this->Makefile->AddDefinition(i->first, od.value.c_str()); } else { - this->Makefile->RemoveDefinition(i->first.c_str()); + this->Makefile->RemoveDefinition(i->first); } } } @@ -582,9 +582,9 @@ bool cmFindPackageCommand::FindModule(bool& found) found = true; std::string var = this->Name; var += "_FIND_MODULE"; - this->Makefile->AddDefinition(var.c_str(), "1"); + this->Makefile->AddDefinition(var, "1"); bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope); - this->Makefile->RemoveDefinition(var.c_str()); + this->Makefile->RemoveDefinition(var); return result; } return true; @@ -602,7 +602,7 @@ bool cmFindPackageCommand::HandlePackageMode() upperFound += "_FOUND"; // Try to find the config file. - const char* def = this->Makefile->GetDefinition(this->Variable.c_str()); + const char* def = this->Makefile->GetDefinition(this->Variable); // Try to load the config file if the directory is known bool fileFound = false; @@ -627,14 +627,14 @@ bool cmFindPackageCommand::HandlePackageMode() this->FileFound = file; fileFound = true; } - def = this->Makefile->GetDefinition(this->Variable.c_str()); + def = this->Makefile->GetDefinition(this->Variable); } // Search for the config file if it is not already found. if(cmSystemTools::IsOff(def) || !fileFound) { fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable.c_str()); + def = this->Makefile->GetDefinition(this->Variable); } // Sanity check. @@ -659,16 +659,16 @@ bool cmFindPackageCommand::HandlePackageMode() if(fileFound) { - if ((this->Makefile->IsDefinitionSet(foundVar.c_str())) - && (this->Makefile->IsOn(foundVar.c_str()) == false)) + if ((this->Makefile->IsDefinitionSet(foundVar)) + && (this->Makefile->IsOn(foundVar) == false)) { // by removing Foo_FOUND here if it is FALSE, we don't really change // the situation for the Config file which is about to be included, // but we make it possible to detect later on whether the Config file // has set Foo_FOUND to FALSE itself: - this->Makefile->RemoveDefinition(foundVar.c_str()); + this->Makefile->RemoveDefinition(foundVar); } - this->Makefile->RemoveDefinition(notFoundMessageVar.c_str()); + this->Makefile->RemoveDefinition(notFoundMessageVar); // Set the version variables before loading the config file. // It may override them. @@ -681,14 +681,14 @@ bool cmFindPackageCommand::HandlePackageMode() found = true; // Check whether the Config file has set Foo_FOUND to FALSE: - if ((this->Makefile->IsDefinitionSet(foundVar.c_str())) - && (this->Makefile->IsOn(foundVar.c_str()) == false)) + if ((this->Makefile->IsDefinitionSet(foundVar)) + && (this->Makefile->IsOn(foundVar) == false)) { // we get here if the Config file has set Foo_FOUND actively to FALSE found = false; configFileSetFOUNDFalse = true; notFoundMessage = this->Makefile->GetSafeDefinition( - notFoundMessageVar.c_str()); + notFoundMessageVar); } } else @@ -810,18 +810,18 @@ bool cmFindPackageCommand::HandlePackageMode() } // Set a variable marking whether the package was found. - this->Makefile->AddDefinition(foundVar.c_str(), found? "1":"0"); + this->Makefile->AddDefinition(foundVar, found? "1":"0"); // Set a variable naming the configuration file that was found. std::string fileVar = this->Name; fileVar += "_CONFIG"; if(found) { - this->Makefile->AddDefinition(fileVar.c_str(), this->FileFound.c_str()); + this->Makefile->AddDefinition(fileVar, this->FileFound.c_str()); } else { - this->Makefile->RemoveDefinition(fileVar.c_str()); + this->Makefile->RemoveDefinition(fileVar); } std::string consideredConfigsVar = this->Name; @@ -843,10 +843,10 @@ bool cmFindPackageCommand::HandlePackageMode() sep = ";"; } - this->Makefile->AddDefinition(consideredConfigsVar.c_str(), + this->Makefile->AddDefinition(consideredConfigsVar, consideredConfigFiles.c_str()); - this->Makefile->AddDefinition(consideredVersionsVar.c_str(), + this->Makefile->AddDefinition(consideredVersionsVar, consideredVersions.c_str()); return result; @@ -906,7 +906,7 @@ bool cmFindPackageCommand::FindConfig() help += this->Name; help += "."; // We force the value since we do not get here if it was already set. - this->Makefile->AddCacheDefinition(this->Variable.c_str(), + this->Makefile->AddCacheDefinition(this->Variable, init.c_str(), help.c_str(), cmCacheManager::PATH, true); return found; @@ -968,7 +968,7 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) std::string e = "Error reading CMake code from \""; e += f; e += "\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -1048,14 +1048,14 @@ void cmFindPackageCommand::AppendSuccessInformation() std::string transitivePropName = "_CMAKE_"; transitivePropName += this->Name + "_TRANSITIVE_DEPENDENCY"; this->Makefile->GetCMakeInstance() - ->SetProperty(transitivePropName.c_str(), "False"); + ->SetProperty(transitivePropName, "False"); } std::string found = this->Name; found += "_FOUND"; std::string upperFound = cmSystemTools::UpperCase(found); - const char* upperResult = this->Makefile->GetDefinition(upperFound.c_str()); - const char* result = this->Makefile->GetDefinition(found.c_str()); + const char* upperResult = this->Makefile->GetDefinition(upperFound); + const char* result = this->Makefile->GetDefinition(found); bool packageFound = ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult))); @@ -1066,7 +1066,7 @@ void cmFindPackageCommand::AppendSuccessInformation() std::string quietInfoPropName = "_CMAKE_"; quietInfoPropName += this->Name; quietInfoPropName += "_QUIET"; - this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName.c_str(), + this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName, this->Quiet ? "TRUE" : "FALSE"); // set a global property to record the required version of this package @@ -1080,7 +1080,7 @@ void cmFindPackageCommand::AppendSuccessInformation() versionInfo += " "; versionInfo += this->Version; } - this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(), + this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName, versionInfo.c_str()); if (this->Required) { @@ -1088,7 +1088,7 @@ void cmFindPackageCommand::AppendSuccessInformation() requiredInfoPropName += this->Name; requiredInfoPropName += "_TYPE"; this->Makefile->GetCMakeInstance()->SetProperty( - requiredInfoPropName.c_str(), "REQUIRED"); + requiredInfoPropName, "REQUIRED"); } @@ -1648,25 +1648,25 @@ void cmFindPackageCommand::StoreVersionFound() ver += "_VERSION"; if(this->VersionFound.empty()) { - this->Makefile->RemoveDefinition(ver.c_str()); + this->Makefile->RemoveDefinition(ver); } else { - this->Makefile->AddDefinition(ver.c_str(), this->VersionFound.c_str()); + this->Makefile->AddDefinition(ver, this->VersionFound.c_str()); } // Store the version components. char buf[64]; sprintf(buf, "%u", this->VersionFoundMajor); - this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf); + this->Makefile->AddDefinition(ver+"_MAJOR", buf); sprintf(buf, "%u", this->VersionFoundMinor); - this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf); + this->Makefile->AddDefinition(ver+"_MINOR", buf); sprintf(buf, "%u", this->VersionFoundPatch); - this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf); + this->Makefile->AddDefinition(ver+"_PATCH", buf); sprintf(buf, "%u", this->VersionFoundTweak); - this->Makefile->AddDefinition((ver+"_TWEAK").c_str(), buf); + this->Makefile->AddDefinition(ver+"_TWEAK", buf); sprintf(buf, "%u", this->VersionFoundCount); - this->Makefile->AddDefinition((ver+"_COUNT").c_str(), buf); + this->Makefile->AddDefinition(ver+"_COUNT", buf); } //---------------------------------------------------------------------------- diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index caaf1d3b2..5531cdff4 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -38,7 +38,7 @@ bool cmFindPathCommand if(this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition( - this->VariableName.c_str(), "", + this->VariableName, "", this->VariableDocumentation.c_str(), (this->IncludeFileInPath ? cmCacheManager::FILEPATH :cmCacheManager::PATH) @@ -51,14 +51,14 @@ bool cmFindPathCommand if(result.size() != 0) { this->Makefile->AddCacheDefinition - (this->VariableName.c_str(), result.c_str(), + (this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? cmCacheManager::FILEPATH :cmCacheManager::PATH); return true; } this->Makefile->AddCacheDefinition - (this->VariableName.c_str(), + (this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index bb27753b5..f6e37f694 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -35,7 +35,7 @@ bool cmFindProgramCommand // value. if(this->AlreadyInCacheWithoutMetaInfo) { - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "", + this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } @@ -46,14 +46,14 @@ bool cmFindProgramCommand if(result != "") { // Save the value in the cache - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); return true; } - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index d69706730..e3f66c1c3 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -35,9 +35,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // at end of for each execute recorded commands // store the old value std::string oldDef; - if (mf.GetDefinition(this->Args[0].c_str())) + if (mf.GetDefinition(this->Args[0])) { - oldDef = mf.GetDefinition(this->Args[0].c_str()); + oldDef = mf.GetDefinition(this->Args[0]); } std::vector::const_iterator j = this->Args.begin(); ++j; @@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, for( ; j != this->Args.end(); ++j) { // set the variable to the loop value - mf.AddDefinition(this->Args[0].c_str(),j->c_str()); + mf.AddDefinition(this->Args[0],j->c_str()); // Invoke all the functions that were collected in the block. cmExecutionStatus status; for(unsigned int c = 0; c < this->Functions.size(); ++c) @@ -58,13 +58,13 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, { inStatus.SetReturnInvoked(true); // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } if (status.GetBreakInvoked()) { // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } if(cmSystemTools::GetFatalErrorOccured() ) @@ -74,7 +74,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } } // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } else @@ -166,7 +166,7 @@ bool cmForEachCommand cmOStringStream str; str << "called with incorrect range specification: start "; str << start << ", stop " << stop << ", step " << step; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } std::vector range; @@ -226,7 +226,7 @@ bool cmForEachCommand::HandleInMode(std::vector const& args) } else if(doing == DoingLists) { - const char* value = this->Makefile->GetDefinition(args[i].c_str()); + const char* value = this->Makefile->GetDefinition(args[i]); if(value && *value) { cmSystemTools::ExpandListArgument(value, f->Args, true); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 9b981a320..3ff527df8 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -89,7 +89,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass std::string errorMsg = "Function invoked with incorrect arguments for function named: "; errorMsg += this->Args[0]; - this->SetError(errorMsg.c_str()); + this->SetError(errorMsg); return false; } @@ -113,15 +113,15 @@ bool cmFunctionHelperCommand::InvokeInitialPass { cmOStringStream tmpStream; tmpStream << "ARGV" << t; - this->Makefile->AddDefinition(tmpStream.str().c_str(), + this->Makefile->AddDefinition(tmpStream.str(), expandedArgs[t].c_str()); - this->Makefile->MarkVariableAsUsed(tmpStream.str().c_str()); + this->Makefile->MarkVariableAsUsed(tmpStream.str()); } // define the formal arguments for (unsigned int j = 1; j < this->Args.size(); ++j) { - this->Makefile->AddDefinition(this->Args[j].c_str(), + this->Makefile->AddDefinition(this->Args[j], expandedArgs[j-1].c_str()); } @@ -219,8 +219,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), - newName.c_str()); + mf.GetCMakeInstance()->RenameCommand(this->Args[0], + newName); mf.AddCommand(f); // remove the function blocker now that the function is defined diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index e4187d286..e127f3a90 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -379,7 +379,7 @@ void cmGeneratorExpression::Split(const std::string &input, } if(!part.empty()) { - cmSystemTools::ExpandListArgument(part.c_str(), output); + cmSystemTools::ExpandListArgument(part, output); } } pos += 2; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 04f36b473..07efba9bc 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -92,7 +92,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << "Self reference on target \"" << context->HeadTarget->GetName() << "\".\n"; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), parent->Backtrace); return; } @@ -103,7 +103,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << " " << expr << "\n" << "Dependency loop found."; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); } @@ -116,7 +116,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << (parent->Content ? parent->Content->GetOriginalExpression() : expr) << "\n"; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), parent->Backtrace); parent = parent->Parent; ++loopStep; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 90ce27cdd..d41285da1 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -50,7 +50,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmOStringStream e; e << "Evaluation file condition \"" << rawCondition << "\" did " "not evaluate to valid content. Got \"" << condResult << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } } @@ -72,7 +72,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmOStringStream e; e << "Evaluation file to be written multiple times for different " "configurations with different content:\n " << outputFileName; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -85,7 +85,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, { cmOStringStream e; e << "Evaluation file \"" << outputFileName << "\" cannot be written."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -109,7 +109,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() { cmOStringStream e; e << "Evaluation file \"" << this->Input << "\" cannot be read."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -142,7 +142,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() for(std::vector::const_iterator li = allConfigs.begin(); li != allConfigs.end(); ++li) { - this->Generate(li->c_str(), inputExpression.get(), outputFiles); + this->Generate(*li, inputExpression.get(), outputFiles); if(cmSystemTools::GetFatalErrorOccured()) { return; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 43c1794e9..14b2a1a32 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -39,7 +39,7 @@ void reportError(cmGeneratorExpressionContext *context, << " " << expr << "\n" << result; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); } @@ -393,8 +393,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode const std::string &lang) const { const char *compilerId = context->Makefile ? - context->Makefile->GetSafeDefinition(( - "CMAKE_" + lang + "_COMPILER_ID").c_str()) : ""; + context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_ID") : ""; if (parameters.size() == 0) { return compilerId ? compilerId : ""; @@ -428,7 +428,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode ->GetPolicyWarning(cmPolicies::CMP0044); context->Makefile->GetCMakeInstance() ->IssueMessage(cmake::AUTHOR_WARNING, - e.str().c_str(), context->Backtrace); + e.str(), context->Backtrace); } case cmPolicies::OLD: return "1"; @@ -500,8 +500,8 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode const std::string &lang) const { const char *compilerVersion = context->Makefile ? - context->Makefile->GetSafeDefinition(( - "CMAKE_" + lang + "_COMPILER_VERSION").c_str()) : ""; + context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_VERSION") : ""; if (parameters.size() == 0) { return compilerVersion ? compilerVersion : ""; @@ -747,7 +747,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode std::string mapProp = "MAP_IMPORTED_CONFIG_"; mapProp += cmSystemTools::UpperCase(context->Config); if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp.c_str())) + context->CurrentTarget->GetProperty(mapProp)) { cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), mappedConfigs); @@ -1022,7 +1022,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode break; } - const char *prop = target->GetProperty(propertyName.c_str()); + const char *prop = target->GetProperty(propertyName); if (dagCheckerParent) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eb67f9140..db8874981 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -688,7 +688,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) if(i == this->NameMap.end()) { // Check if we know how to generate this file. - cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name.c_str()); + cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name); NameMapType::value_type entry(name, sf); i = this->NameMap.insert(entry).first; } @@ -750,7 +750,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); if(depLocation == tLocation) { - this->Target->AddUtility(util.c_str()); + this->Target->AddUtility(util); return true; } } @@ -759,7 +759,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) { // The original name of the dependency was not a full path. It // must name a target, so add the target-level dependency. - this->Target->AddUtility(util.c_str()); + this->Target->AddUtility(util); return true; } } @@ -793,7 +793,7 @@ cmTargetTraceDependencies // this project. Add the target-level dependency to make // sure the executable is up to date before this custom // command possibly runs. - this->Target->AddUtility(command.c_str()); + this->Target->AddUtility(command); } } @@ -872,7 +872,7 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, { std::string defVarName = "OSX_ARCHITECTURES_"; defVarName += cmSystemTools::UpperCase(config); - archs = this->Target->GetProperty(defVarName.c_str()); + archs = this->Target->GetProperty(defVarName); } if(!archs) { @@ -1048,7 +1048,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "Headers"; @@ -1066,7 +1066,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "PrivateHeaders"; @@ -1083,7 +1083,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "Resources"; diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 5aaf1c63c..e88f498b7 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -66,14 +66,14 @@ bool cmGetCMakePropertyCommand else { const char *prop = - this->Makefile->GetCMakeInstance()->GetProperty(args[1].c_str()); + this->Makefile->GetCMakeInstance()->GetProperty(args[1]); if (prop) { output = prop; } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 9e76e1bc3..fcc3da16e 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -54,7 +54,7 @@ bool cmGetDirectoryPropertyCommand // lookup the makefile from the directory name cmLocalGenerator *lg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - FindLocalGenerator(sd.c_str()); + FindLocalGenerator(sd); if (!lg) { this->SetError @@ -79,18 +79,18 @@ bool cmGetDirectoryPropertyCommand "providing the name of the variable to get."); return false; } - output = dir->GetSafeDefinition(i->c_str()); - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + output = dir->GetSafeDefinition(*i); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } - const char *prop = dir->GetProperty(i->c_str()); + const char *prop = dir->GetProperty(*i); if (prop) { - this->Makefile->AddDefinition(variable.c_str(), prop); + this->Makefile->AddDefinition(variable, prop); return true; } - this->Makefile->AddDefinition(variable.c_str(), ""); + this->Makefile->AddDefinition(variable, ""); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 1d7fefcee..10406d2d0 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -26,7 +26,7 @@ bool cmGetFilenameComponentCommand // already, if so use that value if(args.size() == 4 && args[3] == "CACHE") { - const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); + const char* cacheValue = this->Makefile->GetDefinition(args[0]); if(cacheValue && !cmSystemTools::IsNOTFOUND(cacheValue)) { return true; @@ -107,7 +107,7 @@ bool cmGetFilenameComponentCommand else { std::string err = "unknown component " + args[2]; - this->SetError(err.c_str()); + this->SetError(err); return false; } @@ -116,12 +116,12 @@ bool cmGetFilenameComponentCommand if(programArgs.size() && storeArgs.size()) { this->Makefile->AddCacheDefinition - (storeArgs.c_str(), programArgs.c_str(), + (storeArgs, programArgs.c_str(), "", args[2] == "PATH" ? cmCacheManager::FILEPATH : cmCacheManager::STRING); } this->Makefile->AddCacheDefinition - (args[0].c_str(), result.c_str(), "", + (args[0], result.c_str(), "", args[2] == "PATH" ? cmCacheManager::FILEPATH : cmCacheManager::STRING); } @@ -129,9 +129,9 @@ bool cmGetFilenameComponentCommand { if(programArgs.size() && storeArgs.size()) { - this->Makefile->AddDefinition(storeArgs.c_str(), programArgs.c_str()); + this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); } - this->Makefile->AddDefinition(args[0].c_str(), result.c_str()); + this->Makefile->AddDefinition(args[0], result.c_str()); } return true; diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 30bec1604..6dd40c921 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -73,7 +73,7 @@ bool cmGetPropertyCommand e << "given invalid scope " << args[1] << ". " << "Valid scopes are " << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -120,7 +120,7 @@ bool cmGetPropertyCommand { cmOStringStream e; e << "given invalid argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -139,7 +139,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); } @@ -147,7 +147,7 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutFullDoc) { @@ -155,7 +155,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); } @@ -163,19 +163,19 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutDefined) { // Lookup if the property is defined if(this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { - this->Makefile->AddDefinition(this->Variable.c_str(), "1"); + this->Makefile->AddDefinition(this->Variable, "1"); } else { - this->Makefile->AddDefinition(this->Variable.c_str(), "0"); + this->Makefile->AddDefinition(this->Variable, "0"); } } else @@ -204,17 +204,17 @@ bool cmGetPropertyCommand::StoreResult(const char* value) { if(this->InfoType == OutSet) { - this->Makefile->AddDefinition(this->Variable.c_str(), value? "1":"0"); + this->Makefile->AddDefinition(this->Variable, value? "1":"0"); } else // if(this->InfoType == OutValue) { if(value) { - this->Makefile->AddDefinition(this->Variable.c_str(), value); + this->Makefile->AddDefinition(this->Variable, value); } else { - this->Makefile->RemoveDefinition(this->Variable.c_str()); + this->Makefile->RemoveDefinition(this->Variable); } } return true; @@ -231,7 +231,7 @@ bool cmGetPropertyCommand::HandleGlobalMode() // Get the property. cmake* cm = this->Makefile->GetCMakeInstance(); - return this->StoreResult(cm->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(cm->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -259,7 +259,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str()))) + ->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); @@ -276,7 +276,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } // Get the property. - return this->StoreResult(mf->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(mf->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -302,14 +302,14 @@ bool cmGetPropertyCommand::HandleTargetMode() } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(target->GetProperty(this->PropertyName)); } else { cmOStringStream e; e << "could not find TARGET " << this->Name << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -325,17 +325,17 @@ bool cmGetPropertyCommand::HandleSourceMode() // Get the source file. if(cmSourceFile* sf = - this->Makefile->GetOrCreateSource(this->Name.c_str())) + this->Makefile->GetOrCreateSource(this->Name)) { return - this->StoreResult(sf->GetPropertyForUser(this->PropertyName.c_str())); + this->StoreResult(sf->GetPropertyForUser(this->PropertyName)); } else { cmOStringStream e; e << "given SOURCE name that could not be found or created: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -350,15 +350,15 @@ bool cmGetPropertyCommand::HandleTestMode() } // Loop over all tests looking for matching names. - if(cmTest* test = this->Makefile->GetTest(this->Name.c_str())) + if(cmTest* test = this->Makefile->GetTest(this->Name)) { - return this->StoreResult(test->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(test->GetProperty(this->PropertyName)); } // If not found it is an error. cmOStringStream e; e << "given TEST name that does not exist: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -372,7 +372,7 @@ bool cmGetPropertyCommand::HandleVariableMode() } return this->StoreResult - (this->Makefile->GetDefinition(this->PropertyName.c_str())); + (this->Makefile->GetDefinition(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -389,7 +389,7 @@ bool cmGetPropertyCommand::HandleCacheMode() this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); if(!it.IsAtEnd()) { - value = it.GetProperty(this->PropertyName.c_str()); + value = it.GetProperty(this->PropertyName); } this->StoreResult(value); return true; diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index a6e4fcce6..8a96289b4 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -38,7 +38,7 @@ bool cmGetSourceFilePropertyCommand this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } - const char *prop = sf->GetPropertyForUser(args[2].c_str()); + const char *prop = sf->GetPropertyForUser(args[2]); if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index b64f84752..e3ec0bcd3 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -20,7 +20,7 @@ bool cmGetTargetPropertyCommand this->SetError("called with incorrect number of arguments"); return false; } - std::string var = args[0].c_str(); + std::string var = args[0]; const std::string& targetName = args[1]; std::string prop; @@ -38,7 +38,7 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - const char* prop_cstr = target.GetProperty(args[2].c_str()); + const char* prop_cstr = target.GetProperty(args[2]); if(prop_cstr) { prop = prop_cstr; @@ -67,7 +67,7 @@ bool cmGetTargetPropertyCommand { e << "get_target_property() called with non-existent target \"" << targetName << "\"."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -76,10 +76,10 @@ bool cmGetTargetPropertyCommand } if (!prop.empty()) { - this->Makefile->AddDefinition(var.c_str(), prop.c_str()); + this->Makefile->AddDefinition(var, prop.c_str()); return true; } - this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); + this->Makefile->AddDefinition(var, (var+"-NOTFOUND").c_str()); return true; } diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index 0e0e2c09b..b3df4c3bc 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -26,17 +26,17 @@ bool cmGetTestPropertyCommand std::string testName = args[0]; std::string var = args[2]; - cmTest *test = this->Makefile->GetTest(testName.c_str()); + cmTest *test = this->Makefile->GetTest(testName); if (test) { - const char *prop = test->GetProperty(args[1].c_str()); + const char *prop = test->GetProperty(args[1]); if (prop) { - this->Makefile->AddDefinition(var.c_str(), prop); + this->Makefile->AddDefinition(var, prop); return true; } } - this->Makefile->AddDefinition(var.c_str(), "NOTFOUND"); + this->Makefile->AddDefinition(var, "NOTFOUND"); return true; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index faed66a21..b67da5bd6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -123,7 +123,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, langComp += lang; langComp += "_COMPILER"; - if(!mf->GetDefinition(langComp.c_str())) + if(!mf->GetDefinition(langComp)) { if(!optional) { @@ -132,7 +132,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, } return; } - const char* name = mf->GetRequiredDefinition(langComp.c_str()); + const char* name = mf->GetRequiredDefinition(langComp); std::string path; if(!cmSystemTools::FileIsFullPath(name)) { @@ -150,7 +150,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, std::string doc = lang; doc += " compiler."; const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetCacheValue(langComp.c_str()); + GetCacheManager()->GetCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -185,7 +185,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, changeVars.c_str()); } } - mf->AddCacheDefinition(langComp.c_str(), path.c_str(), + mf->AddCacheDefinition(langComp, path.c_str(), doc.c_str(), cmCacheManager::FILEPATH); } @@ -457,7 +457,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string loadedLang = "CMAKE_"; loadedLang += lang; loadedLang += "_COMPILER_LOADED"; - if(!mf->GetDefinition(loadedLang.c_str())) + if(!mf->GetDefinition(loadedLang)) { fpath = rootBin; fpath += "/CMake"; @@ -518,9 +518,9 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string compilerEnv = "CMAKE_"; compilerEnv += lang; compilerEnv += "_COMPILER_ENV_VAR"; - std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str()); + std::string envVar = mf->GetRequiredDefinition(compilerEnv); std::string envVarValue = - mf->GetRequiredDefinition(compilerName.c_str()); + mf->GetRequiredDefinition(compilerName); std::string env = envVar; env += "="; env += envVarValue; @@ -578,7 +578,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, compilerEnv += lang; compilerEnv += "_COMPILER_ENV_VAR"; cmOStringStream noCompiler; - const char* compilerFile = mf->GetDefinition(compilerName.c_str()); + const char* compilerFile = mf->GetDefinition(compilerName); if(!compilerFile || !*compilerFile || cmSystemTools::IsNOTFOUND(compilerFile)) { @@ -621,7 +621,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if(!this->CMakeInstance->GetIsInTryCompile()) { this->PrintCompilerAdvice(noCompiler, lang, - mf->GetDefinition(compilerEnv.c_str())); + mf->GetDefinition(compilerEnv)); mf->IssueMessage(cmake::FATAL_ERROR, noCompiler.str()); fatalError = true; } @@ -631,7 +631,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string langLoadedVar = "CMAKE_"; langLoadedVar += lang; langLoadedVar += "_INFORMATION_LOADED"; - if (!mf->GetDefinition(langLoadedVar.c_str())) + if (!mf->GetDefinition(langLoadedVar)) { fpath = "CMake"; fpath += lang; @@ -678,7 +678,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // if the compiler did not work, then remove the // CMake(LANG)Compiler.cmake file so that it will get tested the // next time cmake is run - if(!mf->IsOn(compilerWorks.c_str())) + if(!mf->IsOn(compilerWorks)) { std::string compilerLangFile = rootBin; compilerLangFile += "/CMake"; @@ -693,7 +693,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, sharedLibFlagsVar += lang; sharedLibFlagsVar += "_FLAGS"; const char* sharedLibFlags = - mf->GetSafeDefinition(sharedLibFlagsVar.c_str()); + mf->GetSafeDefinition(sharedLibFlagsVar); if (sharedLibFlags) { this->LanguageToOriginalSharedLibFlags[lang] = sharedLibFlags; @@ -753,7 +753,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const { std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; - const char* compilerId = mf->GetDefinition(compilerIdVar.c_str()); + const char* compilerId = mf->GetDefinition(compilerIdVar); if(!compilerId) { return; @@ -776,7 +776,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } case cmPolicies::OLD: // OLD behavior is to convert AppleClang to Clang. - mf->AddDefinition(compilerIdVar.c_str(), "Clang"); + mf->AddDefinition(compilerIdVar, "Clang"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -807,7 +807,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } case cmPolicies::OLD: // OLD behavior is to convert QCC to GNU. - mf->AddDefinition(compilerIdVar.c_str(), "GNU"); + mf->AddDefinition(compilerIdVar, "GNU"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -917,7 +917,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string linkerPrefVar = std::string("CMAKE_") + std::string(l) + std::string("_LINKER_PREFERENCE"); - const char* linkerPref = mf->GetDefinition(linkerPrefVar.c_str()); + const char* linkerPref = mf->GetDefinition(linkerPrefVar); int preference = 0; if(linkerPref) { @@ -950,7 +950,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string outputExtensionVar = std::string("CMAKE_") + std::string(l) + std::string("_OUTPUT_EXTENSION"); - const char* outputExtension = mf->GetDefinition(outputExtensionVar.c_str()); + const char* outputExtension = mf->GetDefinition(outputExtensionVar); if(outputExtension) { this->LanguageToOutputExtension[l] = outputExtension; @@ -968,7 +968,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string ignoreExtensionsVar = std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS"); - std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar.c_str()); + std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar); std::vector extensionList; cmSystemTools::ExpandListArgument(ignoreExts, extensionList); for(std::vector::iterator i = extensionList.begin(); @@ -984,7 +984,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, { std::string extensionsVar = std::string("CMAKE_") + std::string(l) + std::string("_SOURCE_FILE_EXTENSIONS"); - std::string exts = mf->GetSafeDefinition(extensionsVar.c_str()); + std::string exts = mf->GetSafeDefinition(extensionsVar); std::vector extensionList; cmSystemTools::ExpandListArgument(exts, extensionList); for(std::vector::iterator i = extensionList.begin(); @@ -1389,8 +1389,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(*ci); - t->AppendProperty(defPropName.c_str(), - mf->GetProperty(defPropName.c_str())); + t->AppendProperty(defPropName, + mf->GetProperty(defPropName)); } } } @@ -1572,7 +1572,7 @@ void cmGlobalGenerator::CheckLocalGenerators() std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions); - cmSystemTools::ExpandListArgument(incDirs.c_str(), incs); + cmSystemTools::ExpandListArgument(incDirs, incs); for( std::vector::const_iterator incDir = incs.begin(); incDir != incs.end(); ++incDir) @@ -1665,7 +1665,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, std::string config = mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, - newTarget.c_str(), + newTarget, output,"",config,false,fast, this->TryCompileTimeout); } @@ -2115,7 +2115,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const return true; } - if(cmTarget* tgt = this->FindTarget(libname.c_str())) + if(cmTarget* tgt = this->FindTarget(libname)) { if(tgt->IsFrameworkOnApple()) { @@ -2325,7 +2325,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { ostr << "Only default component available"; } - singleLine.push_back(ostr.str().c_str()); + singleLine.push_back(ostr.str()); (*targets)["list_install_components"] = this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), @@ -2356,7 +2356,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) // automatically convert this name to the build-time location. cmd = "cmake"; } - singleLine.push_back(cmd.c_str()); + singleLine.push_back(cmd); if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) { std::string cfgArg = "-DBUILD_TYPE="; @@ -2494,7 +2494,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( std::vector::iterator dit; for ( dit = depends.begin(); dit != depends.end(); ++ dit ) { - target.AddUtility(dit->c_str()); + target.AddUtility(*dit); } // Organize in the "predefined targets" folder: @@ -2754,7 +2754,7 @@ cmGlobalGenerator::AddRuleHash(const std::vector& outputs, // Shorten the output name (in expected use case). cmLocalGenerator* lg = this->GetLocalGenerators()[0]; - std::string fname = lg->Convert(outputs[0].c_str(), + std::string fname = lg->Convert(outputs[0], cmLocalGenerator::HOME_OUTPUT); // Associate the hash with this output. diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 71e08cc1a..2e856ba8e 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -183,7 +183,7 @@ bool cmGlobalKdevelopGenerator (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash())==0)) { - files.insert(tmp.c_str()); + files.insert(tmp); } } } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 785b9029c..0a05f5a3e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1159,7 +1159,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { WriteRule(*this->RulesFileStream, "CLEAN", - (ninjaCmd() + " -t clean").c_str(), + ninjaCmd() + " -t clean", "Cleaning all built files...", "Rule for cleaning all built files.", /*depfile=*/ "", @@ -1182,7 +1182,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) { WriteRule(*this->RulesFileStream, "HELP", - (ninjaCmd() + " -t targets").c_str(), + ninjaCmd() + " -t targets", "All primary targets available:", "Rule for printing all primary targets available.", /*depfile=*/ "", diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 2cdc97675..4a19c0c97 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -356,14 +356,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "# The top level Makefile was generated from the following files:\n" << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" - << lg->Convert(cache.c_str(), + << lg->Convert(cache, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; for(std::vector::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" - << lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str() + << lg->Convert(*i, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; } cmakefileStream @@ -379,10 +379,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "# The corresponding makefile is:\n" << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" - << lg->Convert(makefileName.c_str(), + << lg->Convert(makefileName, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" << " \"" - << lg->Convert(check.c_str(), + << lg->Convert(check, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; cmakefileStream << " )\n\n"; @@ -397,7 +397,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() k != outfiles.end(); ++k) { cmakefileStream << " \"" << - lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n"; } @@ -411,7 +411,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << - lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n"; } cmakefileStream << " )\n\n"; @@ -494,7 +494,7 @@ cmGlobalUnixMakefileGenerator3 if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))) + ->NeedRelinkBeforeInstall(lg->ConfigurationName))) { std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); tname += "/"; @@ -530,7 +530,7 @@ cmGlobalUnixMakefileGenerator3 doc += "\" pass in the directory."; std::vector no_commands; lg->WriteMakeRule(ruleFileStream, doc.c_str(), - makeTarget.c_str(), depends, no_commands, true); + makeTarget, depends, no_commands, true); } //---------------------------------------------------------------------------- @@ -547,7 +547,7 @@ cmGlobalUnixMakefileGenerator3 // Begin the directory-level rules section. std::string dir = lg->GetMakefile()->GetStartOutputDirectory(); - dir = lg->Convert(dir.c_str(), cmLocalGenerator::HOME_OUTPUT, + dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); lg->WriteDivider(ruleFileStream); ruleFileStream @@ -612,7 +612,7 @@ void cmGlobalUnixMakefileGenerator3 { tname += "/fast"; } - tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT); + tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); if (!this->LocalGenerators.size()) @@ -697,14 +697,14 @@ cmGlobalUnixMakefileGenerator3 localName = name; localName += "/fast"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "fast build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a local name for the rule to relink the target before // installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(lg->ConfigurationName)) { makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName += "/preinstall"; @@ -713,10 +713,10 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); } } } @@ -778,7 +778,7 @@ cmGlobalUnixMakefileGenerator3 makeTargetName = localName; makeTargetName += "/depend"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); // add requires if we need it for this generator if (needRequiresStep) @@ -786,12 +786,12 @@ cmGlobalUnixMakefileGenerator3 makeTargetName = localName; makeTargetName += "/requires"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); } makeTargetName = localName; makeTargetName += "/build"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); // Write the rule. localName += "/all"; @@ -804,7 +804,7 @@ cmGlobalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; // all target counts - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " "; @@ -823,7 +823,7 @@ cmGlobalUnixMakefileGenerator3 this->AppendGlobalTargetDepends(depends,*gtarget->Target); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // add the all/all dependency if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) @@ -845,7 +845,7 @@ cmGlobalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # in target - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // @@ -857,11 +857,11 @@ cmGlobalUnixMakefileGenerator3 std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall - (tmp.c_str(),localName.c_str())); + (tmp.c_str(),localName)); { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " 0"; @@ -873,7 +873,7 @@ cmGlobalUnixMakefileGenerator3 localName += "/rule"; lg->WriteMakeRule(ruleFileStream, "Build rule for subdir invocation for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a target with the canonical name (no prefix, suffix or path). commands.clear(); @@ -884,17 +884,17 @@ cmGlobalUnixMakefileGenerator3 // Add rules to prepare the target for installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(lg->ConfigurationName)) { localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/preinstall"; depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), localName.c_str())); + (makefileName.c_str(), localName)); lg->WriteMakeRule(ruleFileStream, "Pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { @@ -913,9 +913,9 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "clean rule for target.", - makeTargetName.c_str(), depends, commands, true); + makeTargetName, depends, commands, true); commands.clear(); depends.push_back(makeTargetName); lg->WriteMakeRule(ruleFileStream, "clean rule for target.", @@ -1121,7 +1121,7 @@ bool cmGlobalUnixMakefileGenerator3 std::string var = "CMAKE_NEEDS_REQUIRES_STEP_"; var += *l; var += "_FLAG"; - if(target.GetMakefile()->GetDefinition(var.c_str())) + if(target.GetMakefile()->GetDefinition(var)) { return true; } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 22cba899b..824e9e746 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -192,7 +192,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) std::cout << "Writing " << currentFilename << "..." << std::endl; this->WriteHeader(str); - this->WriteDependerConnections(ptrIt->first.c_str(), + this->WriteDependerConnections(ptrIt->first, insertedNodes, insertedConnections, str); this->WriteFooter(str); @@ -241,7 +241,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) std::cout << "Writing " << currentFilename << "..." << std::endl; this->WriteHeader(str); - this->WriteConnections(ptrIt->first.c_str(), + this->WriteConnections(ptrIt->first, insertedNodes, insertedConnections, str); this->WriteFooter(str); } @@ -280,7 +280,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) continue; } - this->WriteConnections(ptrIt->first.c_str(), + this->WriteConnections(ptrIt->first, insertedNodes, insertedConnections, str); } this->WriteFooter(str); @@ -407,7 +407,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, llit != ll->end(); ++ llit ) { - std::string libName = llit->first.c_str(); + std::string libName = llit->first; if (libName == targetName) { // So this target links against targetName. @@ -424,13 +424,13 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, insertedConnections.end()) { insertedConnections.insert(connectionName); - this->WriteNode(dependerIt->first.c_str(), dependerIt->second, + this->WriteNode(dependerIt->first, dependerIt->second, insertedNodes, str); str << " \"" << dependerNodeNameIt->second << "\" -> \"" << myNodeName << "\""; str << " // " < " <first<WriteDependerConnections(dependerIt->first.c_str(), + this->WriteDependerConnections(dependerIt->first, insertedNodes, insertedConnections, str); } diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index bd123275c..06c4b8993 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -26,7 +26,7 @@ static std::string cmIfCommandError( i != args.end(); ++i) { err += " "; - err += lg->EscapeForCMake(i->c_str()); + err += lg->EscapeForCMake(*i); } err += "\n"; return err; @@ -199,7 +199,7 @@ bool cmIfCommand err += errorString; if (status == cmake::FATAL_ERROR) { - this->SetError(err.c_str()); + this->SetError(err); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -261,7 +261,7 @@ namespace } // Check definition. - const char* def = mf->GetDefinition(arg.c_str()); + const char* def = mf->GetDefinition(arg); return !cmSystemTools::IsOff(def); } @@ -277,12 +277,12 @@ namespace else if(arg == "1") { return true; } else - { return !cmSystemTools::IsOff(mf->GetDefinition(arg.c_str())); } + { return !cmSystemTools::IsOff(mf->GetDefinition(arg)); } } else { // Old GetVariableOrNumber behavior. - const char* def = mf->GetDefinition(arg.c_str()); + const char* def = mf->GetDefinition(arg); if(!def && atoi(arg.c_str())) { def = arg.c_str(); @@ -559,7 +559,7 @@ namespace } else { - bdef = makefile->IsDefinitionSet((argP1)->c_str()); + bdef = makefile->IsDefinitionSet(*(argP1)); } HandlePredicate(bdef, reducible, arg, newArgs, argP1, argP2); } diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index e8ee33fd3..4d9935c59 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -65,7 +65,7 @@ bool cmIncludeCommand { std::string errorText = "called with invalid argument: "; errorText += args[i]; - this->SetError(errorText.c_str()); + this->SetError(errorText); return false; } } @@ -121,7 +121,7 @@ bool cmIncludeCommand "command. It " << modal << " not be used as the argument to the " "include() command. Use ALIAS targets instead to refer to targets " "by alternative names.\n"; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -139,7 +139,7 @@ bool cmIncludeCommand // add the location of the included file if a result variable was given if (resultVarName.size()) { - this->Makefile->AddDefinition(resultVarName.c_str(), + this->Makefile->AddDefinition(resultVarName, readit?fullFilePath.c_str():"NOTFOUND"); } @@ -149,7 +149,7 @@ bool cmIncludeCommand "could not find load file:\n" " "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } return true; diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx index ef6e8c6ae..d6dfdd2a3 100644 --- a/Source/cmIncludeRegularExpressionCommand.cxx +++ b/Source/cmIncludeRegularExpressionCommand.cxx @@ -24,7 +24,7 @@ bool cmIncludeRegularExpressionCommand if(args.size() > 1) { - this->Makefile->SetComplainRegularExpression(args[1].c_str()); + this->Makefile->SetComplainRegularExpression(args[1]); } return true; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 94d20913f..0041122bf 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -99,7 +99,7 @@ bool cmInstallCommand::InitialPass(std::vector const& args, // Unknown mode. std::string e = "called with unknown mode "; e += args[0]; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -269,7 +269,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // Unknown argument. cmOStringStream e; e << "TARGETS given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -370,7 +370,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is an alias."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Lookup this target in the current directory. @@ -387,7 +387,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is not an executable, library, or module."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } else if(target->GetType() == cmTarget::OBJECT_LIBRARY) @@ -395,7 +395,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given OBJECT library \"" << (*targetIt) << "\" which may not be installed."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the target in the list to be installed. @@ -407,7 +407,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which does not exist in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -499,7 +499,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no FRAMEWORK DESTINATION for shared library " "FRAMEWORK target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -519,7 +519,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for shared library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -539,7 +539,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no ARCHIVE DESTINATION for static library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -560,7 +560,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for module target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -595,7 +595,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE " "executable target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -612,7 +612,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) cmOStringStream e; e << "TARGETS given no RUNTIME DESTINATION for executable " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -851,7 +851,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -866,7 +866,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) // The rename option works only with one file. cmOStringStream e; e << args[0] << " given RENAME option with more than one file."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -886,7 +886,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -927,7 +927,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -941,7 +941,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -969,7 +969,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } literal_args += " EXCLUDE"; @@ -982,7 +982,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -997,7 +997,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1011,7 +1011,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1025,7 +1025,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1040,7 +1040,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1055,7 +1055,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1069,7 +1069,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1094,7 +1094,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " given non-directory \"" << args[i] << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1150,7 +1150,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " given invalid file permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1162,7 +1162,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " given invalid directory permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1174,7 +1174,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) cmOStringStream e; e << args[0] << " given invalid permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1183,7 +1183,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1204,7 +1204,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1247,7 +1247,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1262,7 +1262,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1274,7 +1274,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument may not contain a path. " << "Specify the path in the DESTINATION argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1285,7 +1285,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) cmOStringStream e; e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument must specify a name ending in \".cmake\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1302,7 +1302,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1327,7 +1327,7 @@ bool cmInstallCommand::HandleExportMode(std::vector const& args) << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \"" << te->Target->GetName() << "\" does not have policy CMP0022 set to NEW."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1368,7 +1368,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, { cmOStringStream e; e << modeName << " given directory \"" << (*fileIt) << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the file for installation. diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index d2737a1e7..9a17052e6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -94,7 +94,7 @@ void cmInstallExportGenerator::ComputeTempDir() { // Replace the destination path with a hash to keep it short. this->TempDir += - cmSystemTools::ComputeStringMD5(this->Destination.c_str()); + cmSystemTools::ComputeStringMD5(this->Destination); } else { @@ -138,7 +138,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) // Generate the import file for this export set. this->EFGen->SetExportFile(this->MainImportFile.c_str()); - this->EFGen->SetNamespace(this->Namespace.c_str()); + this->EFGen->SetNamespace(this->Namespace); this->EFGen->SetExportOld(this->ExportOld); if(this->ConfigurationTypes->empty()) { @@ -157,7 +157,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) ci = this->ConfigurationTypes->begin(); ci != this->ConfigurationTypes->end(); ++ci) { - this->EFGen->AddConfiguration(ci->c_str()); + this->EFGen->AddConfiguration(*ci); } } this->EFGen->GenerateImportFile(); @@ -182,7 +182,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, i != this->EFGen->GetConfigImportFiles().end(); ++i) { files.push_back(i->second); - std::string config_test = this->CreateConfigTest(i->first.c_str()); + std::string config_test = this->CreateConfigTest(i->first); os << indent << "if(" << config_test << ")\n"; this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 488d4863b..7eabbef07 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -100,9 +100,9 @@ void cmInstallFilesCommand::FinalPass() else // reg exp list { std::vector files; - std::string regex = this->FinalArgs[0].c_str(); + std::string regex = this->FinalArgs[0]; cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), - regex.c_str(), files); + regex, files); std::vector::iterator s = files.begin(); // for each argument, get the files diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 54d903ae6..597f7eede 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -68,7 +68,7 @@ void cmInstallProgramsCommand::FinalPass() { std::vector programs; cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), - this->FinalArgs[0].c_str(), programs); + this->FinalArgs[0], programs); std::vector::iterator s = programs.begin(); // for each argument, get the programs diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 277ccea43..b738844a1 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -52,7 +52,7 @@ bool cmInstallTargetsCommand else { std::string str = "Cannot find target: \"" + *s + "\" to install."; - this->SetError(str.c_str()); + this->SetError(str); return false; } } diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 4412414a4..3644d93f2 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -66,5 +66,5 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) unixPath = tmp; } } - this->Makefile->AddLinkDirectory(unixPath.c_str()); + this->Makefile->AddLinkDirectory(unixPath); } diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 2f1db2aa0..996b5382f 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -33,7 +33,7 @@ bool cmLinkLibrariesCommand "a library"); return false; } - this->Makefile->AddLinkLibrary(i->c_str(), + this->Makefile->AddLinkLibrary(*i, cmTarget::DEBUG); } else if (*i == "optimized") @@ -45,12 +45,12 @@ bool cmLinkLibrariesCommand "a library"); return false; } - this->Makefile->AddLinkLibrary(i->c_str(), + this->Makefile->AddLinkLibrary(*i, cmTarget::OPTIMIZED); } else { - this->Makefile->AddLinkLibrary(i->c_str()); + this->Makefile->AddLinkLibrary(*i); } } diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 20e760a8c..f1ea08820 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -69,7 +69,7 @@ bool cmListCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -176,12 +176,12 @@ bool cmListCommand::HandleLengthCommand(std::vector const& args) // do not check the return value here // if the list var is not found varArgsExpanded will have size 0 // and we will return 0 - this->GetList(varArgsExpanded, listName.c_str()); + this->GetList(varArgsExpanded, listName); size_t length = varArgsExpanded.size(); char buffer[1024]; sprintf(buffer, "%d", static_cast(length)); - this->Makefile->AddDefinition(variableName.c_str(), buffer); + this->Makefile->AddDefinition(variableName, buffer); return true; } @@ -198,9 +198,9 @@ bool cmListCommand::HandleGetCommand(std::vector const& args) const std::string& variableName = args[args.size() - 1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { - this->Makefile->AddDefinition(variableName.c_str(), "NOTFOUND"); + this->Makefile->AddDefinition(variableName, "NOTFOUND"); return true; } // FIXME: Add policy to make non-existing lists an error like empty lists. @@ -229,13 +229,13 @@ bool cmListCommand::HandleGetCommand(std::vector const& args) str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } value += varArgsExpanded[item]; } - this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + this->Makefile->AddDefinition(variableName, value.c_str()); return true; } @@ -253,7 +253,7 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) const std::string& listName = args[1]; // expand the variable std::string listString; - this->GetListString(listString, listName.c_str()); + this->GetListString(listString, listName); size_t cc; for ( cc = 2; cc < args.size(); ++ cc ) { @@ -264,7 +264,7 @@ bool cmListCommand::HandleAppendCommand(std::vector const& args) listString += args[cc]; } - this->Makefile->AddDefinition(listName.c_str(), listString.c_str()); + this->Makefile->AddDefinition(listName, listString.c_str()); return true; } @@ -281,9 +281,9 @@ bool cmListCommand::HandleFindCommand(std::vector const& args) const std::string& variableName = args[args.size() - 1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { - this->Makefile->AddDefinition(variableName.c_str(), "-1"); + this->Makefile->AddDefinition(variableName, "-1"); return true; } @@ -295,13 +295,13 @@ bool cmListCommand::HandleFindCommand(std::vector const& args) { char indexString[32]; sprintf(indexString, "%d", index); - this->Makefile->AddDefinition(variableName.c_str(), indexString); + this->Makefile->AddDefinition(variableName, indexString); return true; } index++; } - this->Makefile->AddDefinition(variableName.c_str(), "-1"); + this->Makefile->AddDefinition(variableName, "-1"); return true; } @@ -319,12 +319,12 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) // expand the variable int item = atoi(args[2].c_str()); std::vector varArgsExpanded; - if((!this->GetList(varArgsExpanded, listName.c_str()) + if((!this->GetList(varArgsExpanded, listName) || varArgsExpanded.empty()) && item != 0) { cmOStringStream str; str << "index: " << item << " out of range (0, 0)"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } @@ -341,7 +341,7 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << (varArgsExpanded.size() == 0?0:(varArgsExpanded.size()-1)) << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } } @@ -362,7 +362,7 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -379,7 +379,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REMOVE_ITEM requires list to be present."); return false; @@ -411,7 +411,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -430,7 +430,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REVERSE requires list to be present."); return false; @@ -446,7 +446,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -465,7 +465,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError( "sub-command REMOVE_DUPLICATES requires list to be present."); @@ -491,7 +491,7 @@ bool cmListCommand } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -510,7 +510,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command SORT requires list to be present."); return false; @@ -528,7 +528,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -546,7 +546,7 @@ bool cmListCommand::HandleRemoveAtCommand( const std::string& listName = args[1]; // expand the variable std::vector varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REMOVE_AT requires list to be present."); return false; @@ -574,7 +574,7 @@ bool cmListCommand::HandleRemoveAtCommand( str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } removed.push_back(static_cast(item)); @@ -602,7 +602,7 @@ bool cmListCommand::HandleRemoveAtCommand( } } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 7461d375a..34781d32c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -397,12 +397,12 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, << "Argument not separated from preceding token by whitespace."; if(isError) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); return false; } else { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str().c_str()); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str()); return true; } } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 806d8212f..427e29df6 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -81,7 +81,7 @@ bool cmLoadCacheCommand { break; } - this->Makefile->GetCacheManager()->LoadCache(args[i].c_str(), false, + this->Makefile->GetCacheManager()->LoadCache(args[i], false, excludes, includes); } @@ -104,7 +104,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector const& args) if(!cmSystemTools::FileExists(cacheFile.c_str())) { std::string e = "Cannot load cache file from " + cacheFile; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -186,11 +186,11 @@ void cmLoadCacheCommand::CheckLine(const char* line) var = this->Prefix + var; if(value.length()) { - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } else { - this->Makefile->RemoveDefinition(var.c_str()); + this->Makefile->RemoveDefinition(var); } } } diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 36e9980a4..a4063a680 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -201,7 +201,7 @@ bool cmLoadCommandCommand // Start by removing the definition in case of failure. std::string reportVar = "CMAKE_LOADED_COMMAND_"; reportVar += args[0]; - this->Makefile->RemoveDefinition(reportVar.c_str()); + this->Makefile->RemoveDefinition(reportVar); // the file must exist std::string moduleName = @@ -219,7 +219,7 @@ bool cmLoadCommandCommand cmSystemTools::ExpandRegistryValues(exp); // Glob the entry in case of wildcards. - cmSystemTools::GlobDirs(exp.c_str(), path); + cmSystemTools::GlobDirs(exp, path); } // Try to find the program. @@ -229,7 +229,7 @@ bool cmLoadCommandCommand cmOStringStream e; e << "Attempt to load command failed from file \"" << moduleName << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -246,12 +246,12 @@ bool cmLoadCommandCommand err += " Additional error info is:\n"; err += error; } - this->SetError(err.c_str()); + this->SetError(err); return false; } // Report what file was loaded for this command. - this->Makefile->AddDefinition(reportVar.c_str(), fullPath.c_str()); + this->Makefile->AddDefinition(reportVar, fullPath.c_str()); // find the init function std::string initFuncName = args[0] + "Init"; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 761db489c..21957f9ef 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -325,7 +325,7 @@ void cmLocalGenerator::GenerateTestFiles() fout << "subdirs("; std::string outP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); - fout << this->Convert(outP.c_str(),START_OUTPUT); + fout << this->Convert(outP,START_OUTPUT); fout << ")" << std::endl; } } @@ -577,20 +577,20 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, cmGeneratorTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); - objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); + objectDir = this->Convert(objectDir,START_OUTPUT,SHELL); std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL); std::string sourceFile = - this->Convert(source.GetFullPath().c_str(),START_OUTPUT,SHELL,true); + this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true); std::string varString = "CMAKE_"; varString += lang; varString += "_COMPILE_OBJECT"; std::vector rules; - rules.push_back(this->Makefile->GetRequiredDefinition(varString.c_str())); + rules.push_back(this->Makefile->GetRequiredDefinition(varString)); varString = "CMAKE_"; varString += lang; varString += "_FLAGS"; std::string flags; - flags += this->Makefile->GetSafeDefinition(varString.c_str()); + flags += this->Makefile->GetSafeDefinition(varString); flags += " "; { std::vector includes; @@ -646,7 +646,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, this->Makefile->AddCustomCommandToOutput( ofname, depends, - source.GetFullPath().c_str(), + source.GetFullPath(), commandLines, comment.c_str(), this->Makefile->GetStartOutputDirectory() @@ -681,7 +681,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, objVector.push_back(ofname); this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target); - objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE); + objs += this->Convert(ofname,START_OUTPUT,MAKEFILE); objs += " "; } } @@ -718,7 +718,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmCustomCommandLines commandLines; std::vector rules; - rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str())); + rules.push_back(this->Makefile->GetRequiredDefinition(createRule)); std::vector commands; cmSystemTools::ExpandList(rules, commands); for(std::vector::iterator i = commands.begin(); @@ -743,9 +743,9 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string comment = "Linking "; comment += llang; comment += " target "; - comment += this->Convert(targetFullPath.c_str(), START_OUTPUT); + comment += this->Convert(targetFullPath, START_OUTPUT); this->Makefile->AddCustomCommandToOutput( - targetFullPath.c_str(), + targetFullPath, objVector, "", commandLines, @@ -753,7 +753,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->Makefile->GetStartOutputDirectory() ); target.Target->AddSourceFile - (this->Makefile->GetSource(targetFullPath.c_str())); + (this->Makefile->GetSource(targetFullPath)); } @@ -1081,28 +1081,28 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, { std::string arg1 = actualReplace + "_ARG1"; cmSystemTools::ReplaceString(arg1, "${LANG}", lang); - compilerArg1 = this->Makefile->GetDefinition(arg1.c_str()); + compilerArg1 = this->Makefile->GetDefinition(arg1); compilerTarget = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + "_COMPILER_TARGET").c_str()); + std::string("CMAKE_") + lang + "_COMPILER_TARGET"); compilerOptionTarget = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_TARGET").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_TARGET"); compilerExternalToolchain = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILER_EXTERNAL_TOOLCHAIN").c_str()); + std::string("CMAKE_") + lang + + "_COMPILER_EXTERNAL_TOOLCHAIN"); compilerOptionExternalToolchain = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN"); compilerSysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT"); compilerOptionSysroot = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_SYSROOT").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_SYSROOT"); } if(actualReplace.find("${LANG}") != actualReplace.npos) { @@ -1111,11 +1111,11 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, if(actualReplace == variable) { std::string replace = - this->Makefile->GetSafeDefinition(variable.c_str()); + this->Makefile->GetSafeDefinition(variable); // if the variable is not a FLAG then treat it like a path if(variable.find("_FLAG") == variable.npos) { - std::string ret = this->ConvertToOutputForExisting(replace.c_str()); + std::string ret = this->ConvertToOutputForExisting(replace); // if there is a required first argument to the compiler add it // to the compiler string if(compilerArg1) @@ -1243,7 +1243,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, std::string tmp; if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) { - return this->Convert(tmp.c_str(), NONE, format, true); + return this->Convert(tmp, NONE, format, true); } } @@ -1283,7 +1283,7 @@ std::string cmLocalGenerator::ConvertToIncludeReference(std::string const& path, OutputFormat format) { - return this->ConvertToOutputForExisting(path.c_str(), START_OUTPUT, format); + return this->ConvertToOutputForExisting(path, START_OUTPUT, format); } //---------------------------------------------------------------------------- @@ -1305,10 +1305,10 @@ std::string cmLocalGenerator::GetIncludeFlags( std::string flagVar = "CMAKE_INCLUDE_FLAG_"; flagVar += lang; const char* includeFlag = - this->Makefile->GetSafeDefinition(flagVar.c_str()); + this->Makefile->GetSafeDefinition(flagVar); flagVar = "CMAKE_INCLUDE_FLAG_SEP_"; flagVar += lang; - const char* sep = this->Makefile->GetDefinition(flagVar.c_str()); + const char* sep = this->Makefile->GetDefinition(flagVar); bool quotePaths = false; if(this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) { @@ -1334,14 +1334,14 @@ std::string cmLocalGenerator::GetIncludeFlags( const char* sysIncludeFlag = 0; if(repeatFlag) { - sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar.c_str()); + sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar); } std::string fwSearchFlagVar = "CMAKE_"; fwSearchFlagVar += lang; fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); bool flagUsed = false; std::set emitted; @@ -1360,7 +1360,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if(emitted.insert(frameworkDir).second) { includeFlags - << fwSearchFlag << this->Convert(frameworkDir.c_str(), + << fwSearchFlag << this->Convert(frameworkDir, START_OUTPUT, shellFormat, true) << " "; } @@ -1421,7 +1421,7 @@ void cmLocalGenerator::AddCompileOptions( { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; if(const char* langFlagRegexStr = - this->Makefile->GetDefinition(langFlagRegexVar.c_str())) + this->Makefile->GetDefinition(langFlagRegexVar)) { // Filter flags acceptable to this language. cmsys::RegularExpression r(langFlagRegexStr); @@ -1438,7 +1438,7 @@ void cmLocalGenerator::AddCompileOptions( { // (Re-)Escape this flag. COMPILE_FLAGS were already parsed // as a command line above, and COMPILE_OPTIONS are escaped. - this->AppendFlagEscape(flags, i->c_str()); + this->AppendFlagEscape(flags, *i); } } } @@ -1456,7 +1456,7 @@ void cmLocalGenerator::AddCompileOptions( i != opts.end(); ++i) { // COMPILE_OPTIONS are escaped. - this->AppendFlagEscape(flags, i->c_str()); + this->AppendFlagEscape(flags, *i); } } } @@ -1521,7 +1521,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector& dirs, std::string impDirVar = "CMAKE_"; impDirVar += lang; impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; - if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) + if(const char* value = this->Makefile->GetDefinition(impDirVar)) { std::vector impDirVec; cmSystemTools::ExpandListArgument(value, impDirVec); @@ -1596,13 +1596,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, if(!config.empty()) { std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config; - this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name.c_str())); + this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name)); } this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS")); if(!config.empty()) { std::string name = "STATIC_LIBRARY_FLAGS_" + config; - this->AppendFlags(flags, target->GetProperty(name.c_str())); + this->AppendFlags(flags, target->GetProperty(name)); } } @@ -1635,7 +1635,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string build = libraryLinkVariable; build += "_"; build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } if(this->Makefile->IsOn("WIN32") && @@ -1651,7 +1651,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += this->Convert(sf->GetFullPath().c_str(), + linkFlags += this->Convert(sf->GetFullPath(), FULL, SHELL); linkFlags += " "; } @@ -1667,7 +1667,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1687,7 +1687,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string build = "CMAKE_EXE_LINKER_FLAGS_"; build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } std::string linkLanguage = target->Target->GetLinkerLanguage(); @@ -1706,7 +1706,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") + linkLanguage + std::string("_FLAGS"); - linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(sFlagVar); linkFlags += " "; } if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") ) @@ -1728,7 +1728,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, exportFlagVar += "_FLAG"; linkFlags += - this->Makefile->GetSafeDefinition(exportFlagVar.c_str()); + this->Makefile->GetSafeDefinition(exportFlagVar); linkFlags += " "; } const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); @@ -1741,7 +1741,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1785,7 +1785,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, #endif // Normal behavior. - return this->Convert(lib.c_str(), START_OUTPUT, format); + return this->Convert(lib, START_OUTPUT, format); } /** @@ -1827,7 +1827,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, linkFlagsVar += "_FLAGS"; if( tgt.GetType() == cmTarget::EXECUTABLE ) { - linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar.c_str()); + linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar); linkLibs += " "; } @@ -1836,7 +1836,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, fwSearchFlagVar += linkLanguage; fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); if(fwSearchFlag && *fwSearchFlag) { std::vector const& fwDirs = cli.GetFrameworkPaths(); @@ -1844,7 +1844,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, fdi != fwDirs.end(); ++fdi) { frameworkPath += fwSearchFlag; - frameworkPath += this->Convert(fdi->c_str(), NONE, shellFormat, false); + frameworkPath += this->Convert(*fdi, NONE, shellFormat, false); frameworkPath += " "; } } @@ -1854,7 +1854,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, for(std::vector::const_iterator libDir = libDirs.begin(); libDir != libDirs.end(); ++libDir) { - std::string libpath = this->ConvertToOutputForExisting(libDir->c_str(), + std::string libpath = this->ConvertToOutputForExisting(*libDir, START_OUTPUT, shellFormat); linkPath += " " + libPathFlag; @@ -1899,7 +1899,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, ri != runtimeDirs.end(); ++ri) { rpath += cli.GetRuntimeFlag(); - rpath += this->Convert(ri->c_str(), NONE, shellFormat, false); + rpath += this->Convert(*ri, NONE, shellFormat, false); rpath += " "; } fout << rpath; @@ -1913,7 +1913,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!rpath.empty()) { fout << cli.GetRuntimeFlag(); - fout << this->EscapeForShell(rpath.c_str(), escapeAllowMakeVars); + fout << this->EscapeForShell(rpath, escapeAllowMakeVars); fout << " "; } } @@ -1923,7 +1923,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { fout << cli.GetRPathLinkFlag(); - fout << this->EscapeForShell(rpath_link.c_str(), escapeAllowMakeVars); + fout << this->EscapeForShell(rpath_link, escapeAllowMakeVars); fout << " "; } @@ -1932,7 +1932,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, standardLibsVar += cli.GetLinkLanguage(); standardLibsVar += "_STANDARD_LIBRARIES"; if(const char* stdLibs = - this->Makefile->GetDefinition(standardLibsVar.c_str())) + this->Makefile->GetDefinition(standardLibsVar)) { fout << stdLibs << " "; } @@ -1963,13 +1963,13 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, std::string sysrootFlagVar = std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; const char* sysrootFlag = - this->Makefile->GetDefinition(sysrootFlagVar.c_str()); + this->Makefile->GetDefinition(sysrootFlagVar); const char* deploymentTarget = this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); std::string deploymentTargetFlagVar = std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = - this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); + this->Makefile->GetDefinition(deploymentTargetFlagVar); if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F')) { for(std::vector::iterator i = archs.begin(); @@ -2008,7 +2008,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_FLAGS"; - this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); + this->AddConfigVariableFlags(flags, flagsVar, config); } //---------------------------------------------------------------------------- @@ -2124,7 +2124,7 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, flagsVar = "CMAKE_SHARED_LIBRARY_"; flagsVar += lang; flagsVar += "_FLAGS"; - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); } } @@ -2134,14 +2134,14 @@ static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, { std::string l(lang); std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY"; - const char *opt = lg->GetMakefile()->GetDefinition(compileOption.c_str()); + const char *opt = lg->GetMakefile()->GetDefinition(compileOption); if (!opt) { return; } std::string flagDefine = l + "_VISIBILITY_PRESET"; - const char *prop = target->GetProperty(flagDefine.c_str()); + const char *prop = target->GetProperty(flagDefine); if (!prop) { return; @@ -2167,7 +2167,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, { std::string compileOption = "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN"; - const char *opt = lg->GetMakefile()->GetDefinition(compileOption.c_str()); + const char *opt = lg->GetMakefile()->GetDefinition(compileOption); if (!opt) { return; @@ -2220,7 +2220,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, if (this->GetShouldUseOldFlags(shared, lang)) { - this->AddSharedFlags(flags, lang.c_str(), shared); + this->AddSharedFlags(flags, lang, shared); } else { @@ -2241,7 +2241,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, } if (shared) { - this->AppendFeatureOptions(flags, lang.c_str(), "DLL"); + this->AppendFeatureOptions(flags, lang, "DLL"); } } } @@ -2258,7 +2258,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, flagsVar += lang; flagsVar += "_FLAGS"; const char* flags = - this->Makefile->GetSafeDefinition(flagsVar.c_str()); + this->Makefile->GetSafeDefinition(flagsVar); if (flags && flags != originalFlags) { @@ -2303,14 +2303,14 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_COMPILE_OPTIONS_PIE"; - picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str()); + picFlags = this->Makefile->GetSafeDefinition(flagsVar); } if (!picFlags) { std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_COMPILE_OPTIONS_PIC"; - picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str()); + picFlags = this->Makefile->GetSafeDefinition(flagsVar); } if (picFlags) { @@ -2319,7 +2319,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, for(std::vector::const_iterator oi = options.begin(); oi != options.end(); ++oi) { - this->AppendFlagEscape(flags, oi->c_str()); + this->AppendFlagEscape(flags, *oi); } } } @@ -2331,13 +2331,13 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, { // Add the flags from the variable itself. std::string flagsVar = var; - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); // Add the flags from the build-type specific variable. if(!config.empty()) { flagsVar += "_"; flagsVar += cmSystemTools::UpperCase(config); - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); } } @@ -2407,7 +2407,7 @@ void cmLocalGenerator::JoinDefines(const std::set& defines, std::string defineFlagVar = "CMAKE_"; defineFlagVar += lang; defineFlagVar += "_DEFINE_FLAG"; - const char* df = this->Makefile->GetDefinition(defineFlagVar.c_str()); + const char* df = this->Makefile->GetDefinition(defineFlagVar); if(df && *df) { dflag = df; @@ -2468,14 +2468,14 @@ void cmLocalGenerator::AppendFeatureOptions( optVar += lang; optVar += "_COMPILE_OPTIONS_"; optVar += feature; - if(const char* optionList = this->Makefile->GetDefinition(optVar.c_str())) + if(const char* optionList = this->Makefile->GetDefinition(optVar)) { std::vector options; cmSystemTools::ExpandListArgument(optionList, options); for(std::vector::const_iterator oi = options.begin(); oi != options.end(); ++oi) { - this->AppendFlagEscape(flags, oi->c_str()); + this->AppendFlagEscape(flags, *oi); } } } @@ -2501,7 +2501,7 @@ cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, o != cc.GetOutputs().end(); ++o) { comment += sep; - comment += this->Convert(o->c_str(), cmLocalGenerator::START_OUTPUT); + comment += this->Convert(*o, cmLocalGenerator::START_OUTPUT); sep = ", "; } return comment; @@ -2556,24 +2556,24 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result.c_str()); + result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result.c_str()); + result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result.c_str()); + result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result.c_str()); + result); break; case FULL: result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2582,7 +2582,7 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; } } - return this->ConvertToOutputFormat(result.c_str(), output); + return this->ConvertToOutputFormat(result, output); } //---------------------------------------------------------------------------- @@ -2617,11 +2617,11 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, pos++; } } - result = this->EscapeForShell(result.c_str(), true, false); + result = this->EscapeForShell(result, true, false); } else if(output == RESPONSE) { - result = this->EscapeForShell(result.c_str(), false, false); + result = this->EscapeForShell(result, false, false); } return result; } @@ -2642,7 +2642,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, std::vector components; cmSystemTools::SplitPath(local.c_str(), components); std::string result = this->ConvertToRelativePath(components, remotePath); - return this->ConvertToOutputFormat(result.c_str(), output); + return this->ConvertToOutputFormat(result, output); } else { @@ -3150,7 +3150,7 @@ cmLocalGenerator std::string repVar = "CMAKE_"; repVar += lang; repVar += "_OUTPUT_EXTENSION_REPLACE"; - replaceExt = this->Makefile->IsOn(repVar.c_str()); + replaceExt = this->Makefile->IsOn(repVar); } } @@ -3175,7 +3175,7 @@ cmLocalGenerator } // Convert to a safe name. - return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_max); + return this->CreateSafeUniqueObjectFileName(objectName, dir_max); } //---------------------------------------------------------------------------- @@ -3470,7 +3470,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, { if(const char* val = target->GetProperty(prop)) { - mf->AddDefinition(prop.c_str(), val); + mf->AddDefinition(prop, val); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 862823fe7..acaacdda3 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -146,14 +146,14 @@ std::string cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { - return this->Convert(lib.c_str(), HOME_OUTPUT, format); + return this->Convert(lib, HOME_OUTPUT, format); } std::string cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path, OutputFormat format) { - return this->Convert(path.c_str(), HOME_OUTPUT, format); + return this->Convert(path, HOME_OUTPUT, format); } //---------------------------------------------------------------------------- @@ -310,7 +310,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(const cmCustomCommand *cc, for (std::vector::const_iterator i = deps.begin(); i != deps.end(); ++i) { std::string dep; - if (this->GetRealDependency(i->c_str(), this->GetConfigName(), dep)) + if (this->GetRealDependency(*i, this->GetConfigName(), dep)) ninjaDeps.push_back(ConvertToNinjaPath(dep.c_str())); } } @@ -382,7 +382,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) { cmdLines.push_back(launcher + - this->ConvertToOutputFormat(ccg.GetCommand(i).c_str(), SHELL)); + this->ConvertToOutputFormat(ccg.GetCommand(i), SHELL)); std::string& cmd = cmdLines.back(); ccg.AppendArguments(i, cmd); @@ -493,7 +493,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( RelativeRoot relative_root = cc.GetWorkingDirectory() ? NONE : START_OUTPUT; - output = this->Convert(outputs[0].c_str(), relative_root, SHELL); + output = this->Convert(outputs[0], relative_root, SHELL); } vars.Output = output.c_str(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f7088c2da..5dd2bb12b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -339,7 +339,7 @@ cmLocalUnixMakefileGenerator3 depends.push_back(output); std::vector no_commands; this->WriteMakeRule(ruleFileStream, 0, - outNoExt.c_str(), depends, no_commands, true, true); + outNoExt, depends, no_commands, true, true); inHelp = false; } @@ -355,7 +355,7 @@ cmLocalUnixMakefileGenerator3 targetName += "/"; targetName += output; commands.push_back( - this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str()) + this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName) ); } this->CreateCDCommand(commands, @@ -407,12 +407,12 @@ void cmLocalUnixMakefileGenerator3 std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash(); makefile2 += "Makefile2"; commands.push_back(this->GetRecursiveMakeCall - (makefile2.c_str(),localName.c_str())); + (makefile2.c_str(),localName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a target with the canonical name (no prefix, suffix or path). if(localName != t->second->GetName()) @@ -436,17 +436,17 @@ void cmLocalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(this->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "fast build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a local name for the rule to relink the target before // installation. if(t->second->Target - ->NeedRelinkBeforeInstall(this->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(this->ConfigurationName)) { makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target); makeTargetName += "/preinstall"; @@ -455,13 +455,13 @@ void cmLocalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(this->GetRecursiveMakeCall - (makefile2.c_str(), makeTargetName.c_str())); + (makefile2.c_str(), makeTargetName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); } } } @@ -582,7 +582,7 @@ cmLocalUnixMakefileGenerator3 // Construct the left hand side of the rule. replace = target; - std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); + std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE); const char* space = ""; if(tgt.size() == 1) { @@ -615,7 +615,7 @@ cmLocalUnixMakefileGenerator3 dep != depends.end(); ++dep) { replace = *dep; - replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); + replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } @@ -654,10 +654,10 @@ cmLocalUnixMakefileGenerator3 std::string scmd; if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) { - return this->Convert(scmd.c_str(), NONE, SHELL); + return this->Convert(scmd, NONE, SHELL); } } - return this->Convert(cmd.c_str(), root, SHELL); + return this->Convert(cmd, root, SHELL); } //---------------------------------------------------------------------------- @@ -829,7 +829,7 @@ void cmLocalUnixMakefileGenerator3 std::string runRule = "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; runRule += " --check-build-system "; - runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL); + runRule += this->Convert(cmakefileName,NONE,SHELL); runRule += " 0"; std::vector no_depends; @@ -886,7 +886,7 @@ cmLocalUnixMakefileGenerator3 { std::string dir = this->HomeRelativeOutputPath; dir += this->GetTargetDirectory(target); - return this->Convert(dir.c_str(),NONE,UNCHANGED); + return this->Convert(dir,NONE,UNCHANGED); } @@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3 { // Lookup the real name of the dependency in case it is a CMake target. std::string dep; - if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(), + if(this->GetRealDependency(*d, this->ConfigurationName, dep)) { depends.push_back(dep); @@ -1020,7 +1020,7 @@ cmLocalUnixMakefileGenerator3 { *content << dir; } - cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(), + cmCustomCommandGenerator ccg(cc, this->ConfigurationName, this->Makefile); // Add each command line to the set of commands. @@ -1055,7 +1055,7 @@ cmLocalUnixMakefileGenerator3 bool had_slash = cmd.find("/") != cmd.npos; if(!workingDir) { - cmd = this->Convert(cmd.c_str(),START_OUTPUT); + cmd = this->Convert(cmd,START_OUTPUT); } bool has_slash = cmd.find("/") != cmd.npos; if(had_slash && !has_slash) @@ -1141,7 +1141,7 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc, const std::vector& outputs = cc.GetOutputs(); if(!outputs.empty()) { - output = this->Convert(outputs[0].c_str(), relative, SHELL); + output = this->Convert(outputs[0], relative, SHELL); } vars.Output = output.c_str(); @@ -1171,7 +1171,7 @@ cmLocalUnixMakefileGenerator3 cleanfile += filename; } cleanfile += ".cmake"; - std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL); + std::string cleanfilePath = this->Convert(cleanfile, FULL); cmsys::ofstream fout(cleanfilePath.c_str()); if(!fout) { @@ -1183,13 +1183,13 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator f = files.begin(); f != files.end(); ++f) { - std::string fc = this->Convert(f->c_str(),START_OUTPUT,UNCHANGED); - fout << " " << this->EscapeForCMake(fc.c_str()) << "\n"; + std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED); + fout << " " << this->EscapeForCMake(fc) << "\n"; } fout << ")\n"; } std::string remove = "$(CMAKE_COMMAND) -P "; - remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL); + remove += this->Convert(cleanfile, START_OUTPUT, SHELL); commands.push_back(remove); // For the main clean rule add per-language cleaning. @@ -1267,14 +1267,14 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, { // Use the native echo command. cmd = "@echo "; - cmd += this->EscapeForShell(line.c_str(), false, true); + cmd += this->EscapeForShell(line, false, true); } else { // Use cmake to echo the text in color. cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) "; cmd += color_name; - cmd += this->EscapeForShell(line.c_str()); + cmd += this->EscapeForShell(line); } commands.push_back(cmd); } @@ -1588,14 +1588,14 @@ cmLocalUnixMakefileGenerator3 langs.begin(); li != langs.end(); ++li) { // construct the checker - std::string lang = li->c_str(); + std::string lang = *li; // Create the scanner for this language cmDepends *scanner = 0; if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM") { // TODO: Handle RC (resource files) dependencies correctly. - scanner = new cmDependsC(this, targetDir, lang.c_str(), &validDeps); + scanner = new cmDependsC(this, targetDir, lang, &validDeps); } #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") @@ -1613,7 +1613,7 @@ cmLocalUnixMakefileGenerator3 scanner->SetLocalGenerator(this); scanner->SetFileComparison (this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); - scanner->SetLanguage(lang.c_str()); + scanner->SetLanguage(lang); scanner->SetTargetDirectory(dir.c_str()); scanner->Write(ruleFileStream, internalRuleFileStream); @@ -1726,7 +1726,7 @@ void cmLocalUnixMakefileGenerator3 dit != glIt->second.GetUtilities().end(); ++ dit ) { - depends.push_back(dit->c_str()); + depends.push_back(*dit); } this->AppendEcho(commands, text, cmLocalUnixMakefileGenerator3::EchoGlobal); @@ -1746,7 +1746,7 @@ void cmLocalUnixMakefileGenerator3 cmLocalGenerator::START_OUTPUT); std::string targetName = glIt->second.GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), - targetName.c_str(), depends, commands, true); + targetName, depends, commands, true); // Provide a "/fast" version of the target. depends.clear(); @@ -1766,7 +1766,7 @@ void cmLocalUnixMakefileGenerator3 } targetName += "/fast"; this->WriteMakeRule(ruleFileStream, targetString.c_str(), - targetName.c_str(), depends, commands, true); + targetName, depends, commands, true); } } @@ -1786,15 +1786,15 @@ void cmLocalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; - progCmd << this->Convert(progressDir.c_str(), + progCmd << this->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); std::string progressFile = cmake::GetCMakeFilesDirectory(); progressFile += "/progress.marks"; std::string progressFileNameFull = - this->ConvertToFullPath(progressFile.c_str()); - progCmd << " " << this->Convert(progressFileNameFull.c_str(), + this->ConvertToFullPath(progressFile); + progCmd << " " << this->Convert(progressFileNameFull, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); commands.push_back(progCmd.str()); @@ -1802,14 +1802,14 @@ void cmLocalUnixMakefileGenerator3 std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); mf2Dir += "Makefile2"; commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), - recursiveTarget.c_str())); + recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << this->Convert(progressDir.c_str(), + progCmd << this->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " 0"; @@ -1824,7 +1824,7 @@ void cmLocalUnixMakefileGenerator3 commands.clear(); depends.clear(); commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), - recursiveTarget.c_str())); + recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); @@ -1854,7 +1854,7 @@ void cmLocalUnixMakefileGenerator3 depends.push_back("cmake_check_build_system"); } commands.push_back - (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str())); + (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); @@ -1872,7 +1872,7 @@ void cmLocalUnixMakefileGenerator3 std::string runRule = "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; runRule += " --check-build-system "; - runRule += this->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE, + runRule += this->Convert(cmakefileName,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); runRule += " 1"; commands.push_back(runRule); @@ -1905,7 +1905,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, for(std::vector::iterator l = files.begin(); l != files.end(); ++l) { - std::string dir = cmSystemTools::GetFilenamePath(l->c_str()); + std::string dir = cmSystemTools::GetFilenamePath(*l); // Clear the implicit dependency makefile. std::string dependFile = dir + "/depend.make"; @@ -1964,7 +1964,7 @@ void cmLocalUnixMakefileGenerator3 std::string cidVar = "CMAKE_"; cidVar += l->first; cidVar += "_COMPILER_ID"; - const char* cid = this->Makefile->GetDefinition(cidVar.c_str()); + const char* cid = this->Makefile->GetDefinition(cidVar); if(cid && *cid) { cmakefileStream @@ -1976,7 +1976,7 @@ void cmLocalUnixMakefileGenerator3 // Build a list of preprocessor definitions for the target. std::set defines; this->AddCompileDefinitions(defines, &target, - this->ConfigurationName.c_str()); + this->ConfigurationName); if(!defines.empty()) { cmakefileStream @@ -1987,7 +1987,7 @@ void cmLocalUnixMakefileGenerator3 di != defines.end(); ++di) { cmakefileStream - << " " << this->EscapeForCMake(di->c_str()) << "\n"; + << " " << this->EscapeForCMake(*di) << "\n"; } cmakefileStream << " )\n"; @@ -2013,7 +2013,7 @@ void cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { - cmakefileStream << " " << this->EscapeForCMake(tri->c_str()) << "\n"; + cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n"; } cmakefileStream << " )\n"; @@ -2070,12 +2070,12 @@ cmLocalUnixMakefileGenerator3 // Escape one extra time if the make tool requires it. if(this->MakeCommandEscapeTargetTwice) { - tgt2 = this->EscapeForShell(tgt2.c_str(), true, false); + tgt2 = this->EscapeForShell(tgt2, true, false); } // The target name is now a string that should be passed verbatim // on the command line. - cmd += this->EscapeForShell(tgt2.c_str(), true, false); + cmd += this->EscapeForShell(tgt2, true, false); } return cmd; } diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d253b8fc..9f569e104 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -95,7 +95,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string errorMsg = "Macro invoked with incorrect arguments for macro named: "; errorMsg += this->Args[0]; - this->SetError(errorMsg.c_str()); + this->SetError(errorMsg); return false; } @@ -276,8 +276,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->Functions = this->Functions; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), - newName.c_str()); + mf.GetCMakeInstance()->RenameCommand(this->Args[0], + newName); mf.AddCommand(f); // remove the function blocker now that the macro is defined diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 03ad37c49..52832dbf1 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -74,7 +74,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) cmGeneratorExpression::StripAllGeneratorExpressions); std::vector includes; - cmSystemTools::ExpandListArgument(incDirs.c_str(), includes); + cmSystemTools::ExpandListArgument(incDirs, includes); for(std::vector::const_iterator j = includes.begin(); j != includes.end(); ++j) @@ -93,7 +93,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) it != orderedAndUniqueIncludes.end(); ++it) { - this->AddSearchPath(it->c_str()); + this->AddSearchPath(*it); } } @@ -165,7 +165,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) { // Try to find the file amongst the sources cmSourceFile *srcFile = this->Makefile->GetSource - (cmSystemTools::GetFilenameWithoutExtension(path).c_str()); + (cmSystemTools::GetFilenameWithoutExtension(path)); if (srcFile) { if (srcFile->GetFullPath() == path) @@ -281,7 +281,7 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, // Didn't find an instance. Create a new one and save it. cmDependInformation* info = new cmDependInformation; info->FullPath = fullPath; - info->PathOnly = cmSystemTools::GetFilenamePath(fullPath.c_str()); + info->PathOnly = cmSystemTools::GetFilenamePath(fullPath); info->IncludeName = file; this->DependInformationMap[fullPath] = info; return info; diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index 63be62734..cc871c93c 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -24,7 +24,7 @@ bool cmMakeDirectoryCommand { std::string e = "attempted to create a directory: " + args[0] + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 92177c897..6fef3718c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -330,7 +330,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.Line = 0; if(!this->GetCMakeInstance()->GetIsInTryCompile()) { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath.c_str(), + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, cmLocalGenerator::HOME); } backtrace.push_back(lfc); @@ -351,7 +351,7 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const i != this->CallStack.rend(); ++i) { cmListFileContext lfc = *(*i).Context; - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath.c_str(), + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, cmLocalGenerator::HOME); backtrace.push_back(lfc); } @@ -394,7 +394,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, static_cast(stack_manager); // Lookup the command prototype. - if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name.c_str())) + if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name)) { // Clone the prototype. cmsys::auto_ptr pcmd(proto->Clone()); @@ -756,7 +756,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::WARN: // Warn because the user did not provide a mimimum required // version. - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str().c_str()); + this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); case cmPolicies::OLD: // OLD behavior is to use policy version 2.4 set in // cmListFileCache. @@ -765,7 +765,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // NEW behavior is to issue an error. - this->IssueMessage(cmake::FATAL_ERROR, msg.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, msg.str()); cmSystemTools::SetFatalErrorOccured(); return; } @@ -912,7 +912,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, e << (this->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; e << "The target name \"" << target << "\" is unknown in this context."; - IssueMessage(messageType, e.str().c_str()); + IssueMessage(messageType, e.str()); } return; @@ -1018,7 +1018,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, std::string outName = gg->GenerateRuleFile(outputs[0]); // Check if the rule file already exists. - file = this->GetSource(outName.c_str()); + file = this->GetSource(outName); if(file && file->GetCustomCommand() && !replace) { // The rule file already exists. @@ -1032,7 +1032,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, } // Create a cmSourceFile for the rule file. - file = this->GetOrCreateSource(outName.c_str(), true); + file = this->GetOrCreateSource(outName, true); file->SetProperty("__CMAKE_RULE", "1"); } @@ -1040,7 +1040,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, for(std::vector::const_iterator o = outputs.begin(); o != outputs.end(); ++o) { - if(cmSourceFile* out = this->GetOrCreateSource(o->c_str(), true)) + if(cmSourceFile* out = this->GetOrCreateSource(*o, true)) { out->SetProperty("GENERATED", "1"); } @@ -1253,12 +1253,12 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += utilityName; std::string no_main_dependency = ""; bool no_replace = false; - this->AddCustomCommandToOutput(force.c_str(), depends, + this->AddCustomCommandToOutput(force, depends, no_main_dependency, commandLines, comment, workingDirectory, no_replace, escapeOldStyle); - cmSourceFile* sf = target->AddSource(force.c_str()); + cmSourceFile* sf = target->AddSource(force); // The output is not actually created so mark it symbolic. if(sf) @@ -1486,7 +1486,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, << " may not be linked into another target. " << "One may link only to STATIC or SHARED libraries, or " << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } } i->second.AddLinkLibrary( *this, target, lib, llt ); @@ -1497,7 +1497,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, e << "Attempt to add link library \"" << lib << "\" to target \"" << target << "\" which is not built in this directory."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } } @@ -1512,7 +1512,7 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, cmOStringStream e; e << "ALIAS target \"" << target << "\" " << "may not be linked into another target."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } i->second.AddLinkDirectory( d ); @@ -1605,8 +1605,8 @@ void cmMakefile::InitializeFromParent() { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(*ci); - const char* prop = parent->GetProperty(defPropName.c_str()); - this->SetProperty(defPropName.c_str(), prop); + const char* prop = parent->GetProperty(defPropName); + this->SetProperty(defPropName, prop); } } @@ -1670,7 +1670,7 @@ void cmMakefile::AddSubDirectory(const std::string& sub, } - this->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->AddSubDirectory(srcPath, binPath, excludeFromAll, preorder, false); } @@ -1873,7 +1873,7 @@ void cmMakefile::CheckForUnusedVariables() const std::set::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { - this->CheckForUnused("out of scope", it->c_str()); + this->CheckForUnused("out of scope", *it); } } @@ -1935,7 +1935,7 @@ void cmMakefile::CheckForUnused(const char* reason, cmOStringStream msg; msg << "unused variable (" << reason << ") \'" << name << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, - msg.str().c_str(), + msg.str(), bt); } } @@ -1988,7 +1988,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, for(j = this->LinkDirectories.begin(); j != this->LinkDirectories.end(); ++j) { - target.AddLinkDirectory(j->c_str()); + target.AddLinkDirectory(*j); } target.MergeLinkLibraries( *this, name, this->LinkLibraries ); } @@ -2101,7 +2101,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput( // linear-time search for an output with a matching suffix. if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(name.c_str()); + return LinearGetSourceFileWithOutput(name); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); @@ -2199,7 +2199,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, { std::string guidName = "SG_Filter_"; guidName += fullname; - gg->CreateGUID(guidName.c_str()); + gg->CreateGUID(guidName); } for(++i; i<=lastElement; ++i) { @@ -2210,7 +2210,7 @@ void cmMakefile::AddSourceGroup(const std::vector& name, { std::string guidName = "SG_Filter_"; guidName += fullname; - gg->CreateGUID(guidName.c_str()); + gg->CreateGUID(guidName); } } @@ -2369,7 +2369,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const name += language; } name += "_FLAG"; - return GetDefinition(name.c_str()); + return GetDefinition(name); } bool cmMakefile::CanIWriteThisFile(const char* fileName) const @@ -2564,7 +2564,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, // Lookup the definition of VAR. std::string var(first+1, last-first-2); - if(const char* val = this->GetDefinition(var.c_str())) + if(const char* val = this->GetDefinition(var)) { // Store the value in the output escaping as requested. if(escapeQuotes) @@ -2999,7 +2999,7 @@ void cmMakefile::SetArgcArgv(const std::vector& args) { cmOStringStream tmpStream; tmpStream << "CMAKE_ARGV" << t; - this->AddDefinition(tmpStream.str().c_str(), args[t].c_str()); + this->AddDefinition(tmpStream.str(), args[t].c_str()); //this->MarkVariableAsUsed(tmpStream.str().c_str()); } } @@ -3007,7 +3007,7 @@ void cmMakefile::SetArgcArgv(const std::vector& args) //---------------------------------------------------------------------------- cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const { - cmSourceFileLocation sfl(this, sourceName.c_str()); + cmSourceFileLocation sfl(this, sourceName); for(std::vector::const_iterator sfi = this->SourceFiles.begin(); sfi != this->SourceFiles.end(); ++sfi) @@ -3031,7 +3031,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str()); + cmSourceFile* sf = new cmSourceFile(this, sourceName); if(generated) { sf->SetProperty("GENERATED", "1"); @@ -3396,7 +3396,7 @@ void cmMakefile::ConfigureString(const std::string& input, if(this->cmDefineRegex.find(line)) { const char* def = - this->GetDefinition(this->cmDefineRegex.match(1).c_str()); + this->GetDefinition(this->cmDefineRegex.match(1)); if(!cmSystemTools::IsOff(def)) { cmSystemTools::ReplaceString(line, "#cmakedefine", "#define"); @@ -3412,7 +3412,7 @@ void cmMakefile::ConfigureString(const std::string& input, else if(this->cmDefine01Regex.find(line)) { const char* def = - this->GetDefinition(this->cmDefine01Regex.match(1).c_str()); + this->GetDefinition(this->cmDefine01Regex.match(1)); cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define"); output += line; if(!cmSystemTools::IsOff(def)) @@ -3650,7 +3650,7 @@ void cmMakefile::AppendProperty(const std::string& prop, for(std::vector::const_iterator vi = varArgsExpanded.begin(); vi != varArgsExpanded.end(); ++vi) { - this->AddLinkDirectory(vi->c_str()); + this->AddLinkDirectory(*vi); } return; } @@ -3816,7 +3816,7 @@ const char* cmMakefile::GetFeature(const std::string& feature, std::string featureConfig = feature; featureConfig += "_"; featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig.c_str())) + if(const char* value = this->GetProperty(featureConfig)) { return value; } @@ -3862,7 +3862,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName) return test; } test = new cmTest(this); - test->SetName(testName.c_str()); + test->SetName(testName); this->Tests[testName] = test; return test; } @@ -3951,9 +3951,9 @@ void cmMakefile::PopScope() for (; it != locals.end(); ++it) { init.erase(*it); - if (!this->VariableUsed(it->c_str())) + if (!this->VariableUsed(*it)) { - this->CheckForUnused("out of scope", it->c_str()); + this->CheckForUnused("out of scope", *it); } else { @@ -3987,10 +3987,10 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. - cur.Get(var.c_str()); + cur.Get(var); // Now update the definition in the parent scope. - up->Set(var.c_str(), varDef); + up->Set(var, varDef); } else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { @@ -4000,11 +4000,11 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) cmMakefile* parent = plg->GetMakefile(); if (varDef) { - parent->AddDefinition(var.c_str(), varDef); + parent->AddDefinition(var, varDef); } else { - parent->RemoveDefinition(var.c_str()); + parent->RemoveDefinition(var); } } else @@ -4074,7 +4074,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(), + return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name, excludeAliases); } @@ -4084,7 +4084,7 @@ bool cmMakefile::IsAlias(const std::string& name) const if (this->AliasTargets.find(name) != this->AliasTargets.end()) return true; return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias( - name.c_str()); + name); } //---------------------------------------------------------------------------- @@ -4330,7 +4330,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, { std::string msg = this->GetPolicies()->GetRequiredAlwaysPolicyError(id); - this->IssueMessage(cmake::FATAL_ERROR, msg.c_str()); + this->IssueMessage(cmake::FATAL_ERROR, msg); return false; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ca8ff060c..a61005b43 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -142,20 +142,20 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string targetFullPathPDB = pdbOutputPath + targetNamePDB; std::string targetFullPathImport = outpathImp + targetNameImport; std::string targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(), + this->Convert(targetFullPathPDB, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); // Convert to the output path to use in constructing commands. std::string targetOutPath = - this->Convert(targetFullPath.c_str(), + this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathReal = - this->Convert(targetFullPathReal.c_str(), + this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathImport = - this->Convert(targetFullPathImport.c_str(), + this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); @@ -210,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) export_flag_var += linkLanguage; export_flag_var += "_FLAG"; this->LocalGenerator->AppendFlags - (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str())); + (linkFlags, this->Makefile->GetDefinition(export_flag_var)); } // Add language feature flags. @@ -225,14 +225,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (linkFlags, this->Target->GetProperty(linkFlagsConfig)); this->AddModuleDefinitionFlag(linkFlags); // Construct a list of files associated with this executable that // may need to be cleaned. std::vector exeCleanFiles; - exeCleanFiles.push_back(this->Convert(targetFullPath.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); #ifdef _WIN32 @@ -244,19 +244,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) #endif if(targetNameReal != targetName) { - exeCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(!targetNameImport.empty()) { - exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) { - exeCleanFiles.push_back(this->Convert(implib.c_str(), + exeCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -266,7 +266,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back - (this->Convert(targetFullPathPDB.c_str(), + (this->Convert(targetFullPathPDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); @@ -289,7 +289,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string linkRuleVar = "CMAKE_"; linkRuleVar += linkLanguage; linkRuleVar += "_LINK_EXECUTABLE"; - std::string linkRule = this->GetLinkRule(linkRuleVar.c_str()); + std::string linkRule = this->GetLinkRule(linkRuleVar); std::vector commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -300,7 +300,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) implibRuleVar += linkLanguage; implibRuleVar += "_CREATE_IMPORT_LIBRARY"; if(const char* rule = - this->Makefile->GetDefinition(implibRuleVar.c_str())) + this->Makefile->GetDefinition(implibRuleVar)) { cmSystemTools::ExpandListArgument(rule, real_link_commands); } @@ -312,7 +312,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForObjects = true; } @@ -324,7 +324,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForLibs = true; } @@ -351,7 +351,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -437,7 +437,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Write the build rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPathReal.c_str(), + targetFullPathReal, depends, commands, false); // The symlink name for the target should depend on the real target @@ -447,14 +447,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { depends.clear(); commands.clear(); - depends.push_back(targetFullPathReal.c_str()); + depends.push_back(targetFullPathReal); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPath.c_str(), + targetFullPath, depends, commands, false); } // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(targetFullPath.c_str(), relink); + this->WriteTargetDriverRule(targetFullPath, relink); // Clean all the possible executable names and symlinks. this->CleanFiles.insert(this->CleanFiles.end(), diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d9425e6a6..02469d1c3 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -125,7 +125,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); + this->WriteTargetDriverRule(this->Target->GetName(), false); } //---------------------------------------------------------------------------- @@ -138,7 +138,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() linkRuleVar += "_CREATE_STATIC_LIBRARY"; if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && - this->Makefile->GetDefinition((linkRuleVar+"_IPO").c_str())) + this->Makefile->GetDefinition(linkRuleVar+"_IPO")) { linkRuleVar += "_IPO"; } @@ -146,7 +146,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags(extraFlags, cmSystemTools::UpperCase(this->ConfigName), this->Target); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false); + this->WriteLibraryRules(linkRuleVar, extraFlags, false); } //---------------------------------------------------------------------------- @@ -169,13 +169,13 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); this->AddModuleDefinitionFlag(extraFlags); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -193,12 +193,12 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); this->AddModuleDefinitionFlag(extraFlags); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -216,11 +216,11 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -326,19 +326,19 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Construct the output path version of the names for use in command // arguments. std::string targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, + this->Convert(targetFullPathPDB,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); std::string targetOutPath = - this->Convert(targetFullPath.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPath,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathSO = - this->Convert(targetFullPathSO.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathSO,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathReal = - this->Convert(targetFullPathReal.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathReal,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathImport = - this->Convert(targetFullPathImport.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathImport,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); if(!this->NoRuleMessages) @@ -382,31 +382,31 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Clean files associated with this library. std::vector libCleanFiles; - libCleanFiles.push_back(this->Convert(targetFullPath.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); if(targetNameReal != targetName) { - libCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(targetNameSO != targetName && targetNameSO != targetNameReal) { - libCleanFiles.push_back(this->Convert(targetFullPathSO.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathSO, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(!targetNameImport.empty()) { - libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) { - libCleanFiles.push_back(this->Convert(implib.c_str(), + libCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -416,7 +416,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back - (this->Convert(targetFullPathPDB.c_str(), + (this->Convert(targetFullPathPDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); @@ -467,7 +467,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForObjects = true; } @@ -479,7 +479,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForLibs = true; } @@ -498,21 +498,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; arCreateVar += "_ARCHIVE_CREATE"; - if(const char* rule = this->Makefile->GetDefinition(arCreateVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arCreateVar)) { cmSystemTools::ExpandListArgument(rule, archiveCreateCommands); } std::string arAppendVar = "CMAKE_"; arAppendVar += linkLanguage; arAppendVar += "_ARCHIVE_APPEND"; - if(const char* rule = this->Makefile->GetDefinition(arAppendVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arAppendVar)) { cmSystemTools::ExpandListArgument(rule, archiveAppendCommands); } std::string arFinishVar = "CMAKE_"; arFinishVar += linkLanguage; arFinishVar += "_ARCHIVE_FINISH"; - if(const char* rule = this->Makefile->GetDefinition(arFinishVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arFinishVar)) { cmSystemTools::ExpandListArgument(rule, archiveFinishCommands); } @@ -580,7 +580,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -611,7 +611,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules { // Convert to a path for the native build tool. install_name_dir = - this->LocalGenerator->Convert(install_name_dir.c_str(), + this->LocalGenerator->Convert(install_name_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL, false); vars.TargetInstallNameDir = install_name_dir.c_str(); @@ -745,7 +745,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Write the build rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPathReal.c_str(), + targetFullPathReal, depends, commands, false); // Some targets have more than one output file. Create rules to @@ -764,7 +764,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(targetFullPath.c_str(), relink); + this->WriteTargetDriverRule(targetFullPath, relink); // Clean all the possible library names and symlinks. this->CleanFiles.insert(this->CleanFiles.end(), @@ -783,7 +783,7 @@ cmMakefileLibraryTargetGenerator fvar += "_OSX_"; fvar += name; fvar += "_VERSION_FLAG"; - const char* flag = this->Makefile->GetDefinition(fvar.c_str()); + const char* flag = this->Makefile->GetDefinition(fvar); // Skip if no such flag. if(!flag) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 28a8f04de..0730bc371 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() o != outputs.end(); ++o) { this->CleanFiles.push_back - (this->Convert(o->c_str(), + (this->Convert(*o, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -216,7 +216,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include any dependencies generated for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(dependFileNameFull.c_str(), + << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -227,7 +227,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull.c_str(), + << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -260,7 +260,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->FlagFileNameFull.c_str(), + << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName.c_str()); + this->LocalGenerator->ConfigurationName); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); @@ -354,7 +354,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() compiler += *l; compiler += "_COMPILER"; *this->FlagFileStream << "# compile " << l->c_str() << " with " << - this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n"; + this->Makefile->GetSafeDefinition(compiler) << "\n"; } for(std::set::const_iterator l = languages.begin(); @@ -389,9 +389,9 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() output += "/"; output += cmSystemTools::GetFilenameName(input); this->Generator->CleanFiles.push_back( - this->Generator->Convert(output.c_str(), + this->Generator->Convert(output, cmLocalGenerator::START_OUTPUT)); - output = this->Generator->Convert(output.c_str(), + output = this->Generator->Convert(output, cmLocalGenerator::HOME_OUTPUT); // Create a rule to copy the content into the bundle. @@ -404,17 +404,17 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() commands, copyEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild); std::string copyCommand = "$(CMAKE_COMMAND) -E copy "; - copyCommand += this->Generator->Convert(input.c_str(), + copyCommand += this->Generator->Convert(input, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); copyCommand += " "; - copyCommand += this->Generator->Convert(output.c_str(), + copyCommand += this->Generator->Convert(output, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); commands.push_back(copyCommand); this->Generator->LocalGenerator->WriteMakeRule( *this->Generator->BuildFileStream, 0, - output.c_str(), + output, depends, commands, false); this->Generator->ExtraFiles.insert(output); } @@ -457,7 +457,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) // Create the directory containing the object file. This may be a // subdirectory under the target's directory. - std::string dir = cmSystemTools::GetFilenamePath(obj.c_str()); + std::string dir = cmSystemTools::GetFilenamePath(obj); cmSystemTools::MakeDirectory (this->LocalGenerator->ConvertToFullPath(dir).c_str()); @@ -483,9 +483,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) objFullPath += "/"; objFullPath += obj; objFullPath = - this->Convert(objFullPath.c_str(), cmLocalGenerator::FULL); + this->Convert(objFullPath, cmLocalGenerator::FULL); std::string srcFullPath = - this->Convert(source.GetFullPath().c_str(), cmLocalGenerator::FULL); + this->Convert(source.GetFullPath(), cmLocalGenerator::FULL); this->LocalGenerator-> AddImplicitDepends(*this->Target, lang, objFullPath.c_str(), @@ -586,7 +586,7 @@ cmMakefileTargetGenerator std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; if(const char* config_compile_defs = - source.GetProperty(defPropName.c_str())) + source.GetProperty(defPropName)) { this->LocalGenerator->AppendDefines(defines, config_compile_defs); *this->FlagFileStream @@ -600,10 +600,10 @@ cmMakefileTargetGenerator std::string sourceFile = source.GetFullPath(); if(this->LocalGenerator->UseRelativePaths) { - sourceFile = this->Convert(sourceFile.c_str(), + sourceFile = this->Convert(sourceFile, cmLocalGenerator::START_OUTPUT); } - sourceFile = this->Convert(sourceFile.c_str(), + sourceFile = this->Convert(sourceFile, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); @@ -652,14 +652,14 @@ cmMakefileTargetGenerator } } - targetOutPathReal = this->Convert(targetFullPathReal.c_str(), + targetOutPathReal = this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, + this->Convert(targetFullPathPDB,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); targetOutPathCompilePDB = - this->Convert(targetFullPathCompilePDB.c_str(), + this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); } @@ -672,12 +672,12 @@ cmMakefileTargetGenerator vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); vars.Source = sourceFile.c_str(); std::string shellObj = - this->Convert(obj.c_str(), + this->Convert(obj, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.Object = shellObj.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -699,7 +699,7 @@ cmMakefileTargetGenerator compileRuleVar += lang; compileRuleVar += "_COMPILE_OBJECT"; std::string compileRule = - this->Makefile->GetRequiredDefinition(compileRuleVar.c_str()); + this->Makefile->GetRequiredDefinition(compileRuleVar); std::vector compileCommands; cmSystemTools::ExpandListArgument(compileRule, compileCommands); @@ -738,7 +738,7 @@ cmMakefileTargetGenerator // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObj.c_str(), + relativeObj, depends, commands, false); // Check for extra outputs created by the compilation. @@ -756,7 +756,7 @@ cmMakefileTargetGenerator this->GenerateExtraOutput(eoi->c_str(), relativeObj.c_str(), false); // Register this as an extra file to clean. - this->CleanFiles.push_back(eoi->c_str()); + this->CleanFiles.push_back(*eoi); } } @@ -792,15 +792,15 @@ cmMakefileTargetGenerator preprocessRuleVar += lang; preprocessRuleVar += "_CREATE_PREPROCESSED_SOURCE"; if(const char* preprocessRule = - this->Makefile->GetDefinition(preprocessRuleVar.c_str())) + this->Makefile->GetDefinition(preprocessRuleVar)) { std::vector preprocessCommands; cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands); std::string shellObjI = - this->Convert(objI.c_str(), + this->Convert(objI, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.PreprocessedSource = shellObjI.c_str(); // Expand placeholders in the commands. @@ -826,7 +826,7 @@ cmMakefileTargetGenerator } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObjI.c_str(), + relativeObjI, force_depends, commands, false); } @@ -849,15 +849,15 @@ cmMakefileTargetGenerator assemblyRuleVar += lang; assemblyRuleVar += "_CREATE_ASSEMBLY_SOURCE"; if(const char* assemblyRule = - this->Makefile->GetDefinition(assemblyRuleVar.c_str())) + this->Makefile->GetDefinition(assemblyRuleVar)) { std::vector assemblyCommands; cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands); std::string shellObjS = - this->Convert(objS.c_str(), + this->Convert(objS, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.AssemblySource = shellObjS.c_str(); // Expand placeholders in the commands. @@ -883,7 +883,7 @@ cmMakefileTargetGenerator } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObjS.c_str(), + relativeObjS, force_depends, commands, false); } } @@ -895,7 +895,7 @@ cmMakefileTargetGenerator std::vector p_depends; // always provide an empty requires target this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - objectRequires.c_str(), p_depends, + objectRequires, p_depends, no_commands, true); // write a build rule to recursively build what this obj provides @@ -909,19 +909,19 @@ cmMakefileTargetGenerator tgtMakefileName += "/build.make"; r_commands.push_back (this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(), - temp.c_str())); + temp)); p_depends.clear(); p_depends.push_back(objectRequires); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - objectProvides.c_str(), p_depends, + objectProvides, p_depends, r_commands, true); // write the provides.build rule dependency on the obj file p_depends.clear(); p_depends.push_back(relativeObj); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - temp.c_str(), p_depends, no_commands, + temp, p_depends, no_commands, false); } @@ -950,7 +950,7 @@ void cmMakefileTargetGenerator::WriteTargetRequiresRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - depTarget.c_str(), + depTarget, depends, no_commands, true); } @@ -975,7 +975,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - cleanTarget.c_str(), + cleanTarget, depends, commands, true); } @@ -1011,8 +1011,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() pi != this->MultipleOutputPairs.end(); ++pi) { *this->InfoFileStream - << " " << this->LocalGenerator->EscapeForCMake(pi->first.c_str()) - << " " << this->LocalGenerator->EscapeForCMake(pi->second.c_str()) + << " " << this->LocalGenerator->EscapeForCMake(pi->first) + << " " << this->LocalGenerator->EscapeForCMake(pi->second) << "\n"; } *this->InfoFileStream << " )\n\n"; @@ -1081,7 +1081,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() { *this->InfoFileStream << " \"" - << this->LocalGenerator->Convert(i->c_str(), + << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } @@ -1145,7 +1145,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << this->Convert(this->Makefile->GetStartOutputDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->InfoFileNameFull.c_str(), + << this->Convert(this->InfoFileNameFull, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); if(this->LocalGenerator->GetColorMakefile()) { @@ -1161,7 +1161,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - depTarget.c_str(), + depTarget, depends, commands, true); } @@ -1203,7 +1203,7 @@ void cmMakefileTargetGenerator for(std::vector::iterator i = deps.begin(); i != deps.end(); ++i) { - depends.push_back(i->c_str()); + depends.push_back(*i); } } } @@ -1247,13 +1247,13 @@ void cmMakefileTargetGenerator bool symbolic = false; if(need_symbolic) { - if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) { symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - o->c_str(), depends, commands, + *o, depends, commands, symbolic); // If the rule has changed make sure the output is rebuilt. @@ -1270,7 +1270,7 @@ void cmMakefileTargetGenerator bool symbolic = false; if(need_symbolic) { - if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) { symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } @@ -1284,11 +1284,11 @@ void cmMakefileTargetGenerator idi != cc.GetImplicitDepends().end(); ++idi) { std::string objFullPath = - this->Convert(outputs[0].c_str(), cmLocalGenerator::FULL); + this->Convert(outputs[0], cmLocalGenerator::FULL); std::string srcFullPath = - this->Convert(idi->second.c_str(), cmLocalGenerator::FULL); + this->Convert(idi->second, cmLocalGenerator::FULL); this->LocalGenerator-> - AddImplicitDepends(*this->Target, idi->first.c_str(), + AddImplicitDepends(*this->Target, idi->first, objFullPath.c_str(), srcFullPath.c_str()); } @@ -1333,7 +1333,7 @@ cmMakefileTargetGenerator::AppendProgress(std::vector& commands) progressDir += cmake::GetCMakeFilesDirectory(); cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; - progCmd << this->LocalGenerator->Convert(progressDir.c_str(), + progCmd << this->LocalGenerator->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; @@ -1349,7 +1349,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all objects for the // target. variableName = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" @@ -1370,7 +1370,7 @@ cmMakefileTargetGenerator if(objName) { *this->BuildFileStream << - this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT, + this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::MAKEFILE); } else @@ -1384,7 +1384,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all external objects // for the target. variableNameExternal = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_EXTERNAL_OBJECTS"); *this->BuildFileStream << "\n" @@ -1395,14 +1395,14 @@ cmMakefileTargetGenerator this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) { - object = this->Convert(i->c_str(),cmLocalGenerator::START_OUTPUT); + object = this->Convert(*i,cmLocalGenerator::START_OUTPUT); *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); if(objName) { *this->BuildFileStream << - this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT, + this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::MAKEFILE); } else @@ -1439,7 +1439,7 @@ public: { // Construct the name of the next object. this->NextObject = - this->LocalGenerator->Convert(obj.c_str(), + this->LocalGenerator->Convert(obj, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::RESPONSE); @@ -1505,7 +1505,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); std::string buildTargetRuleName = dir; buildTargetRuleName += relink?"/preinstall":"/build"; - buildTargetRuleName = this->Convert(buildTargetRuleName.c_str(), + buildTargetRuleName = this->Convert(buildTargetRuleName, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::UNCHANGED); @@ -1541,7 +1541,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( // Write the driver rule. std::vector no_commands; this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, comment, - buildTargetRuleName.c_str(), + buildTargetRuleName, depends, no_commands, true); } @@ -1555,7 +1555,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); if(!(fwSearchFlag && *fwSearchFlag)) { return std::string(); @@ -1577,7 +1577,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) for(std::vector::iterator i = includes.begin(); i != includes.end(); ++i) { - if(this->Target->NameResolvesToFramework(i->c_str())) + if(this->Target->NameResolvesToFramework(*i)) { std::string frameworkDir = *i; frameworkDir += "/../"; @@ -1597,7 +1597,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) if(emitted.insert(*i).second) { flags += fwSearchFlag; - flags += this->Convert(i->c_str(), + flags += this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL, true); flags += " "; @@ -1692,7 +1692,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule( std::string ruleVar = "CMAKE_"; ruleVar += this->Target->GetLinkerLanguage(this->ConfigName); ruleVar += "_GNUtoMS_RULE"; - if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(ruleVar)) { linkRule += rule; } @@ -1721,7 +1721,7 @@ void cmMakefileTargetGenerator::RemoveForbiddenFlags(const char* flagVar, removeFlags += linkLang; removeFlags += flagVar; std::string removeflags = - this->Makefile->GetSafeDefinition(removeFlags.c_str()); + this->Makefile->GetSafeDefinition(removeFlags); std::vector removeList; cmSystemTools::ExpandListArgument(removeflags, removeList); @@ -1799,7 +1799,7 @@ cmMakefileTargetGenerator // Create the makefile command to invoke the link script. std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script "; - link_command += this->Convert(linkScriptName.c_str(), + link_command += this->Convert(linkScriptName, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); link_command += " --verbose=$(VERBOSE)"; @@ -1854,7 +1854,7 @@ cmMakefileTargetGenerator responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; const char* responseFlag = - this->Makefile->GetDefinition(responseFlagVar.c_str()); + this->Makefile->GetDefinition(responseFlagVar); if(!responseFlag) { responseFlag = "@"; @@ -1866,7 +1866,7 @@ cmMakefileTargetGenerator // Reference the response file. linkLibs = responseFlag; - linkLibs += this->Convert(link_rsp.c_str(), + linkLibs += this->Convert(link_rsp, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); } @@ -1896,7 +1896,7 @@ cmMakefileTargetGenerator responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; const char* responseFlag = - this->Makefile->GetDefinition(responseFlagVar.c_str()); + this->Makefile->GetDefinition(responseFlagVar); if(!responseFlag) { responseFlag = "@"; @@ -1920,7 +1920,7 @@ cmMakefileTargetGenerator // Reference the response file. buildObjs += responseFlag; - buildObjs += this->Convert(objects_rsp.c_str(), + buildObjs += this->Convert(objects_rsp, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); } @@ -1949,7 +1949,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::string responseVar = "CMAKE_"; responseVar += lang; responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES"; - bool useResponseFile = this->Makefile->IsOn(responseVar.c_str()); + bool useResponseFile = this->Makefile->IsOn(responseVar); std::vector includes; @@ -2070,7 +2070,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) idi != includes.end(); ++idi) { std::string flg = modpath_flag; - flg += this->Convert(idi->c_str(), + flg += this->Convert(*idi, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); this->LocalGenerator->AppendFlags(flags, flg.c_str()); @@ -2098,7 +2098,7 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // Append the flag and value. Use ConvertToLinkReference to help // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference(def.c_str())); + flag += (this->LocalGenerator->ConvertToLinkReference(def)); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 2066fc274..6b039bbf3 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -52,7 +52,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull.c_str(), + << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -105,7 +105,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); + this->WriteTargetDriverRule(this->Target->GetName(), false); // Write clean target this->WriteTargetCleanRules(); diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 4236d102c..f6a2c2670 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -42,11 +42,11 @@ bool cmMarkAsAdvancedCommand if ( it.IsAtEnd() ) { this->Makefile->GetCacheManager() - ->AddCacheEntry(variable.c_str(), 0, 0, + ->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); overwrite = true; } - it.Find(variable.c_str()); + it.Find(variable); if ( it.IsAtEnd() ) { cmSystemTools::Error("This should never happen..."); diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 9fc42659a..f1942c546 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -28,7 +28,7 @@ bool cmMathCommand return this->HandleExprCommand(args); } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -49,13 +49,13 @@ bool cmMathCommand::HandleExprCommand(std::vector const& args) { std::string e = "cannot parse the expression: \""+expression+"\": "; e += helper.GetError(); - this->SetError(e.c_str()); + this->SetError(e); return false; } char buffer[1024]; sprintf(buffer, "%d", helper.GetResult()); - this->Makefile->AddDefinition(outputVariable.c_str(), buffer); + this->Makefile->AddDefinition(outputVariable, buffer); return true; } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index d85e720b6..88d6a771b 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -77,7 +77,7 @@ bool cmMessageCommand if (type != cmake::MESSAGE) { - this->Makefile->IssueMessage(type, message.c_str()); + this->Makefile->IssueMessage(type, message); } else { diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a49fc2d7b..686ec8128 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -175,7 +175,7 @@ cmNinjaNormalTargetGenerator // build response file name std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; - const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str()); + const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar); if(flag) { responseFlag = flag; } else { @@ -189,7 +189,7 @@ cmNinjaNormalTargetGenerator linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_"; linkOptionVar += cmTarget::GetTargetTypeName(targetType); const std::string linkOption = - GetMakefile()->GetSafeDefinition(linkOptionVar.c_str()); + GetMakefile()->GetSafeDefinition(linkOptionVar); rspcontent = "$in_newline "+linkOption+" $LINK_PATH $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); vars.LinkLibraries = ""; @@ -321,7 +321,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_CREATE_STATIC_LIBRARY"; if (const char *linkCmd = - this->GetMakefile()->GetDefinition(linkCmdVar.c_str())) + this->GetMakefile()->GetDefinition(linkCmdVar)) { cmSystemTools::ExpandListArgument(linkCmd, linkCmds); return linkCmds; @@ -341,7 +341,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_CREATE"; const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } { @@ -349,7 +349,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_FINISH"; const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } return linkCmds; @@ -374,7 +374,7 @@ cmNinjaNormalTargetGenerator } const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); return linkCmds; } @@ -497,7 +497,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (!install_name_dir.empty()) { vars["INSTALLNAME_DIR"] = - this->GetLocalGenerator()->Convert(install_name_dir.c_str(), + this->GetLocalGenerator()->Convert(install_name_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL, false); } @@ -506,7 +506,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (!this->TargetNameImport.empty()) { const std::string impLibPath = this->GetLocalGenerator() - ->ConvertToOutputFormat(targetOutputImplib.c_str(), + ->ConvertToOutputFormat(targetOutputImplib, cmLocalGenerator::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3ef236aad..d6520184a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -140,11 +140,11 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, std::string& languageFlags = this->LanguageFlags[language]; if(!hasLangCached) { - this->AddFeatureFlags(languageFlags, language.c_str()); + this->AddFeatureFlags(languageFlags, language); this->GetLocalGenerator()->AddArchitectureFlags(languageFlags, this->GeneratorTarget, - language.c_str(), + language, this->GetConfigName()); // Add shared-library flags if needed. @@ -153,17 +153,17 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, this->GetConfigName()); this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target, - language.c_str()); + language); std::vector includes; this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, - language.c_str(), + language, this->GetConfigName()); // Add include directory flags. std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, - language.c_str(), + language, language == "RC" ? true : false); // full include paths for RC // needed by cmcldeps if(cmGlobalNinjaGenerator::IsMinGW()) @@ -177,7 +177,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Add target-specific flags. this->LocalGenerator->AddCompileOptions(languageFlags, this->Target, - language.c_str(), + language, this->GetConfigName()); } @@ -232,12 +232,12 @@ ComputeDefines(cmSourceFile *source, const std::string& language) defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - source->GetProperty(defPropName.c_str())); + source->GetProperty(defPropName)); } std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, - language.c_str()); + language); return definesString; } @@ -340,11 +340,11 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const } vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(pdbPath.c_str()).c_str(), + ConvertToNinjaPath(pdbPath.c_str()), cmLocalGenerator::SHELL); vars["TARGET_COMPILE_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(compilePdbPath.c_str()).c_str(), + ConvertToNinjaPath(compilePdbPath.c_str()), cmLocalGenerator::SHELL); EnsureParentDirectoryExists(pdbPath); @@ -420,7 +420,7 @@ cmNinjaTargetGenerator deptype = "gcc"; depfile = "$DEP_FILE"; const std::string flagsName = "CMAKE_DEPFILE_FLAGS_" + lang; - std::string depfileFlags = mf->GetSafeDefinition(flagsName.c_str()); + std::string depfileFlags = mf->GetSafeDefinition(flagsName); if (!depfileFlags.empty()) { cmSystemTools::ReplaceString(depfileFlags, "", "$DEP_FILE"); @@ -436,7 +436,7 @@ cmNinjaTargetGenerator // Rule for compiling object file. const std::string cmdVar = std::string("CMAKE_") + lang + "_COMPILE_OBJECT"; - std::string compileCmd = mf->GetRequiredDefinition(cmdVar.c_str()); + std::string compileCmd = mf->GetRequiredDefinition(cmdVar); std::vector compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); @@ -603,7 +603,7 @@ cmNinjaTargetGenerator std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(objectDir.c_str()).c_str(), + ConvertToNinjaPath(objectDir.c_str()), cmLocalGenerator::SHELL); this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); @@ -628,7 +628,7 @@ cmNinjaTargetGenerator escapedSourceFileName = this->LocalGenerator->ConvertToOutputFormat( - escapedSourceFileName.c_str(), cmLocalGenerator::SHELL); + escapedSourceFileName, cmLocalGenerator::SHELL); compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); @@ -641,7 +641,7 @@ cmNinjaTargetGenerator compileCmdVar += language; compileCmdVar += "_COMPILE_OBJECT"; std::string compileCmd = - this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(compileCmdVar); std::vector compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); @@ -699,7 +699,7 @@ cmNinjaTargetGenerator // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile.c_str())); + this->ModuleDefinitionFile)); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 449f923f6..835f892ba 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -60,7 +60,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, plist += this->GT->Target->GetAppBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, - targetName.c_str(), + targetName, plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); outpath = newoutpath; @@ -91,7 +91,7 @@ void cmOSXBundleGenerator::CreateFramework( plist += "/Resources/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); this->LocalGenerator->GenerateFrameworkInfoPList(this->GT->Target, - name.c_str(), + name, plist.c_str()); // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to @@ -182,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, - targetName.c_str(), + targetName, plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); } diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index dbe247868..e505440e8 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -39,7 +39,7 @@ bool cmOptionCommand m += args[i]; m += " "; } - this->SetError(m.c_str()); + this->SetError(m); return false; } @@ -62,7 +62,7 @@ bool cmOptionCommand initialValue = args[2]; } bool init = cmSystemTools::IsOn(initialValue.c_str()); - this->Makefile->AddCacheDefinition(args[0].c_str(), init? "ON":"OFF", + this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF", args[1].c_str(), cmCacheManager::BOOL); return true; } diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 79677e368..ec671fcbe 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -261,7 +261,7 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) { std::string fname = lib; fname += *i; - if(this->FileMayConflict(dir, fname.c_str())) + if(this->FileMayConflict(dir, fname)) { return true; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index c0d9e995b..5016493bd 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -202,7 +202,7 @@ bool cmOutputRequiredFilesCommand { std::string err = "Can not open output file: "; err += this->OutputFile; - this->SetError(err.c_str()); + this->SetError(err); return false; } std::set visited; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 93072f50b..2bd553f12 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -488,7 +488,7 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmPolicies::PolicyStatus* defaultSetting) { std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; - std::string defaultValue = mf->GetSafeDefinition(defaultVar.c_str()); + std::string defaultValue = mf->GetSafeDefinition(defaultVar); if(defaultValue == "NEW") { *defaultSetting = cmPolicies::NEW; @@ -506,7 +506,7 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmOStringStream e; e << defaultVar << " has value \"" << defaultValue << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -651,5 +651,5 @@ cmPolicies::DiagnoseAncientPolicies(std::vector const& ancient, << "Please either update your CMakeLists.txt files to conform to " << "the new behavior or use an older version of CMake that still " << "supports the old behavior."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index a9ce0cc9e..12318c8af 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -28,20 +28,20 @@ bool cmProjectCommand srcdir += "_SOURCE_DIR"; this->Makefile->AddCacheDefinition - (bindir.c_str(), + (bindir, this->Makefile->GetCurrentOutputDirectory(), "Value Computed by CMake", cmCacheManager::STATIC); this->Makefile->AddCacheDefinition - (srcdir.c_str(), + (srcdir, this->Makefile->GetCurrentDirectory(), "Value Computed by CMake", cmCacheManager::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; - this->Makefile->AddDefinition(bindir.c_str(), + this->Makefile->AddDefinition(bindir, this->Makefile->GetCurrentOutputDirectory()); - this->Makefile->AddDefinition(srcdir.c_str(), + this->Makefile->AddDefinition(srcdir, this->Makefile->GetCurrentDirectory()); this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); @@ -167,19 +167,19 @@ bool cmProjectCommand std::string vv; vv = args[0] + "_VERSION"; this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str()); - this->Makefile->AddDefinition(vv.c_str(), vs.c_str()); + this->Makefile->AddDefinition(vv, vs.c_str()); vv = args[0] + "_VERSION_MAJOR"; this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]); - this->Makefile->AddDefinition(vv.c_str(), vb[0]); + this->Makefile->AddDefinition(vv, vb[0]); vv = args[0] + "_VERSION_MINOR"; this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]); - this->Makefile->AddDefinition(vv.c_str(), vb[1]); + this->Makefile->AddDefinition(vv, vb[1]); vv = args[0] + "_VERSION_PATCH"; this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]); - this->Makefile->AddDefinition(vv.c_str(), vb[2]); + this->Makefile->AddDefinition(vv, vb[2]); vv = args[0] + "_VERSION_TWEAK"; this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]); - this->Makefile->AddDefinition(vv.c_str(), vb[3]); + this->Makefile->AddDefinition(vv, vb[3]); } else if(cmp0048 != cmPolicies::OLD) { @@ -199,7 +199,7 @@ bool cmProjectCommand for(std::vector::iterator i = vv.begin(); i != vv.end(); ++i) { - const char* v = this->Makefile->GetDefinition(i->c_str()); + const char* v = this->Makefile->GetDefinition(*i); if(v && *v) { if(cmp0048 == cmPolicies::WARN) @@ -209,7 +209,7 @@ bool cmProjectCommand } else { - this->Makefile->AddDefinition(i->c_str(), ""); + this->Makefile->AddDefinition(*i, ""); } } } @@ -231,7 +231,7 @@ bool cmProjectCommand } this->Makefile->EnableLanguage(languages, false); std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE"; - const char* include = this->Makefile->GetDefinition(extraInclude.c_str()); + const char* include = this->Makefile->GetDefinition(extraInclude); if(include) { std::string fullFilePath; @@ -244,7 +244,7 @@ bool cmProjectCommand "could not find file:\n" " "; m += include; - this->SetError(m.c_str()); + this->SetError(m); return false; } } diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index ca007cb60..a984260d6 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -32,13 +32,13 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, // Get the variable holding the list of sources. std::string const& sourceList = args[1]; std::string sourceListValue = - this->Makefile->GetSafeDefinition(sourceList.c_str()); + this->Makefile->GetSafeDefinition(sourceList); // Create a rule for all sources listed. for(std::vector::iterator j = (args.begin() + 2); j != args.end(); ++j) { - cmSourceFile *curr = this->Makefile->GetSource(j->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*j); // if we should wrap the class if(!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) { @@ -50,7 +50,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, newName += srcName; newName += ".cxx"; cmSourceFile* sf = - this->Makefile->GetOrCreateSource(newName.c_str(), true); + this->Makefile->GetOrCreateSource(newName, true); if (curr) { sf->SetProperty("ABSTRACT", curr->GetProperty("ABSTRACT")); @@ -99,7 +99,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, std::string no_main_dependency = ""; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(newName.c_str(), + this->Makefile->AddCustomCommandToOutput(newName, depends, no_main_dependency, commandLines, @@ -109,7 +109,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, } // Store the final list of source files. - this->Makefile->AddDefinition(sourceList.c_str(), + this->Makefile->AddDefinition(sourceList, sourceListValue.c_str()); return true; } diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index 2a1129d28..dce59efa1 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -35,15 +35,15 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, std::string const& headerList = args[1]; std::string const& sourceList = args[2]; std::string headerListValue = - this->Makefile->GetSafeDefinition(headerList.c_str()); + this->Makefile->GetSafeDefinition(headerList); std::string sourceListValue = - this->Makefile->GetSafeDefinition(sourceList.c_str()); + this->Makefile->GetSafeDefinition(sourceList); // Create rules for all sources listed. for(std::vector::iterator j = (args.begin() + 3); j != args.end(); ++j) { - cmSourceFile *curr = this->Makefile->GetSource(j->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*j); // if we should wrap the class if(!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) { @@ -131,7 +131,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(hName.c_str(), + this->Makefile->AddCustomCommandToOutput(hName, depends, no_main_dependency, hCommandLines, @@ -139,7 +139,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, no_working_dir); depends.push_back(hName); - this->Makefile->AddCustomCommandToOutput(cxxName.c_str(), + this->Makefile->AddCustomCommandToOutput(cxxName, depends, no_main_dependency, cxxCommandLines, @@ -148,7 +148,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, depends.clear(); depends.push_back(hName); - this->Makefile->AddCustomCommandToOutput(mocName.c_str(), + this->Makefile->AddCustomCommandToOutput(mocName, depends, no_main_dependency, mocCommandLines, @@ -158,9 +158,9 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, } // Store the final list of source files and headers. - this->Makefile->AddDefinition(sourceList.c_str(), + this->Makefile->AddDefinition(sourceList, sourceListValue.c_str()); - this->Makefile->AddDefinition(headerList.c_str(), + this->Makefile->AddDefinition(headerList, headerListValue.c_str()); return true; } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index c32f62480..aa106c7e2 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -188,7 +188,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) mocCppFile += automocTargetName; mocCppFile += ".cpp"; cmSourceFile* mocCppSource = makefile->GetOrCreateSource( - mocCppFile.c_str(), + mocCppFile, true); makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(), false); @@ -278,7 +278,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif { cmTarget* autogenTarget = makefile->AddUtilityCommand( - autogenTargetName.c_str(), true, + autogenTargetName, true, workingDirectory.c_str(), depends, commandLines, false, autogenComment.c_str()); // Set target folder @@ -299,7 +299,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) copyTargetProperty(autogenTarget, target, "FOLDER"); } - target->AddUtility(autogenTargetName.c_str()); + target->AddUtility(autogenTargetName); } return true; @@ -356,7 +356,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) std::string autogenTargetName = getAutogenTargetName(target); makefile->AddDefinition("_moc_target_name", - cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str()); std::string targetDir = getAutogenTargetDir(target); @@ -385,7 +385,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) this->SetupSourceFiles(target); } makefile->AddDefinition("_cpp_files", - cmLocalGenerator::EscapeForCMake(this->Sources.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->Sources).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { this->SetupAutoMocTarget(target, autogenTargetName, @@ -501,7 +501,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target) makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", rcc_output_file.c_str(), false); cmSourceFile* rccCppSource - = makefile->GetOrCreateSource(rcc_output_file.c_str(), true); + = makefile->GetOrCreateSource(rcc_output_file, true); newRccFiles.push_back(rccCppSource); } } @@ -552,11 +552,11 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); std::string _moc_options = (tmp!=0 ? tmp : ""); makefile->AddDefinition("_moc_options", - cmLocalGenerator::EscapeForCMake(_moc_options.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_options).c_str()); makefile->AddDefinition("_skip_moc", - cmLocalGenerator::EscapeForCMake(this->SkipMoc.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->SkipMoc).c_str()); makefile->AddDefinition("_moc_headers", - cmLocalGenerator::EscapeForCMake(this->Headers.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->Headers).c_str()); bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); @@ -568,22 +568,22 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, _moc_incs, _moc_compile_defs); makefile->AddDefinition("_moc_incs", - cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_incs).c_str()); makefile->AddDefinition("_moc_compile_defs", - cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_compile_defs).c_str()); for (std::vector::const_iterator li = configs.begin(); li != configs.end(); ++li) { std::string config_moc_incs; std::string config_moc_compile_defs; - GetCompileDefinitionsAndDirectories(target, li->c_str(), + GetCompileDefinitionsAndDirectories(target, *li, config_moc_incs, config_moc_compile_defs); if (config_moc_incs != _moc_incs) { configIncludes[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_incs.c_str()); + cmLocalGenerator::EscapeForCMake(config_moc_incs); if(_moc_incs.empty()) { _moc_incs = config_moc_incs; @@ -592,7 +592,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_compile_defs != _moc_compile_defs) { configDefines[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_compile_defs.c_str()); + cmLocalGenerator::EscapeForCMake(config_moc_compile_defs); if(_moc_compile_defs.empty()) { _moc_compile_defs = config_moc_compile_defs; @@ -699,7 +699,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::set skipped; std::vector skipVec; - cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec); + cmSystemTools::ExpandListArgument(this->SkipUic, skipVec); for (std::vector::const_iterator li = skipVec.begin(); li != skipVec.end(); ++li) @@ -708,7 +708,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_skip_uic", - cmLocalGenerator::EscapeForCMake(this->SkipUic.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); std::vector uiFilesWithOptions = makefile->GetQtUiFilesWithOptions(); @@ -722,18 +722,18 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!_uic_opts.empty()) { - _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts.c_str()); + _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts); makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); } for (std::vector::const_iterator li = configs.begin(); li != configs.end(); ++li) { std::string config_uic_opts; - GetUicOpts(target, li->c_str(), config_uic_opts); + GetUicOpts(target, *li, config_uic_opts); if (config_uic_opts != _uic_opts) { configUicOptions[*li] = - cmLocalGenerator::EscapeForCMake(config_uic_opts.c_str()); + cmLocalGenerator::EscapeForCMake(config_uic_opts); if(_uic_opts.empty()) { _uic_opts = config_uic_opts; @@ -768,9 +768,9 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_qt_uic_options_files", - cmLocalGenerator::EscapeForCMake(uiFileFiles.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(uiFileFiles).c_str()); makefile->AddDefinition("_qt_uic_options_options", - cmLocalGenerator::EscapeForCMake(uiFileOptions.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(uiFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -914,12 +914,12 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } makefile->AddDefinition("_rcc_files", - cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_rcc_files).c_str()); makefile->AddDefinition("_qt_rcc_options_files", - cmLocalGenerator::EscapeForCMake(rccFileFiles.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(rccFileFiles).c_str()); makefile->AddDefinition("_qt_rcc_options_options", - cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -1034,9 +1034,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, compileDefsProp += "_"; compileDefsProp += config; } - const char *compileDefs = makefile->GetDefinition(compileDefsProp.c_str()); + const char *compileDefs = makefile->GetDefinition(compileDefsProp); this->MocCompileDefinitionsStr = compileDefs ? compileDefs - : makefile->GetSafeDefinition(compileDefsPropOrig.c_str()); + : makefile->GetSafeDefinition(compileDefsPropOrig); } { std::string includesPropOrig = "AM_MOC_INCLUDES"; @@ -1046,9 +1046,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, includesProp += "_"; includesProp += config; } - const char *includes = makefile->GetDefinition(includesProp.c_str()); + const char *includes = makefile->GetDefinition(includesProp); this->MocIncludesStr = includes ? includes - : makefile->GetSafeDefinition(includesPropOrig.c_str()); + : makefile->GetSafeDefinition(includesPropOrig); } this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); @@ -1066,10 +1066,10 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, uicOptionsProp += config; } const char *uicTargetOptions - = makefile->GetSafeDefinition(uicOptionsProp.c_str()); + = makefile->GetSafeDefinition(uicOptionsProp); cmSystemTools::ExpandListArgument( uicTargetOptions ? uicTargetOptions - : makefile->GetSafeDefinition(uicOptionsPropOrig.c_str()), + : makefile->GetSafeDefinition(uicOptionsPropOrig), this->UicTargetOptions); const char *uicOptionsOptions = makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS"); @@ -1168,7 +1168,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile( std::ios::out | std::ios::trunc); outfile << "set(AM_OLD_COMPILE_SETTINGS " << cmLocalGenerator::EscapeForCMake( - this->CurrentCompileSettingsStr.c_str()) << ")\n"; + this->CurrentCompileSettingsStr) << ")\n"; outfile.close(); } diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 7685d40f5..e44b2364a 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -99,7 +99,7 @@ cmScriptGenerator::CreateConfigTest(std::vector const& configs) { result += sep; sep = "|"; - cmScriptGeneratorEncodeConfig(ci->c_str(), result); + cmScriptGeneratorEncodeConfig(*ci, result); } result += ")$\""; return result; diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index 6f620918b..1ee3f29f5 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -53,7 +53,7 @@ bool cmSeparateArgumentsCommand { cmOStringStream e; e << "given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -61,11 +61,11 @@ bool cmSeparateArgumentsCommand if(mode == ModeOld) { // Original space-replacement version of command. - if(const char* def = this->Makefile->GetDefinition(var.c_str())) + if(const char* def = this->Makefile->GetDefinition(var)) { std::string value = def; cmSystemTools::ReplaceString(value, " ", ";"); - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } } else @@ -102,7 +102,7 @@ bool cmSeparateArgumentsCommand value += *si; } } - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } return true; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 36363a134..0ca36eb0b 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -59,7 +59,7 @@ bool cmSetCommand // SET (VAR) // Removes the definition of VAR. if (args.size() == 1) { - this->Makefile->RemoveDefinition(args[0].c_str()); + this->Makefile->RemoveDefinition(args[0]); return true; } // SET (VAR PARENT_SCOPE) // Removes the definition of VAR diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index 62c9b87c7..3d4b7a980 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -30,7 +30,7 @@ bool cmSetDirectoryPropertiesCommand args.end(), errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); } return ret; } @@ -62,7 +62,7 @@ bool cmSetDirectoryPropertiesCommand "Commands and macros cannot be set using SET_CMAKE_PROPERTIES"; return false; } - mf->SetProperty(prop.c_str(), value.c_str()); + mf->SetProperty(prop, value.c_str()); } return true; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 84c7610ea..5f970f82a 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -66,7 +66,7 @@ bool cmSetPropertyCommand cmOStringStream e; e << "given invalid scope " << *arg << ". " << "Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, CACHE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -114,7 +114,7 @@ bool cmSetPropertyCommand { cmOStringStream e; e << "given invalid argument \"" << *arg << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -262,7 +262,7 @@ bool cmSetPropertyCommand::HandleTargetMode() cmOStringStream e; e << "could not find TARGET " << *ni << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -301,7 +301,7 @@ bool cmSetPropertyCommand::HandleSourceMode() ni != this->Names.end(); ++ni) { // Get the source file. - if(cmSourceFile* sf = this->Makefile->GetOrCreateSource(ni->c_str())) + if(cmSourceFile* sf = this->Makefile->GetOrCreateSource(*ni)) { if(!this->HandleSource(sf)) { @@ -312,7 +312,7 @@ bool cmSetPropertyCommand::HandleSourceMode() { cmOStringStream e; e << "given SOURCE name that could not be found or created: " << *ni; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -351,7 +351,7 @@ bool cmSetPropertyCommand::HandleTestMode() { next = ni; ++next; - if(cmTest* test = this->Makefile->GetTest(ni->c_str())) + if(cmTest* test = this->Makefile->GetTest(*ni)) { if(this->HandleTest(test)) { @@ -374,7 +374,7 @@ bool cmSetPropertyCommand::HandleTestMode() { e << " " << *ni << "\n"; } - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; @@ -414,7 +414,7 @@ bool cmSetPropertyCommand::HandleCacheMode() cmOStringStream e; e << "given non-boolean value \"" << this->PropertyValue << "\" for CACHE property \"ADVANCED\". "; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -424,7 +424,7 @@ bool cmSetPropertyCommand::HandleCacheMode() { cmOStringStream e; e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -436,7 +436,7 @@ bool cmSetPropertyCommand::HandleCacheMode() e << "given invalid CACHE property " << this->PropertyName << ". " << "Settable CACHE properties are: " << "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -460,7 +460,7 @@ bool cmSetPropertyCommand::HandleCacheMode() cmOStringStream e; e << "could not find CACHE variable " << *ni << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 619dfc5a5..19c681944 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -51,7 +51,7 @@ bool cmSetSourceFilesPropertiesCommand args.end(), errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); } return ret; } @@ -154,14 +154,14 @@ bool cmSetSourceFilesPropertiesCommand { // get the source file cmSourceFile* sf = - mf->GetOrCreateSource(j->c_str(), generated); + mf->GetOrCreateSource(*j, generated); if(sf) { // now loop through all the props and set them unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - sf->SetProperty(propertyPairs[k].c_str(),propertyPairs[k+1].c_str()); + sf->SetProperty(propertyPairs[k],propertyPairs[k+1].c_str()); } } } diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index fa5aafe4e..bf3519c72 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -78,12 +78,12 @@ bool cmSetTargetPropertiesCommand return false; } bool ret = cmSetTargetPropertiesCommand::SetOneTarget - (args[i].c_str(),propertyPairs,this->Makefile); + (args[i],propertyPairs,this->Makefile); if (!ret) { std::string message = "Can not find target to add properties to: "; message += args[i]; - this->SetError(message.c_str()); + this->SetError(message); return false; } } @@ -101,9 +101,9 @@ bool cmSetTargetPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - target->SetProperty(propertyPairs[k].c_str(), + target->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); - target->CheckProperty(propertyPairs[k].c_str(), mf); + target->CheckProperty(propertyPairs[k], mf); } } // if file is not already in the makefile, then add it diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index c725d358a..b026ff3b1 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -76,12 +76,12 @@ bool cmSetTestsPropertiesCommand { std::string errors; bool ret = - cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(), + cmSetTestsPropertiesCommand::SetOneTest(args[i], propertyPairs, this->Makefile, errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); return ret; } } @@ -101,7 +101,7 @@ bool cmSetTestsPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - test->SetProperty(propertyPairs[k].c_str(), + test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); } } diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 2bdd1ad28..e61caabce 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -31,7 +31,7 @@ bool cmSiteNameCommand paths.push_back("/usr/local/bin"); const char* cacheValue - = this->Makefile->GetDefinition(args[0].c_str()); + = this->Makefile->GetDefinition(args[0]); if(cacheValue) { return true; @@ -85,7 +85,7 @@ bool cmSiteNameCommand } #endif this->Makefile-> - AddCacheDefinition(args[0].c_str(), + AddCacheDefinition(args[0], siteName.c_str(), "Name of the computer/site where compile is being run", cmCacheManager::STRING); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0d3720572..b9b62518b 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -164,14 +164,14 @@ bool cmSourceFile::FindFullPath(std::string* error) } tryPath += this->Location.GetName(); tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di); - if(this->TryFullPath(tryPath.c_str(), "")) + if(this->TryFullPath(tryPath, "")) { return true; } for(std::vector::const_iterator ei = srcExts.begin(); ei != srcExts.end(); ++ei) { - if(this->TryFullPath(tryPath.c_str(), ei->c_str())) + if(this->TryFullPath(tryPath, *ei)) { return true; } @@ -179,7 +179,7 @@ bool cmSourceFile::FindFullPath(std::string* error) for(std::vector::const_iterator ei = hdrExts.begin(); ei != hdrExts.end(); ++ei) { - if(this->TryFullPath(tryPath.c_str(), ei->c_str())) + if(this->TryFullPath(tryPath, *ei)) { return true; } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 9cb80f617..365665df6 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -78,7 +78,7 @@ bool cmSourceGroupCommand else if(doingFiles) { // Convert name to full path and add to the group's list. - std::string src = args[i].c_str(); + std::string src = args[i]; if(!cmSystemTools::FileIsFullPath(src.c_str())) { src = this->Makefile->GetCurrentDirectory(); @@ -86,14 +86,14 @@ bool cmSourceGroupCommand src += args[i]; } src = cmSystemTools::CollapseFullPath(src.c_str()); - sg->AddGroupFile(src.c_str()); + sg->AddGroupFile(src); } else { cmOStringStream err; err << "Unknown argument \"" << args[i].c_str() << "\". " << "Perhaps the FILES keyword is missing.\n"; - this->SetError(err.str().c_str()); + this->SetError(err.str()); return false; } } diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index f9b69e329..7bc7b0581 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -103,7 +103,7 @@ bool cmStringCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -115,15 +115,15 @@ bool cmStringCommand::HandleHashCommand(std::vector const& args) { cmOStringStream e; e << args[0] << " requires an output variable and an input string"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmsys::auto_ptr hash(cmCryptoHash::New(args[0].c_str())); if(hash.get()) { - std::string out = hash->HashString(args[2].c_str()); - this->Makefile->AddDefinition(args[1].c_str(), out.c_str()); + std::string out = hash->HashString(args[2]); + this->Makefile->AddDefinition(args[1], out.c_str()); return true; } return false; @@ -158,7 +158,7 @@ bool cmStringCommand::HandleToUpperLowerCommand( } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -185,12 +185,12 @@ bool cmStringCommand::HandleAsciiCommand(std::vector const& args) std::string error = "Character with code "; error += args[cc]; error += " does not exist."; - this->SetError(error.c_str()); + this->SetError(error); return false; } } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -226,7 +226,7 @@ bool cmStringCommand::HandleConfigureCommand( { cmOStringStream err; err << "Unrecognized argument \"" << args[i] << "\""; - this->SetError(err.str().c_str()); + this->SetError(err.str()); return false; } } @@ -236,7 +236,7 @@ bool cmStringCommand::HandleConfigureCommand( this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes); // Store the output in the provided variable. - this->Makefile->AddDefinition(args[2].c_str(), output.c_str()); + this->Makefile->AddDefinition(args[2], output.c_str()); return true; } @@ -282,7 +282,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector const& args) } std::string e = "sub-command REGEX does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -308,7 +308,7 @@ bool cmStringCommand::RegexMatch(std::vector const& args) { std::string e = "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -324,14 +324,14 @@ bool cmStringCommand::RegexMatch(std::vector const& args) std::string e = "sub-command REGEX, mode MATCH regex \""+regex+ "\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } output = input.substr(l, r-l); } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -358,7 +358,7 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) std::string e = "sub-command REGEX, mode MATCHALL failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -374,7 +374,7 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) { std::string e = "sub-command REGEX, mode MATCHALL regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } if(output.length() > 0) @@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector const& args) } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -439,7 +439,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) std::string e = "sub-command REGEX, mode REPLACE: Unknown escape \""; e += replace.substr(r, 2); e += "\" in replace-expression."; - this->SetError(e.c_str()); + this->SetError(e); return false; } r += 2; @@ -462,7 +462,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) std::string e = "sub-command REGEX, mode REPLACE failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -483,7 +483,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) { std::string e = "sub-command REGEX, mode REPLACE regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -513,7 +513,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) "sub-command REGEX, mode REPLACE: replace expression \""+ replace+"\" contains an out-of-range escape for regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } @@ -527,7 +527,7 @@ bool cmStringCommand::RegexReplace(std::vector const& args) output += input.substr(base, input.length()-base); // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -616,12 +616,12 @@ bool cmStringCommand::HandleFindCommand(std::vector const& { cmOStringStream s; s << pos; - this->Makefile->AddDefinition(outvar.c_str(), s.str().c_str()); + this->Makefile->AddDefinition(outvar, s.str().c_str()); return true; } // the character was not found, but this is not really an error - this->Makefile->AddDefinition(outvar.c_str(), "-1"); + this->Makefile->AddDefinition(outvar, "-1"); return true; } @@ -643,7 +643,7 @@ bool cmStringCommand::HandleCompareCommand(std::vector const& std::string e = "sub-command COMPARE, mode "; e += mode; e += " needs at least 5 arguments total to command."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -669,16 +669,16 @@ bool cmStringCommand::HandleCompareCommand(std::vector const& } if(result) { - this->Makefile->AddDefinition(outvar.c_str(), "1"); + this->Makefile->AddDefinition(outvar, "1"); } else { - this->Makefile->AddDefinition(outvar.c_str(), "0"); + this->Makefile->AddDefinition(outvar, "0"); } return true; } std::string e = "sub-command COMPARE does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -705,7 +705,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector const& cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); - this->Makefile->AddDefinition(variableName.c_str(), input.c_str()); + this->Makefile->AddDefinition(variableName, input.c_str()); return true; } @@ -731,7 +731,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector const& cmOStringStream ostr; ostr << "begin index: " << begin << " is out of range 0 - " << stringLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } int leftOverLength = intStringLength - begin; @@ -740,11 +740,11 @@ bool cmStringCommand::HandleSubstringCommand(std::vector const& cmOStringStream ostr; ostr << "end index: " << end << " is out of range -1 - " << leftOverLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(begin, end).c_str()); return true; } @@ -766,7 +766,7 @@ bool cmStringCommand char buffer[1024]; sprintf(buffer, "%d", static_cast(length)); - this->Makefile->AddDefinition(variableName.c_str(), buffer); + this->Makefile->AddDefinition(variableName, buffer); return true; } @@ -787,7 +787,7 @@ bool cmStringCommand value += args[i]; } - this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + this->Makefile->AddDefinition(variableName, value.c_str()); return true; } @@ -804,7 +804,7 @@ bool cmStringCommand const std::string& input = args[1]; const std::string& variableName = args[2]; - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, cmSystemTools::MakeCidentifier(input.c_str()).c_str()); return true; } @@ -853,7 +853,7 @@ bool cmStringCommand::HandleStripCommand( outLength=endPos - startPos + 1; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(startPos, outLength).c_str()); return true; } @@ -937,7 +937,7 @@ bool cmStringCommand } result.push_back(0); - this->Makefile->AddDefinition(variableName.c_str(), &*result.begin()); + this->Makefile->AddDefinition(variableName, &*result.begin()); return true; } @@ -977,14 +977,14 @@ bool cmStringCommand { std::string e = " TIMESTAMP sub-command does not recognize option " + args[argsIndex] + "."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } cmTimestamp timestamp; std::string result = timestamp.CurrentTime(formatString, utcFlag); - this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str()); + this->Makefile->AddDefinition(outputVariable, result.c_str()); return true; } diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index e497b4642..cdde91687 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -47,7 +47,7 @@ bool cmSubdirCommand std::string binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + i->c_str(); - this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, preorder, false); } // otherwise it is a full path @@ -57,15 +57,15 @@ bool cmSubdirCommand // element from the source path and use that std::string binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) + - "/" + cmSystemTools::GetFilenameName(i->c_str()); - this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(), + "/" + cmSystemTools::GetFilenameName(*i); + this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, preorder, false); } else { std::string error = "Incorrect SUBDIRS command. Directory: "; error += *i + " does not exist."; - this->SetError(error.c_str()); + this->SetError(error); res = false; } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 39b53bf5f..ef1e37b32 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -990,7 +990,7 @@ void cmSystemTools::GlobDirs(const std::string& path, if(cmSystemTools::FileIsDirectory(fname.c_str())) { fname += finishPath; - cmSystemTools::GlobDirs(fname.c_str(), files); + cmSystemTools::GlobDirs(fname, files); } } } @@ -2105,7 +2105,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) // remove symlinks exe = cmSystemTools::GetRealPath(exe.c_str()); exe_dir = - cmSystemTools::GetFilenamePath(exe.c_str()); + cmSystemTools::GetFilenamePath(exe); } else { @@ -2288,7 +2288,7 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, std::vector cmds; cmds.push_back("otool"); cmds.push_back("-D"); - cmds.push_back(fullPath.c_str()); + cmds.push_back(fullPath); std::string output; if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4432244b7..c785192ba 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -325,7 +325,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } std::string property = *p; property += configUpper; - this->SetPropertyDefault(property.c_str(), 0); + this->SetPropertyDefault(property, 0); } // Initialize per-configuration name postfix property from the @@ -338,7 +338,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) { std::string property = cmSystemTools::UpperCase(*ci); property += "_POSTFIX"; - this->SetPropertyDefault(property.c_str(), 0); + this->SetPropertyDefault(property, 0); } } @@ -626,7 +626,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& s) << s << "\" expanded to \"" << src << "\" in target \"" << this->GetName() << "\". This behavior will be removed in a " "future version of CMake."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return 0; @@ -634,7 +634,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& s) } } - cmSourceFile* sf = this->Makefile->GetOrCreateSource(src.c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(src); this->AddSourceFile(sf); return sf; } @@ -669,9 +669,9 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf, for( ; i != libs.end(); ++i ) { // This is equivalent to the target_link_libraries plain signature. - this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second ); + this->AddLinkLibrary( mf, selfname, i->first, i->second ); this->AppendProperty("INTERFACE_LINK_LIBRARIES", - this->GetDebugGeneratorExpressions(i->first.c_str(), i->second).c_str()); + this->GetDebugGeneratorExpressions(i->first, i->second).c_str()); } this->PrevLinkedLibraries = libs; } @@ -731,12 +731,12 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, depname += "_LIB_DEPENDS"; if (this->RecordDependencies) { - mf.AddCacheDefinition(depname.c_str(), "", + mf.AddCacheDefinition(depname, "", "Dependencies for target", cmCacheManager::STATIC); } else { - if (mf.GetDefinition( depname.c_str() )) + if (mf.GetDefinition( depname )) { std::string message = "Target "; message += target; @@ -782,7 +782,7 @@ void cmTarget::GetDirectLinkLibraries(const std::string& config, for (std::set::const_iterator it = seenProps.begin(); it != seenProps.end(); ++it) { - if (!this->GetProperty(it->c_str())) + if (!this->GetProperty(*it)) { this->LinkImplicitNullProperties.insert(*it); } @@ -954,7 +954,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string targetEntry = target; targetEntry += "_LIB_DEPENDS"; std::string dependencies; - const char* old_val = mf.GetDefinition( targetEntry.c_str() ); + const char* old_val = mf.GetDefinition( targetEntry ); if( old_val ) { dependencies += old_val; @@ -974,7 +974,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, dependencies += ";"; dependencies += lib; dependencies += ";"; - mf.AddCacheDefinition( targetEntry.c_str(), dependencies.c_str(), + mf.AddCacheDefinition( targetEntry, dependencies.c_str(), "Dependencies for the target", cmCacheManager::STATIC ); } @@ -1248,7 +1248,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, return; } - const char* deps = mf.GetDefinition( (lib.first+"_LIB_DEPENDS").c_str() ); + const char* deps = mf.GetDefinition( lib.first+"_LIB_DEPENDS" ); if( deps && strcmp(deps,"") != 0 ) { // Make sure this library is in the map, even if it has an empty @@ -1340,7 +1340,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -1348,7 +1348,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) { cmOStringStream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(prop == "INCLUDE_DIRECTORIES") @@ -1389,7 +1389,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "LINK_LIBRARIES") @@ -1415,14 +1415,14 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(prop == "INCLUDE_DIRECTORIES") @@ -1457,7 +1457,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "LINK_LIBRARIES") @@ -1654,7 +1654,7 @@ static void processIncludeDirectories(cmTarget const* tgt, "successfully.\n" "* The installation package was faulty and references files it " "does not provide.\n"; - tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + tgt->GetMakefile()->IssueMessage(messageType, e.str()); return; } @@ -1693,7 +1693,7 @@ static void processIncludeDirectories(cmTarget const* tgt, } if (!noMessage) { - tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + tgt->GetMakefile()->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return; @@ -2154,7 +2154,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, { std::string configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName.c_str()); + const char *configProp = this->GetProperty(configPropName); if (configProp) { switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) @@ -2165,7 +2165,7 @@ void cmTarget::GetCompileDefinitions(std::vector &list, e << this->Makefile->GetCMakeInstance()->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0043); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str().c_str()); + e.str()); } case cmPolicies::OLD: { @@ -2557,7 +2557,7 @@ const char* cmTarget::GetFeature(const std::string& feature, std::string featureConfig = feature; featureConfig += "_"; featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig.c_str())) + if(const char* value = this->GetProperty(featureConfig)) { return value; } @@ -2606,7 +2606,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $, " "as appropriate.\n"; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); } return messageType != cmake::FATAL_ERROR; @@ -2622,7 +2622,7 @@ const char *cmTarget::GetProperty(const std::string& prop, cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return 0; } @@ -3007,7 +3007,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, for(std::vector::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { - tsl.Consider(li->c_str()); + tsl.Consider(*li); } // Now consider languages that propagate from linked targets. @@ -3015,9 +3015,9 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; - if(this->Makefile->IsOn(propagates.c_str())) + if(this->Makefile->IsOn(propagates)) { - tsl.Consider(sit->c_str()); + tsl.Consider(*sit); } } @@ -3096,7 +3096,7 @@ std::string cmTarget::GetPDBName(const std::string& config) const for(std::vector::const_iterator i = props.begin(); i != props.end(); ++i) { - if(const char* outName = this->GetProperty(i->c_str())) + if(const char* outName = this->GetProperty(*i)) { base = outName; break; @@ -3117,7 +3117,7 @@ std::string cmTarget::GetCompilePDBName(const std::string& config) const std::string configUpper = cmSystemTools::UpperCase(config); std::string configProp = "COMPILE_PDB_NAME_"; configProp += configUpper; - const char* config_name = this->GetProperty(configProp.c_str()); + const char* config_name = this->GetProperty(configProp); if(config_name && *config_name) { return prefix + config_name + ".pdb"; @@ -3340,7 +3340,7 @@ std::string cmTarget::NormalGetRealName(const std::string& config) const msg += this->GetName(); this->GetMakefile()-> IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); + msg); } if(this->GetType() == cmTarget::EXECUTABLE) @@ -3518,7 +3518,7 @@ void cmTarget::GetFullNameInternal(const std::string& config, { std::string configProp = cmSystemTools::UpperCase(config); configProp += "_POSTFIX"; - configPostfix = this->GetProperty(configProp.c_str()); + configPostfix = this->GetProperty(configProp); // Mac application bundles and frameworks have no postfix. if(configPostfix && (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) @@ -3536,12 +3536,12 @@ void cmTarget::GetFullNameInternal(const std::string& config, if(!targetSuffix && suffixVar && *suffixVar) { std::string langSuff = suffixVar + std::string("_") + ll; - targetSuffix = this->Makefile->GetDefinition(langSuff.c_str()); + targetSuffix = this->Makefile->GetDefinition(langSuff); } if(!targetPrefix && prefixVar && *prefixVar) { std::string langPrefix = prefixVar + std::string("_") + ll; - targetPrefix = this->Makefile->GetDefinition(langPrefix.c_str()); + targetPrefix = this->Makefile->GetDefinition(langPrefix); } } @@ -3621,7 +3621,7 @@ void cmTarget::GetLibraryNames(std::string& name, std::string msg = "GetLibraryNames called on imported target: "; msg += this->GetName(); this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); + msg); return; } @@ -3725,7 +3725,7 @@ void cmTarget::GetExecutableNames(std::string& name, std::string msg = "GetExecutableNames called on imported target: "; msg += this->GetName(); - this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg.c_str()); + this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg); } // This versioning is supported only for executables and then only @@ -3800,7 +3800,7 @@ void cmTarget::SetPropertyDefault(const std::string& property, std::string var = "CMAKE_"; var += property; - if(const char* value = this->Makefile->GetDefinition(var.c_str())) + if(const char* value = this->Makefile->GetDefinition(var)) { this->SetProperty(property, value); } @@ -3874,7 +3874,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; flagVar += ll; flagVar += "_FLAG"; - if(!this->Makefile->IsSet(flagVar.c_str())) + if(!this->Makefile->IsSet(flagVar)) { // There is no rpath support on this platform so nothing needs // relinking. @@ -4093,7 +4093,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", conf, suffix.c_str(), out); + AppendDirectoryForConfig("/", conf, suffix, out); } return usesDefaultOutputDir; @@ -4198,7 +4198,7 @@ std::string cmTarget::GetOutputName(const std::string& config, for(std::vector::const_iterator i = props.begin(); i != props.end(); ++i) { - if(const char* outName = this->GetProperty(i->c_str())) + if(const char* outName = this->GetProperty(*i)) { return outName; } @@ -4516,7 +4516,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, PropertyType propContent = getTypedProperty(tgt, p.c_str(), 0); const bool explicitlySet = tgt->GetProperties() - .find(p.c_str()) + .find(p) != tgt->GetProperties().end(); const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p); @@ -4891,7 +4891,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; sepVar += ll; sepVar += "_FLAG_SEP"; - const char* sep = this->Makefile->GetDefinition(sepVar.c_str()); + const char* sep = this->Makefile->GetDefinition(sepVar); if(sep && *sep) { // TODO: Add ELF check to ABI detection and get rid of @@ -4980,7 +4980,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, { std::string mapProp = "MAP_IMPORTED_CONFIG_"; mapProp += desired_config; - if(const char* mapValue = this->GetProperty(mapProp.c_str())) + if(const char* mapValue = this->GetProperty(mapProp)) { cmSystemTools::ExpandListArgument(mapValue, mappedConfigs); } @@ -4996,15 +4996,15 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, !*loc && !*imp && mci != mappedConfigs.end(); ++mci) { // Look for this configuration. - std::string mcUpper = cmSystemTools::UpperCase(mci->c_str()); + std::string mcUpper = cmSystemTools::UpperCase(*mci); std::string locProp = "IMPORTED_LOCATION_"; locProp += mcUpper; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB_"; impProp += mcUpper; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } // If it was found, use it for all properties below. @@ -5029,12 +5029,12 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, { std::string locProp = "IMPORTED_LOCATION"; locProp += suffix; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } } @@ -5071,12 +5071,12 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, suffix += cmSystemTools::UpperCase(*aci); std::string locProp = "IMPORTED_LOCATION"; locProp += suffix; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } } } @@ -5112,7 +5112,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, // Get the link interface. { std::string linkProp = "INTERFACE_LINK_LIBRARIES"; - const char *propertyLibs = this->GetProperty(linkProp.c_str()); + const char *propertyLibs = this->GetProperty(linkProp); if (this->GetType() != INTERFACE_LIBRARY) { @@ -5120,13 +5120,13 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; linkProp += suffix; - propertyLibs = this->GetProperty(linkProp.c_str()); + propertyLibs = this->GetProperty(linkProp); } if(!propertyLibs) { linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; - propertyLibs = this->GetProperty(linkProp.c_str()); + propertyLibs = this->GetProperty(linkProp); } } if(propertyLibs) @@ -5139,7 +5139,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp, 0, 0); cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) ->Evaluate(this->Makefile, - desired_config.c_str(), + desired_config, false, headTarget, this, @@ -5164,7 +5164,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string impProp = "IMPORTED_LOCATION"; impProp += suffix; - if(const char* config_location = this->GetProperty(impProp.c_str())) + if(const char* config_location = this->GetProperty(impProp)) { info.Location = config_location; } @@ -5179,7 +5179,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string soProp = "IMPORTED_SONAME"; soProp += suffix; - if(const char* config_soname = this->GetProperty(soProp.c_str())) + if(const char* config_soname = this->GetProperty(soProp)) { info.SOName = config_soname; } @@ -5194,7 +5194,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string soProp = "IMPORTED_NO_SONAME"; soProp += suffix; - if(const char* config_no_soname = this->GetProperty(soProp.c_str())) + if(const char* config_no_soname = this->GetProperty(soProp)) { info.NoSOName = cmSystemTools::IsOn(config_no_soname); } @@ -5214,7 +5214,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - if(const char* config_implib = this->GetProperty(impProp.c_str())) + if(const char* config_implib = this->GetProperty(impProp)) { info.ImportLibrary = config_implib; } @@ -5228,7 +5228,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES"; linkProp += suffix; - if(const char* config_libs = this->GetProperty(linkProp.c_str())) + if(const char* config_libs = this->GetProperty(linkProp)) { cmSystemTools::ExpandListArgument(config_libs, info.LinkInterface.SharedDeps); @@ -5245,7 +5245,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES"; linkProp += suffix; - if(const char* config_libs = this->GetProperty(linkProp.c_str())) + if(const char* config_libs = this->GetProperty(linkProp)) { cmSystemTools::ExpandListArgument(config_libs, info.LinkInterface.Languages); @@ -5263,7 +5263,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; linkProp += suffix; - if(const char* config_reps = this->GetProperty(linkProp.c_str())) + if(const char* config_reps = this->GetProperty(linkProp)) { sscanf(config_reps, "%u", &info.LinkInterface.Multiplicity); } @@ -5380,7 +5380,7 @@ void processILibs(const std::string& config, std::vector& tgts, std::set& emitted) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(name.c_str())) + ->FindTargetToUse(name)) { if (emitted.insert(tgt).second) { @@ -5437,7 +5437,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, it != iface->Libraries.end(); ++it) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(it->c_str())) + ->FindTargetToUse(*it)) { tgts.push_back(tgt); } @@ -5471,7 +5471,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, it != libs.end(); ++it) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(it->c_str())) + ->FindTargetToUse(*it)) { tgts.push_back(tgt); } @@ -5504,7 +5504,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); } else if(this->GetType() == cmTarget::SHARED_LIBRARY || this->IsExecutableWithExports()) @@ -5515,13 +5515,13 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // Lookup the per-configuration property. linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; linkIfaceProp += suffix; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); // If not set, try the generic property. if(!explicitLibraries) { linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); } } @@ -5742,7 +5742,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, // dependencies? std::string propName = "LINK_INTERFACE_MULTIPLICITY"; propName += suffix; - if(const char* config_reps = thisTarget->GetProperty(propName.c_str())) + if(const char* config_reps = thisTarget->GetProperty(propName)) { sscanf(config_reps, "%u", &iface.Multiplicity); } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 8dc407b5a..115a98806 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand // Lookup the target for which libraries are specified. this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0]); if(!this->Target) { cmake::MessageType t = cmake::FATAL_ERROR; // fail by default @@ -124,7 +124,7 @@ bool cmTargetLinkLibrariesCommand ->GetPolicyWarning(cmPolicies::CMP0039) << "\n" "Utility target \"" << this->Target->GetName() << "\" " << modal << " not be used as the target of a target_link_libraries call."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if(messageType == cmake::FATAL_ERROR) { return false; @@ -289,7 +289,7 @@ bool cmTargetLinkLibrariesCommand std::string linkType = args[0]; linkType += "_LINK_TYPE"; const char* linkTypeString = - this->Makefile->GetDefinition( linkType.c_str() ); + this->Makefile->GetDefinition( linkType ); if(linkTypeString) { if(strcmp(linkTypeString, "debug") == 0) @@ -407,7 +407,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, sig == cmTarget::KeywordTLLSignature ? cmTarget::PlainTLLSignature : cmTarget::KeywordTLLSignature); - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if(messageType == cmake::FATAL_ERROR) { return false; @@ -479,7 +479,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - this->Target->AppendProperty(prop.c_str(), lib.c_str()); + this->Target->AppendProperty(prop, lib.c_str()); } } if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) @@ -494,9 +494,9 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - if(!this->Target->GetProperty(prop.c_str())) + if(!this->Target->GetProperty(prop)) { - this->Target->SetProperty(prop.c_str(), ""); + this->Target->SetProperty(prop, ""); } } } diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 1a1cfa064..d35661137 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -34,7 +34,7 @@ bool cmTargetPropCommandBase } this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0]); if(!this->Target) { this->Target = this->Makefile->FindTargetToUse(args[0]); @@ -165,15 +165,15 @@ void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt, if (prepend) { const std::string propName = std::string("INTERFACE_") + this->Property; - const char *propValue = tgt->GetProperty(propName.c_str()); + const char *propValue = tgt->GetProperty(propName); const std::string totalContent = this->Join(content) + (propValue ? std::string(";") + propValue : std::string()); - tgt->SetProperty(propName.c_str(), totalContent.c_str()); + tgt->SetProperty(propName, totalContent.c_str()); } else { - tgt->AppendProperty(("INTERFACE_" + this->Property).c_str(), + tgt->AppendProperty("INTERFACE_" + this->Property, this->Join(content).c_str()); } } diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index a21e1aae3..c1b1f8b98 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -97,7 +97,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Generate the command line with full escapes. cmLocalGenerator* lg = mf->GetLocalGenerator(); - os << lg->EscapeForCMake(exe.c_str()); + os << lg->EscapeForCMake(exe); for(std::vector::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index cfedaa5f1..cc6e139ca 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -162,7 +162,7 @@ bool cmTryRunCommand // now put the output into the variables if(this->RunOutputVariable.size()) { - this->Makefile->AddDefinition(this->RunOutputVariable.c_str(), + this->Makefile->AddDefinition(this->RunOutputVariable, runOutputContents.c_str()); } @@ -171,12 +171,12 @@ bool cmTryRunCommand // if the TryCompileCore saved output in this outputVariable then // prepend that output to this output const char* compileOutput - = this->Makefile->GetDefinition(this->OutputVariable.c_str()); + = this->Makefile->GetDefinition(this->OutputVariable); if (compileOutput) { runOutputContents = std::string(compileOutput) + runOutputContents; } - this->Makefile->AddDefinition(this->OutputVariable.c_str(), + this->Makefile->AddDefinition(this->OutputVariable, runOutputContents.c_str()); } } @@ -214,7 +214,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, { strcpy(retChar, "FAILED_TO_RUN"); } - this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(), retChar, + this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, "Result of TRY_RUN", cmCacheManager::INTERNAL); } @@ -235,10 +235,10 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, copyDest += cmake::GetCMakeFilesDirectory(); copyDest += "/"; copyDest += cmSystemTools::GetFilenameWithoutExtension( - this->OutputFile.c_str()); + this->OutputFile); copyDest += "-"; copyDest += this->RunResultVariable; - copyDest += cmSystemTools::GetFilenameExtension(this->OutputFile.c_str()); + copyDest += cmSystemTools::GetFilenameExtension(this->OutputFile); cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), copyDest.c_str()); std::string resultFileName = this->Makefile->GetHomeOutputDirectory(); @@ -250,7 +250,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, std::string internalRunOutputName=this->RunResultVariable+"__TRYRUN_OUTPUT"; bool error = false; - if (this->Makefile->GetDefinition(this->RunResultVariable.c_str()) == 0) + if (this->Makefile->GetDefinition(this->RunResultVariable) == 0) { // if the variables doesn't exist, create it with a helpful error text // and mark it as advanced @@ -258,7 +258,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment += "Run result of TRY_RUN(), indicates whether the executable " "would have been able to run on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(), + this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", comment.c_str(), cmCacheManager::STRING); @@ -276,7 +276,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, // is the output from the executable used ? if (out!=0) { - if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0) + if (this->Makefile->GetDefinition(internalRunOutputName) == 0) { // if the variables doesn't exist, create it with a helpful error text // and mark it as advanced @@ -285,7 +285,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "would have printed on stdout and stderr on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(), + this->Makefile->AddCacheDefinition(internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); @@ -355,13 +355,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, file << comment << "\n\n"; file << "set( " << this->RunResultVariable << " \n \"" - << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) + << this->Makefile->GetDefinition(this->RunResultVariable) << "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n"; if (out!=0) { file << "set( " << internalRunOutputName << " \n \"" - << this->Makefile->GetDefinition(internalRunOutputName.c_str()) + << this->Makefile->GetDefinition(internalRunOutputName) << "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n"; } file.close(); @@ -383,6 +383,6 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, if (out!=0) { - (*out) = this->Makefile->GetDefinition(internalRunOutputName.c_str()); + (*out) = this->Makefile->GetDefinition(internalRunOutputName); } } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index d4ec20f8c..60796ec4f 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -38,7 +38,7 @@ bool cmUseMangledMesaCommand std::string e = "Bad path to Mesa, could not find: "; e += glh; e += " "; - this->SetError(e.c_str()); + this->SetError(e); return false; } const char* destDir = args[1].c_str(); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 11e510805..ba6b4acfa 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -29,7 +29,7 @@ bool cmUtilitySourceCommand // The first argument is the cache entry name. std::string cacheEntry = *arg++; const char* cacheValue = - this->Makefile->GetDefinition(cacheEntry.c_str()); + this->Makefile->GetDefinition(cacheEntry); // If it exists already and appears up to date then we are done. If // the string contains "(IntDir)" but that is not the // CMAKE_CFG_INTDIR setting then the value is out of date. @@ -113,14 +113,14 @@ bool cmUtilitySourceCommand cmSystemTools::ReplaceString(utilityExecutable, "/./", "/"); // Enter the value into the cache. - this->Makefile->AddCacheDefinition(cacheEntry.c_str(), + this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", cmCacheManager::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); - this->Makefile->AddCacheDefinition(utilityExecutable.c_str(), + this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), "Executable to project name.", cmCacheManager::INTERNAL); diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index ddb40034e..80c128654 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -26,7 +26,7 @@ bool cmVariableRequiresCommand } std::string testVariable = args[0]; - if(!this->Makefile->IsOn(testVariable.c_str())) + if(!this->Makefile->IsOn(testVariable)) { return true; } @@ -36,7 +36,7 @@ bool cmVariableRequiresCommand bool hasAdvanced = false; for(unsigned int i = 2; i < args.size(); ++i) { - if(!this->Makefile->IsOn(args[i].c_str())) + if(!this->Makefile->IsOn(args[i])) { requirementsMet = false; notSet += args[i]; @@ -49,13 +49,13 @@ bool cmVariableRequiresCommand } } } - const char* reqVar = this->Makefile->GetDefinition(resultVariable.c_str()); + const char* reqVar = this->Makefile->GetDefinition(resultVariable); // if reqVar is unset, then set it to requirementsMet // if reqVar is set to true, but requirementsMet is false , then // set reqVar to false. if(!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) { - this->Makefile->AddDefinition(resultVariable.c_str(), requirementsMet); + this->Makefile->AddDefinition(resultVariable, requirementsMet); } if(!requirementsMet) diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 33e159bce..3c1fe466c 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -137,7 +137,7 @@ bool cmVariableWatchCommand { cmOStringStream ostr; ostr << "cannot be set on the variable: " << variable.c_str(); - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index aa6b9f882..af955ecf8 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -47,7 +47,7 @@ bool cmWriteFileCommand { std::string e = "attempted to write a file: " + fileName + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -79,7 +79,7 @@ bool cmWriteFileCommand std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for writing."; - this->SetError(error.c_str()); + this->SetError(error); return false; } file << message << std::endl; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d37bd940f..ad8e5e61d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -306,7 +306,7 @@ void cmake::RemoveUnscriptableCommands() it != unscriptableCommands.end(); ++it) { - this->RemoveCommand(it->c_str()); + this->RemoveCommand(*it); } } @@ -335,23 +335,23 @@ bool cmake::SetCacheArgs(const std::vector& args) } std::string var, value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type)) + if(cmCacheManager::ParseEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so // we can't compare whether the value is already in the cache until // after we call AddCacheEntry. const char *cachedValue = - this->CacheManager->GetCacheValue(var.c_str()); + this->CacheManager->GetCacheValue(var); - this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(), + this->CacheManager->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); if(this->WarnUnusedCli) { if (!cachedValue - || strcmp(this->CacheManager->GetCacheValue(var.c_str()), + || strcmp(this->CacheManager->GetCacheValue(var), cachedValue) != 0) { - this->WatchUnusedCli(var.c_str()); + this->WatchUnusedCli(var); } } } @@ -390,7 +390,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } cmsys::RegularExpression regex( - cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str()); + cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector entriesToDelete; cmCacheManager::CacheIterator it = @@ -414,7 +414,7 @@ bool cmake::SetCacheArgs(const std::vector& args) currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(currentEntry->c_str()); + this->CacheManager->RemoveCacheEntry(*currentEntry); } } else if(arg.find("-C",0) == 0) @@ -486,13 +486,13 @@ void cmake::ReadListFile(const std::vector& args, { cmsys::auto_ptr lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); @@ -526,13 +526,13 @@ bool cmake::FindPackage(const std::vector& args) cmsys::auto_ptr lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetArgcArgv(args); @@ -566,7 +566,7 @@ bool cmake::FindPackage(const std::vector& args) cmSystemTools::ExpandListArgument(includes, includeDirs); std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, - language.c_str(), false); + language, false); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); printf("%s %s\n", includeFlags.c_str(), definitions.c_str()); @@ -585,7 +585,7 @@ bool cmake::FindPackage(const std::vector& args) libIt != libList.end(); ++libIt) { - mf->AddLinkLibraryForTarget(targetName, libIt->c_str(), + mf->AddLinkLibraryForTarget(targetName, *libIt, cmTarget::GENERAL); } @@ -636,7 +636,7 @@ void cmake::SetArgs(const std::vector& args, std::string path = arg.substr(2); path = cmSystemTools::CollapseFullPath(path.c_str()); cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeDirectory(path.c_str()); + this->SetHomeDirectory(path); } else if(arg.find("-S",0) == 0) { @@ -652,7 +652,7 @@ void cmake::SetArgs(const std::vector& args, std::string path = arg.substr(2); path = cmSystemTools::CollapseFullPath(path.c_str()); cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeOutputDirectory(path.c_str()); + this->SetHomeOutputDirectory(path); } else if((i < args.size()-2) && (arg.find("--check-build-system",0) == 0)) { @@ -790,7 +790,7 @@ void cmake::SetArgs(const std::vector& args, value = args[i]; } cmGlobalGenerator* gen = - this->CreateGlobalGenerator(value.c_str()); + this->CreateGlobalGenerator(value); if(!gen) { cmSystemTools::Error("Could not create named generator ", @@ -811,13 +811,13 @@ void cmake::SetArgs(const std::vector& args, if(!directoriesSet) { this->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); } this->SetStartDirectory(this->GetHomeDirectory()); @@ -853,15 +853,15 @@ void cmake::SetDirectoriesFromFile(const char* arg) { argIsFile = true; std::string fullPath = cmSystemTools::CollapseFullPath(arg); - std::string name = cmSystemTools::GetFilenameName(fullPath.c_str()); + std::string name = cmSystemTools::GetFilenameName(fullPath); name = cmSystemTools::LowerCase(name); if(name == "cmakecache.txt") { - cachePath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + cachePath = cmSystemTools::GetFilenamePath(fullPath); } else if(name == "cmakelists.txt") { - listPath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + listPath = cmSystemTools::GetFilenamePath(fullPath); } } else @@ -869,12 +869,12 @@ void cmake::SetDirectoriesFromFile(const char* arg) // Specified file or directory does not exist. Try to set things // up to produce a meaningful error message. std::string fullPath = cmSystemTools::CollapseFullPath(arg); - std::string name = cmSystemTools::GetFilenameName(fullPath.c_str()); + std::string name = cmSystemTools::GetFilenameName(fullPath); name = cmSystemTools::LowerCase(name); if(name == "cmakecache.txt" || name == "cmakelists.txt") { argIsFile = true; - listPath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + listPath = cmSystemTools::GetFilenamePath(fullPath); } else { @@ -887,11 +887,11 @@ void cmake::SetDirectoriesFromFile(const char* arg) { cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(cachem->LoadCache(cachePath.c_str()) && + if(cachem->LoadCache(cachePath) && it.Find("CMAKE_HOME_DIRECTORY")) { - this->SetHomeOutputDirectory(cachePath.c_str()); - this->SetStartOutputDirectory(cachePath.c_str()); + this->SetHomeOutputDirectory(cachePath); + this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(it.GetValue()); this->SetStartDirectory(it.GetValue()); return; @@ -901,23 +901,23 @@ void cmake::SetDirectoriesFromFile(const char* arg) // If there is a CMakeLists.txt file, use it as the source tree. if(listPath.length() > 0) { - this->SetHomeDirectory(listPath.c_str()); - this->SetStartDirectory(listPath.c_str()); + this->SetHomeDirectory(listPath); + this->SetStartDirectory(listPath); if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. - this->SetHomeOutputDirectory(listPath.c_str()); - this->SetStartOutputDirectory(listPath.c_str()); + this->SetHomeOutputDirectory(listPath); + this->SetStartOutputDirectory(listPath); } else { // Source directory given on command line. Use current working // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->SetHomeOutputDirectory(cwd.c_str()); - this->SetStartOutputDirectory(cwd.c_str()); + this->SetHomeOutputDirectory(cwd); + this->SetStartOutputDirectory(cwd); } return; } @@ -927,10 +927,10 @@ void cmake::SetDirectoriesFromFile(const char* arg) // current working directory as the build tree. std::string full = cmSystemTools::CollapseFullPath(arg); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->SetHomeDirectory(full.c_str()); - this->SetStartDirectory(full.c_str()); - this->SetHomeOutputDirectory(cwd.c_str()); - this->SetStartOutputDirectory(cwd.c_str()); + this->SetHomeDirectory(full); + this->SetStartDirectory(full); + this->SetHomeOutputDirectory(cwd); + this->SetStartOutputDirectory(cwd); } // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the @@ -979,8 +979,8 @@ void cmake::AddExtraGenerator(const std::string& name, ++it ) { std::string fullName = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(it->c_str(), name); - this->ExtraGenerators[fullName.c_str()] = newFunction; + CreateFullGeneratorName(*it, name); + this->ExtraGenerators[fullName] = newFunction; } delete extraGenerator; } @@ -1230,7 +1230,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) i++; save.value = *i; warning << *i << "\n"; - if(ci.Find(save.key.c_str())) + if(ci.Find(save.key)) { save.type = ci.GetType(); save.help = ci.GetProperty("HELPSTRING"); @@ -1246,7 +1246,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) for(std::vector::iterator i = saved.begin(); i != saved.end(); ++i) { - this->AddCacheEntry(i->key.c_str(), i->value.c_str(), + this->AddCacheEntry(i->key, i->value.c_str(), i->help.c_str(), i->type); } cmSystemTools::Message(warning.str().c_str()); @@ -1328,7 +1328,7 @@ int cmake::ActualConfigure() std::string fullName = cmExternalMakefileProjectGenerator:: CreateFullGeneratorName(genName, extraGenName ? extraGenName : ""); - this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str()); + this->GlobalGenerator = this->CreateGlobalGenerator(fullName); } if(this->GlobalGenerator) { @@ -1692,8 +1692,8 @@ int cmake::Run(const std::vector& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir.c_str()); - this->SetStartOutputDirectory(oldstartoutputdir.c_str()); + this->SetStartDirectory(oldstartdir); + this->SetStartOutputDirectory(oldstartoutputdir); return ret; } @@ -1854,7 +1854,7 @@ void cmake::GetGeneratorDocumentation(std::vector& v) { cmDocumentationEntry e; cmExternalMakefileProjectGenerator* generator = (i->second)(); - generator->GetDocumentation(e, i->first.c_str()); + generator->GetDocumentation(e, i->first); e.Name = i->first; delete generator; v.push_back(e); @@ -2313,7 +2313,7 @@ int cmake::GetSystemInformation(std::vector& args) value = args[i]; } cmGlobalGenerator* gen = - this->CreateGlobalGenerator(value.c_str()); + this->CreateGlobalGenerator(value); if(!gen) { cmSystemTools::Error("Could not create named generator ", @@ -2650,7 +2650,7 @@ int cmake::Build(const std::string& dir, cmSystemTools::ConvertToUnixSlashes(cachePath); cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(!cachem->LoadCache(cachePath.c_str())) + if(!cachem->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; @@ -2670,11 +2670,11 @@ int cmake::Build(const std::string& dir, return 1; } projName = it.GetValue(); - return gen->Build("", dir.c_str(), - projName.c_str(), target.c_str(), + return gen->Build("", dir, + projName, target, &output, "", - config.c_str(), clean, false, 0, + config, clean, false, 0, cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 047f09da5..ad1f2a5a0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -613,16 +613,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) startDir = cmSystemTools::CollapseFullPath(startDir.c_str()); homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str()); startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str()); - cm.SetHomeDirectory(homeDir.c_str()); - cm.SetStartDirectory(startDir.c_str()); - cm.SetHomeOutputDirectory(homeOutDir.c_str()); - cm.SetStartOutputDirectory(startOutDir.c_str()); - if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str())) + cm.SetHomeDirectory(homeDir); + cm.SetStartDirectory(startDir); + cm.SetHomeOutputDirectory(homeOutDir); + cm.SetStartOutputDirectory(startOutDir); + if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); cmsys::auto_ptr lgd(ggd->CreateLocalGenerator()); - lgd->GetMakefile()->SetStartDirectory(startDir.c_str()); - lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str()); + lgd->GetMakefile()->SetStartDirectory(startDir); + lgd->GetMakefile()->SetStartOutputDirectory(startOutDir); lgd->GetMakefile()->MakeStartDirectoriesCurrent(); // Actually scan dependencies. @@ -667,7 +667,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { cmQtAutoGenerators autogen; std::string const& config = args[3]; - bool autogenSuccess = autogen.Run(args[2].c_str(), config); + bool autogenSuccess = autogen.Run(args[2], config); return autogenSuccess ? 0 : 1; } #endif diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b6a243706..32e79e62f 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4918,8 +4918,8 @@ void SystemTools::ClassInitialize() // Strip off one directory level and see if the logical // mapping still works. - pwd_str = SystemTools::GetFilenamePath(pwd_str.c_str()); - cwd_str = SystemTools::GetFilenamePath(cwd_str.c_str()); + pwd_str = SystemTools::GetFilenamePath(pwd_str); + cwd_str = SystemTools::GetFilenamePath(cwd_str); Realpath(pwd_str.c_str(), pwd_path); } From af8a1643c1a42aa3b276a50bca10a4faab176764 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 13:35:32 +0100 Subject: [PATCH 167/278] Remove c_str calls when using stream APIs. Use an ad-hoc clang tool for matching the calls which should be ported. --- Source/CPack/cmCPackDebGenerator.cxx | 16 ++-- Source/CPack/cmCPackGenerator.cxx | 32 +++---- Source/CPack/cmCPackLog.cxx | 12 +-- Source/CPack/cmCPackNSISGenerator.cxx | 42 ++++----- Source/CPack/cmCPackSTGZGenerator.cxx | 4 +- Source/CPack/cpack.cxx | 10 +-- Source/CTest/cmCTestBuildCommand.cxx | 2 +- Source/CTest/cmCTestBuildHandler.cxx | 2 +- Source/CTest/cmCTestConfigureHandler.cxx | 4 +- Source/CTest/cmCTestCoverageHandler.cxx | 88 +++++++++---------- .../cmCTestEmptyBinaryDirectoryCommand.cxx | 2 +- Source/CTest/cmCTestGenericHandler.cxx | 4 +- Source/CTest/cmCTestMemCheckHandler.cxx | 16 ++-- Source/CTest/cmCTestMultiProcessHandler.cxx | 2 +- Source/CTest/cmCTestRunTest.cxx | 28 +++--- Source/CTest/cmCTestScriptHandler.cxx | 20 ++--- Source/CTest/cmCTestSubmitHandler.cxx | 46 +++++----- Source/CTest/cmCTestTestHandler.cxx | 14 +-- Source/CTest/cmCTestUpdateHandler.cxx | 2 +- Source/CTest/cmCTestUploadHandler.cxx | 2 +- Source/cmAddCustomCommandCommand.cxx | 2 +- Source/cmCMakeMinimumRequired.cxx | 4 +- Source/cmCTest.cxx | 48 +++++----- Source/cmCacheManager.cxx | 4 +- Source/cmCommandArgumentParserHelper.cxx | 2 +- Source/cmCoreTryCompile.cxx | 6 +- Source/cmDependsC.cxx | 2 +- Source/cmDependsFortran.cxx | 12 +-- Source/cmDependsJavaParserHelper.cxx | 8 +- Source/cmDocumentation.cxx | 12 +-- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraCodeLiteGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmFindPackageCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 22 ++--- Source/cmGlobalUnixMakefileGenerator3.cxx | 14 +-- Source/cmGraphVizWriter.cxx | 6 +- Source/cmInstallGenerator.cxx | 2 +- Source/cmLocalGenerator.cxx | 6 +- Source/cmLocalUnixMakefileGenerator3.cxx | 8 +- Source/cmMakefile.cxx | 16 ++-- Source/cmMakefileTargetGenerator.cxx | 6 +- Source/cmSourceGroupCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.cxx | 4 +- Source/cmVariableWatchCommand.cxx | 4 +- Source/cmake.cxx | 14 +-- Source/cmcmd.cxx | 26 +++--- 49 files changed, 297 insertions(+), 297 deletions(-) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 9ae58395f..27e9d9fde 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -444,13 +444,13 @@ int cmCPackDebGenerator::createDeb() std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/Deb.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Working directory: " << toplevel << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -528,13 +528,13 @@ int cmCPackDebGenerator::createDeb() std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/Deb.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Working directory: " << toplevel << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running tar command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index cf514aa0d..9cdf5aad9 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -285,7 +285,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( it != installCommandsVector.end(); ++it ) { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << it->c_str() + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << *it << std::endl); std::string output; int retVal = 1; @@ -296,12 +296,12 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/InstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << it->c_str() << std::endl + ofs << "# Run command: " << *it << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << it->c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + "Problem running install command: " << *it << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -329,7 +329,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ++it ) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Create ignore files regex for: " << it->c_str() << std::endl); + "Create ignore files regex for: " << *it << std::endl); ignoreFilesRegex.push_back(it->c_str()); } } @@ -385,7 +385,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( if ( regIt->find(inFile.c_str()) ) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Ignore file: " - << inFile.c_str() << std::endl); + << inFile << std::endl); skip = true; } } @@ -397,7 +397,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top.c_str(), gfit->c_str()); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " - << inFile.c_str() << " -> " << filePath.c_str() << std::endl); + << inFile << " -> " << filePath << std::endl); /* If the file is a symlink we will have to re-create it */ if ( cmSystemTools::FileIsSymlink(inFile.c_str())) { @@ -416,7 +416,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( ) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " - << inFile.c_str() << " -> " << filePath.c_str() << std::endl); + << inFile << " -> " << filePath << std::endl); return 0; } } @@ -663,14 +663,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/PreinstallOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommandStr.c_str() << std::endl - << "# Directory: " << installDirectory.c_str() << std::endl + ofs << "# Run command: " << buildCommandStr << std::endl + << "# Directory: " << installDirectory << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " << buildCommandStr.c_str() + "Problem running install command: " << buildCommandStr << std::endl - << "Please check " << tmpFile.c_str() << " for errors" + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } @@ -1001,7 +1001,7 @@ void cmCPackGenerator::SetOption(const std::string& op, const char* value) int cmCPackGenerator::DoPackage() { cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "Create package using " << this->Name.c_str() << std::endl); + "Create package using " << this->Name << std::endl); // Prepare CPack internal name and check // values for many CPACK_xxx vars @@ -1269,7 +1269,7 @@ std::string cmCPackGenerator::FindTemplate(const char* name) << (name ? name : "(NULL)") << std::endl); std::string ffile = this->MakefileMap->GetModulesFile(name); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Found template: " - << ffile.c_str() << std::endl); + << ffile << std::endl); return ffile; } diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 4e8bf0f4e..7befca0e1 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -169,27 +169,27 @@ void cmCPackLog::Log(int tag, const char* file, int line, { if ( error && !this->ErrorPrefix.empty() ) { - *this->DefaultError << this->ErrorPrefix.c_str(); + *this->DefaultError << this->ErrorPrefix; } else if ( warning && !this->WarningPrefix.empty() ) { - *this->DefaultError << this->WarningPrefix.c_str(); + *this->DefaultError << this->WarningPrefix; } else if ( output && !this->OutputPrefix.empty() ) { - *this->DefaultOutput << this->OutputPrefix.c_str(); + *this->DefaultOutput << this->OutputPrefix; } else if ( verbose && !this->VerbosePrefix.empty() ) { - *this->DefaultOutput << this->VerbosePrefix.c_str(); + *this->DefaultOutput << this->VerbosePrefix; } else if ( debug && !this->DebugPrefix.empty() ) { - *this->DefaultOutput << this->DebugPrefix.c_str(); + *this->DefaultOutput << this->DebugPrefix; } else if ( !this->Prefix.empty() ) { - *this->DefaultOutput << this->Prefix.c_str(); + *this->DefaultOutput << this->Prefix; } if ( useFileAndLine ) { diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index f43383465..011369803 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -83,10 +83,10 @@ int cmCPackNSISGenerator::PackageFiles() fileN = fileN.substr(fileN.find('/')+1, std::string::npos); } cmSystemTools::ReplaceString(fileN, "/", "\\"); - str << " Delete \"$INSTDIR\\" << fileN.c_str() << "\"" << std::endl; + str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " - << str.str().c_str() << std::endl); + << str.str() << std::endl); this->SetOptionIfNotSet("CPACK_NSIS_DELETE_FILES", str.str().c_str()); std::vector dirs; this->GetListOfSubdirectories(toplevel.c_str(), dirs); @@ -117,14 +117,14 @@ int cmCPackNSISGenerator::PackageFiles() } } cmSystemTools::ReplaceString(fileN, "/", "\\"); - dstr << " RMDir \"$INSTDIR\\" << fileN.c_str() << "\"" << std::endl; + dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl; if (!componentName.empty()) { this->Components[componentName].Directories.push_back(fileN); } } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Dirs: " - << dstr.str().c_str() << std::endl); + << dstr.str() << std::endl); this->SetOptionIfNotSet("CPACK_NSIS_DELETE_DIRECTORIES", dstr.str().c_str()); @@ -320,7 +320,7 @@ int cmCPackNSISGenerator::PackageFiles() std::string nsisCmd = "\""; nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM"); nsisCmd += "\" \"" + nsisFileName + "\""; - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd.c_str() + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl); std::string output; int retVal = 1; @@ -329,12 +329,12 @@ int cmCPackNSISGenerator::PackageFiles() if ( !res || retVal ) { cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << nsisCmd.c_str() << std::endl + ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running NSIS command: " - << nsisCmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << nsisCmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } return 1; @@ -427,7 +427,7 @@ int cmCPackNSISGenerator::InitializeInternal() std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " - << nsisCmd.c_str() << std::endl); + << nsisCmd << std::endl); std::string output; int retVal = 1; bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(), @@ -442,13 +442,13 @@ int cmCPackNSISGenerator::InitializeInternal() std::string tmpFile = topDir ? topDir : "."; tmpFile += "/NSISOutput.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << nsisCmd.c_str() << std::endl + ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem checking NSIS version with command: " - << nsisCmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << nsisCmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return 0; } if ( versionRex.find(output)) @@ -470,7 +470,7 @@ int cmCPackNSISGenerator::InitializeInternal() { // No version check for NSIS cvs build cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: CVS " - << versionRexCVS.match(1).c_str() << std::endl); + << versionRexCVS.match(1) << std::endl); } this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str()); this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin"); @@ -844,12 +844,12 @@ CreateComponentDescription(cmCPackComponent *component, std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/CompressZip.log"; cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << cmd.c_str() << std::endl + ofs << "# Run command: " << cmd << std::endl << "# Output:" << std::endl - << output.c_str() << std::endl; + << output << std::endl; cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running zip command: " - << cmd.c_str() << std::endl - << "Please check " << tmpFile.c_str() << " for errors" << std::endl); + << cmd << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); return ""; } @@ -891,7 +891,7 @@ CreateComponentDescription(cmCPackComponent *component, path = *pathIt; cmSystemTools::ReplaceString(path, "/", "\\"); macrosOut << " Delete \"$INSTDIR\\" - << path.c_str() + << path << "\"\n"; } for (pathIt = component->Directories.begin(); @@ -901,7 +901,7 @@ CreateComponentDescription(cmCPackComponent *component, path = *pathIt; cmSystemTools::ReplaceString(path, "/", "\\"); macrosOut << " RMDir \"$INSTDIR\\" - << path.c_str() + << path << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 8342fee2c..6c1d20189 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -43,7 +43,7 @@ int cmCPackSTGZGenerator::InitializeInternal() if ( inFile.empty() ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find template file: " - << inFile.c_str() << std::endl); + << inFile << std::endl); return 0; } this->SetOptionIfNotSet("CPACK_STGZ_HEADER_FILE", inFile.c_str()); @@ -134,6 +134,6 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os) cmSystemTools::ReplaceString(res, headerLengthTag, buffer); // Write in file - *os << res.c_str(); + *os << res; return this->Superclass::GenerateHeader(os); } diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d1a16f0c4..7ebfedaf0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -91,7 +91,7 @@ int cpackDefinitionArgument(const char* argument, const char* cValue, value = value.c_str() + pos + 1; def->Map[key] = value; cmCPack_Log(def->Log, cmCPackLog::LOG_DEBUG, "Set CPack variable: " - << key.c_str() << " to \"" << value.c_str() << "\"" << std::endl); + << key << " to \"" << value << "\"" << std::endl); return 1; } @@ -195,7 +195,7 @@ int main (int argc, char const* const* argv) } cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, - "Read CPack config file: " << cpackConfigFile.c_str() << std::endl); + "Read CPack config file: " << cpackConfigFile << std::endl); cmake cminst; cminst.RemoveUnscriptableCommands(); @@ -262,20 +262,20 @@ int main (int argc, char const* const* argv) cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile.c_str()); cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, - "Read CPack configuration file: " << cpackConfigFile.c_str() + "Read CPack configuration file: " << cpackConfigFile << std::endl); if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Problem reading CPack config file: \"" - << cpackConfigFile.c_str() << "\"" << std::endl); + << cpackConfigFile << "\"" << std::endl); return 1; } } else if ( cpackConfigFileSpecified ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Cannot find CPack config file: \"" << cpackConfigFile.c_str() + "Cannot find CPack config file: \"" << cpackConfigFile << "\"" << std::endl); return 1; } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index de42e2bba..f81083af6 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -134,7 +134,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" - << buildCommand.c_str() << "\n"); + << buildCommand << "\n"); this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str()); } else diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 291c70a6f..7922c9ad7 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -409,7 +409,7 @@ int cmCTestBuildHandler::ProcessHandler() for ( it = strings.begin(); it != strings.end(); ++it ) \ { \ cmCTestLog(this->CTest, DEBUG, "Add " #strings ": " \ - << it->c_str() << std::endl); \ + << *it << std::endl); \ regexes.push_back(it->c_str()); \ } cmCTestBuildHandlerPopulateRegexVector( diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 7c4129864..a6e39a490 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -76,7 +76,7 @@ int cmCTestConfigureHandler::ProcessHandler() cmGeneratedFileStream ofs; this->StartLogFile("Configure", ofs); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: " - << cCommand.c_str() << std::endl); + << cCommand << std::endl); res = this->CTest->RunMakeCommand(cCommand.c_str(), &output, &retVal, buildDirectory.c_str(), 0, ofs); @@ -99,7 +99,7 @@ int cmCTestConfigureHandler::ProcessHandler() { os << retVal; } - os << "" << cCommand.c_str() << "" + os << "" << cCommand << "" << std::endl; cmCTestLog(this->CTest, DEBUG, "End" << std::endl); os << "" << cmXMLSafe(output) << "" << std::endl; diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2c21a1319..f0b11241f 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -269,7 +269,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if ( ndc.size() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of " << file << std::endl); return false; } @@ -308,7 +308,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, fFile.c_str(), checkDir.c_str()); if ( ndc.size() ) { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc.c_str() + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc << " so skip coverage of: " << file << std::endl); return false; } @@ -477,7 +477,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " - << fullFileName.c_str() + << fullFileName << std::endl); continue; } @@ -488,7 +488,7 @@ int cmCTestCoverageHandler::ProcessHandler() if ( !cmSystemTools::FileExists(fullFileName.c_str()) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find file: " - << fullFileName.c_str() << std::endl); + << fullFileName << std::endl); continue; } @@ -516,7 +516,7 @@ int cmCTestCoverageHandler::ProcessHandler() if ( !ifs) { cmOStringStream ostr; - ostr << "Cannot open source file: " << fullFileName.c_str(); + ostr << "Cannot open source file: " << fullFileName; errorsWhileAccumulating.push_back(ostr.str()); error ++; continue; @@ -535,7 +535,7 @@ int cmCTestCoverageHandler::ProcessHandler() cc != fcov.size() -1 ) { cmOStringStream ostr; - ostr << "Problem reading source file: " << fullFileName.c_str() + ostr << "Problem reading source file: " << fullFileName << " line:" << cc << " out total: " << fcov.size()-1; errorsWhileAccumulating.push_back(ostr.str()); error ++; @@ -605,7 +605,7 @@ int cmCTestCoverageHandler::ProcessHandler() if (!ifs) { cmOStringStream ostr; - ostr << "Cannot open source file: " << fullPath.c_str(); + ostr << "Cannot open source file: " << fullPath; errorsWhileAccumulating.push_back(ostr.str()); error ++; continue; @@ -613,7 +613,7 @@ int cmCTestCoverageHandler::ProcessHandler() int untested = 0; std::string line; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Actually performing coverage for: " << i->c_str() << std::endl); + "Actually performing coverage for: " << *i << std::endl); while (cmSystemTools::GetLineFromStream(ifs, line)) { covLogFile << "\t\t" @@ -647,7 +647,7 @@ int cmCTestCoverageHandler::ProcessHandler() ++ erIt ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - " " << erIt->c_str() << std::endl); + " " << *erIt << std::endl); } } @@ -719,13 +719,13 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) ++ it ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage exclude: " - << it->c_str() << std::endl); + << *it << std::endl); } for ( it = this->ExtraCoverageGlobs.begin(); it != this->ExtraCoverageGlobs.end(); ++it) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Add coverage glob: " - << it->c_str() << std::endl); + << *it << std::endl); } } @@ -959,17 +959,17 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string output = ""; std::string errors = ""; int retVal = 0; - *cont->OFS << "* Run coverage for: " << fileDir.c_str() << std::endl; - *cont->OFS << " Command: " << command.c_str() << std::endl; + *cont->OFS << "* Run coverage for: " << fileDir << std::endl; + *cont->OFS << " Command: " << command << std::endl; int res = this->CTest->RunCommand(command.c_str(), &output, &errors, &retVal, tempDir.c_str(), 0 /*this->TimeOut*/); - *cont->OFS << " Output: " << output.c_str() << std::endl; - *cont->OFS << " Errors: " << errors.c_str() << std::endl; + *cont->OFS << " Output: " << output << std::endl; + *cont->OFS << " Errors: " << errors << std::endl; if ( ! res ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Problem running coverage on file: " << it->c_str() << std::endl); + "Problem running coverage on file: " << *it << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << errors << std::endl); cont->Error ++; @@ -978,7 +978,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( retVal != 0 ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Coverage command returned: " - << retVal << " while processing: " << it->c_str() << std::endl); + << retVal << " while processing: " << *it << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, "Command produced error: " << cont->Error << std::endl); } @@ -999,7 +999,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string sourceFile; std::string gcovFile; - cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]" + cmCTestLog(this->CTest, DEBUG, "Line: [" << *line << "]" << std::endl); if ( line->size() == 0 ) @@ -1145,7 +1145,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( !cmSystemTools::StringStartsWith(line->c_str(), "Removing ")) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Unknown gcov output line: [" << line->c_str() << "]" + "Unknown gcov output line: [" << *line << "]" << std::endl); cont->Error ++; //abort(); @@ -1238,8 +1238,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if ( IsFileInDir(sourceFile, cont->SourceDir) ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " - << sourceFile.c_str() << std::endl); - *cont->OFS << " produced in source dir: " << sourceFile.c_str() + << sourceFile << std::endl); + *cont->OFS << " produced in source dir: " << sourceFile << std::endl; actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str()); @@ -1247,8 +1247,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( else if ( IsFileInDir(sourceFile, cont->BinaryDir) ) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " - << sourceFile.c_str() << std::endl); - *cont->OFS << " produced in binary dir: " << sourceFile.c_str() + << sourceFile << std::endl); + *cont->OFS << " produced in binary dir: " << sourceFile << std::endl; actualSourceFile = cmSystemTools::CollapseFullPath(sourceFile.c_str()); @@ -1262,19 +1262,19 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "Something went wrong" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Cannot find file: [" - << sourceFile.c_str() << "]" << std::endl); + << sourceFile << "]" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in source dir: [" - << cont->SourceDir.c_str() << "]" + << cont->SourceDir << "]" << std::endl); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " or binary dir: [" << cont->BinaryDir.size() << "]" << std::endl); *cont->OFS << " Something went wrong. Cannot find file: " - << sourceFile.c_str() - << " in source dir: " << cont->SourceDir.c_str() - << " or binary dir: " << cont->BinaryDir.c_str() << std::endl; + << sourceFile + << " in source dir: " << cont->SourceDir + << " or binary dir: " << cont->BinaryDir << std::endl; missingFiles.insert(sourceFile); } @@ -1364,24 +1364,24 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find source Python file corresponding to: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); continue; } std::string actualSourceFile = cmSystemTools::CollapseFullPath(fileName.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " Check coverage for file: " << actualSourceFile.c_str() + " Check coverage for file: " << actualSourceFile << std::endl); cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec = &cont->TotalCoverage[actualSourceFile]; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - " in file: " << fileIt->c_str() << std::endl); + " in file: " << *fileIt << std::endl); cmsys::ifstream ifile(fileIt->c_str()); if ( ! ifile ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); } else { @@ -1429,7 +1429,7 @@ int cmCTestCoverageHandler::HandleTracePyCoverage( // So, this will be set to 0. cov = 0; } - cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix.c_str() + cmCTestLog(this->CTest, DEBUG, "Prefix: " << prefix << " cov: " << cov << std::endl); // Read the line number starting at the 10th character of the gcov @@ -1542,7 +1542,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open coverage file: " << - outputFile.c_str() << std::endl); + outputFile << std::endl); return 0; } std::map fileMap; @@ -1602,7 +1602,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch( count++; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Produce coverage for file: " - << file.c_str() << " " << count + << file << " " << count << std::endl); // start the file output covLogFile << "\tCTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program.c_str() << " " << arg << "\n"); + "Run : " << program << " " << arg << "\n"); } else { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Run : " << program.c_str() << "\n"); + "Run : " << program << "\n"); } // create a process object and start it cmCTestRunProcess runCoverageSrc; @@ -1686,7 +1686,7 @@ int cmCTestCoverageHandler::RunBullseyeCommand( if(!runCoverageSrc.StartProcess()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Could not run : " - << program.c_str() << " " << arg << "\n" + << program << " " << arg << "\n" << "kwsys process state : " << runCoverageSrc.GetProcessState()); return 0; @@ -1755,7 +1755,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open coverage summary file: " << - outputFile.c_str() << std::endl); + outputFile << std::endl); return 0; } std::set coveredFileNames; @@ -1796,14 +1796,14 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, ".NoDartCoverage found, so skip coverage check for: " - << file.c_str() + << file << std::endl); continue; } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Doing coverage for: " - << file.c_str() + << file << std::endl); coveredFiles.push_back(sourceFile); @@ -1830,7 +1830,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( cmet /= 2.0f; } cmet /= 100.0f; - tmpLog << stdline.c_str() << "\n"; + tmpLog << stdline << "\n"; tmpLog << fileName << "\n"; tmpLog << "functionsCalled: " << functionsCalled/100 << "\n"; tmpLog << "totalFunctions: " << totalFunctions/100 << "\n"; @@ -1957,7 +1957,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( if(pos == inputLine.npos) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing string : " - << inputLine.c_str() << "\n"); + << inputLine << "\n"); return false; } // the source file has "" around it so extract out the file name @@ -1991,7 +1991,7 @@ bool cmCTestCoverageHandler::ParseBullsEyeCovsrcLine( if(pos != inputLine.npos) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error parsing input : " - << inputLine.c_str() << " last pos not npos = " << pos << + << inputLine << " last pos not npos = " << pos << "\n"); } return true; diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index a470b3bba..5ddef01a7 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -25,7 +25,7 @@ bool cmCTestEmptyBinaryDirectoryCommand if ( !cmCTestScriptHandler::EmptyBinaryDirectory(args[0].c_str()) ) { cmOStringStream ostr; - ostr << "problem removing the binary directory: " << args[0].c_str(); + ostr << "problem removing the binary directory: " << args[0]; this->SetError(ostr.str()); return false; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index 08cfaeca6..2df2229e7 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -124,7 +124,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, ostr.str(), xofs, true) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Cannot create resulting XML file: " << ostr.str().c_str() + "Cannot create resulting XML file: " << ostr.str() << std::endl); return false; } @@ -156,7 +156,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, if( !this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: " - << ostr.str().c_str() << std::endl); + << ostr.str() << std::endl); return false; } return true; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index f27dbc098..ecaa474db 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -514,7 +514,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot find memory checker suppression file: " << this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str() << std::endl); + "MemoryCheckSuppressionFile") << std::endl); return false; } std::string suppressions = "--suppressions=" @@ -569,7 +569,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } default: cmCTestLog(this->CTest, ERROR_MESSAGE, - "Do not understand memory checker: " << this->MemoryTester.c_str() + "Do not understand memory checker: " << this->MemoryTester << std::endl); return false; } @@ -885,7 +885,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput( else if(!parser.ParseChunk(theLine.c_str(), theLine.size())) { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Error in ParseChunk: " << theLine.c_str() + "Error in ParseChunk: " << theLine << std::endl); } } @@ -916,7 +916,7 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessBoundsCheckerTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); std::string ofile = testOutputFileName(test); if ( ofile.empty() ) { @@ -943,10 +943,10 @@ cmCTestMemCheckHandler::PostProcessBoundsCheckerTest(cmCTestTestResult& res, cmSystemTools::Delay(1000); cmSystemTools::RemoveFile(this->BoundsCheckerDPBDFile.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerDPBDFile.c_str() << std::endl); + << this->BoundsCheckerDPBDFile << std::endl); cmSystemTools::RemoveFile(this->BoundsCheckerXMLFile.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Remove: " - << this->BoundsCheckerXMLFile.c_str() << std::endl); + << this->BoundsCheckerXMLFile << std::endl); } void @@ -955,7 +955,7 @@ cmCTestMemCheckHandler::PostProcessPurifyTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessPurifyTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); appendMemTesterOutput(res, test); } @@ -965,7 +965,7 @@ cmCTestMemCheckHandler::PostProcessValgrindTest(cmCTestTestResult& res, { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "PostProcessValgrindTest for : " - << res.Name.c_str() << std::endl); + << res.Name << std::endl); appendMemTesterOutput(res, test); } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index c979be3f3..b9e67211c 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -672,7 +672,7 @@ void cmCTestMultiProcessHandler::PrintTestList() indexStr << " #" << p.Index << ":"; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str().c_str()); + << indexStr.str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); //pop working dir diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index cdf90b9af..385388d5d 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -334,9 +334,9 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "Test Failed.\n"; } } - *this->TestHandler->LogFile << "\"" << this->TestProperties->Name.c_str() + *this->TestHandler->LogFile << "\"" << this->TestProperties->Name << "\" end time: " << this->CTest->CurrentTime() << std::endl - << "\"" << this->TestProperties->Name.c_str() << "\" time elapsed: " + << "\"" << this->TestProperties->Name << "\" time elapsed: " << buffer << std::endl << "----------------------------------------------------------" << std::endl << std::endl; @@ -388,8 +388,8 @@ void cmCTestRunTest::MemCheckPostProcess() } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": process test output now: " - << this->TestProperties->Name.c_str() << " " - << this->TestResult.Name.c_str() << std::endl); + << this->TestProperties->Name << " " + << this->TestResult.Name << std::endl); cmCTestMemCheckHandler * handler = static_cast (this->TestHandler); switch ( handler->MemoryTesterStyle ) @@ -465,9 +465,9 @@ bool cmCTestRunTest::StartTest(size_t total) //Required file was not found this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find required file: " - << file.c_str() << std::endl; + << file << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find required file: " - << file.c_str() << std::endl); + << file << std::endl); this->TestResult.Output = "Unable to find required file: " + file; this->TestResult.FullCommandLine = ""; this->TestResult.CompletionStatus = "Not Run"; @@ -482,9 +482,9 @@ bool cmCTestRunTest::StartTest(size_t total) // that has that information this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find executable: " - << args[1].c_str() << std::endl; + << args[1] << std::endl; cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to find executable: " - << args[1].c_str() << std::endl); + << args[1] << std::endl); this->TestResult.Output = "Unable to find executable: " + args[1]; this->TestResult.FullCommandLine = ""; this->TestResult.CompletionStatus = "Not Run"; @@ -711,7 +711,7 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) indexStr << " #" << this->Index << ":"; cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(3 + getNumWidth(this->TestHandler->GetMaxIndex())) - << indexStr.str().c_str()); + << indexStr.str()); cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); const int maxTestNameWidth = this->CTest->GetMaxTestNameWidth(); std::string outname = this->TestProperties->Name + " "; @@ -722,18 +722,18 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << this->TestProperties->Name << std::endl; *this->TestHandler->LogFile << this->TestProperties->Index << "/" << this->TestHandler->TotalNumberOfTests - << " Test: " << this->TestProperties->Name.c_str() << std::endl; + << " Test: " << this->TestProperties->Name << std::endl; *this->TestHandler->LogFile << "Command: \"" << this->ActualCommand << "\""; for (std::vector::iterator i = this->Arguments.begin(); i != this->Arguments.end(); ++i) { *this->TestHandler->LogFile - << " \"" << i->c_str() << "\""; + << " \"" << *i << "\""; } *this->TestHandler->LogFile << std::endl << "Directory: " << this->TestProperties->Directory << std::endl - << "\"" << this->TestProperties->Name.c_str() << "\" start time: " + << "\"" << this->TestProperties->Name << "\" start time: " << this->StartTime << std::endl; *this->TestHandler->LogFile @@ -741,9 +741,9 @@ void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) << "----------------------------------------------------------" << std::endl; *this->TestHandler->LogFile - << this->ProcessOutput.c_str() << "" << std::endl; + << this->ProcessOutput << "" << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, outname.c_str()); cmCTestLog(this->CTest, DEBUG, "Testing " - << this->TestProperties->Name.c_str() << " ... "); + << this->TestProperties->Name << " ... "); } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 4d419c251..567acfc95 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -426,7 +426,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" - << systemFile.c_str() << "\n"); + << systemFile << "\n"); return 2; } @@ -444,7 +444,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read script: " - << script.c_str() + << script << std::endl); // Reset the error flag so that it can run more than // one script with an error when you @@ -781,7 +781,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() output = ""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run Update: " - << fullCommand.c_str() << std::endl); + << fullCommand << std::endl); res = cmSystemTools::RunSingleCommand(fullCommand.c_str(), &output, &retVal, cvsArgs[0].c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -902,7 +902,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() command += "\""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run cmake command: " - << command.c_str() << std::endl); + << command << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -916,7 +916,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Write CMake output to file: " << cmakeOutputFile.c_str() + "Write CMake output to file: " << cmakeOutputFile << std::endl); cmGeneratedFileStream fout(cmakeOutputFile.c_str()); if ( fout ) @@ -927,7 +927,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open CMake output file: " - << cmakeOutputFile.c_str() << " for writing" << std::endl); + << cmakeOutputFile << " for writing" << std::endl); } } if (!res || retVal != 0) @@ -948,7 +948,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() output = ""; retVal = 0; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run ctest command: " - << command.c_str() << std::endl); + << command << std::endl); res = cmSystemTools::RunSingleCommand(command.c_str(), &output, &retVal, this->BinaryDir.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/); @@ -962,13 +962,13 @@ int cmCTestScriptHandler::RunConfigurationDashboard() { cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to run cmake:" << std::endl - << cmakeFailedOuput.c_str() << std::endl); + << cmakeFailedOuput << std::endl); return 10; } cmCTestLog(this->CTest, ERROR_MESSAGE, "Unable to run ctest:" << std::endl - << "command: " << command.c_str() << std::endl - << "output: " << output.c_str() << std::endl); + << "command: " << command << std::endl + << "output: " << output << std::endl); if (!res) { return 11; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index bc3c33377..7c72cba2f 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -229,18 +229,18 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, if ( ::stat(local_file.c_str(), &st) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); ::curl_easy_cleanup(curl); ::curl_global_cleanup(); return false; } ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); - *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " - << upload_as.c_str() << std::endl; + *this->LogFile << "\tUpload file: " << local_file << " to " + << upload_as << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file.c_str() << " to " - << upload_as.c_str() << std::endl); + << local_file << " to " + << upload_as << std::endl); ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); @@ -290,11 +290,11 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix, { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " - << local_file.c_str() + << local_file << std::endl << " Error message was: " << error_buffer << std::endl @@ -422,8 +422,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, std::string remote_file = remoteprefix + cmSystemTools::GetFilenameName(*file); - *this->LogFile << "\tUpload file: " << local_file.c_str() << " to " - << remote_file.c_str() << std::endl; + *this->LogFile << "\tUpload file: " << local_file << " to " + << remote_file << std::endl; std::string ofile = ""; for ( kk = 0; kk < remote_file.size(); kk ++ ) @@ -470,7 +470,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, if ( ::stat(local_file.c_str(), &st) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); ::curl_easy_cleanup(curl); ::curl_global_cleanup(); return false; @@ -478,8 +478,8 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb"); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: " - << local_file.c_str() << " to " - << upload_as.c_str() << " Size: " << st.st_size << std::endl); + << local_file << " to " + << upload_as << " Size: " << st.st_size << std::endl); // specify target ::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str()); @@ -595,11 +595,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when uploading file: " - << local_file.c_str() << std::endl); + << local_file << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << " Error when uploading file: " - << local_file.c_str() + << local_file << std::endl << " Error message was: " << error_buffer << std::endl; @@ -750,15 +750,15 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP( std::string turl = url + ((url.find("?",0) == std::string::npos) ? "?" : "&") + "xmlfile=" + ofile; - *this->LogFile << "Trigger url: " << turl.c_str() << std::endl; + *this->LogFile << "Trigger url: " << turl << std::endl; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Trigger url: " - << turl.c_str() << std::endl); + << turl << std::endl); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_easy_setopt(curl, CURLOPT_URL, turl.c_str()); if ( curl_easy_perform(curl) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Error when triggering: " - << turl.c_str() << std::endl); + << turl << std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, " Error message was: " << error_buffer << std::endl); *this->LogFile << "\tTriggering failed with error: " << error_buffer @@ -932,8 +932,8 @@ bool cmCTestSubmitHandler::SubmitUsingCP( std::string rfname = destination + "/" + remoteprefix + *file; cmSystemTools::CopyFileAlways(lfname.c_str(), rfname.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Copy file: " - << lfname.c_str() << " to " - << rfname.c_str() << std::endl); + << lfname << " to " + << rfname << std::endl); } std::string tagDoneFile = destination + "/" + remoteprefix + "DONE"; cmSystemTools::Touch(tagDoneFile.c_str(), true); @@ -1183,7 +1183,7 @@ int cmCTestSubmitHandler::ProcessHandler() = buildDirectory + "/Testing/" + this->CTest->GetCurrentTag(); std::string::size_type glen = gpath.size() + 1; gpath = gpath + "/CoverageLog*"; - cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath.c_str() + cmCTestLog(this->CTest, DEBUG, "Globbing for: " << gpath << std::endl); if ( cmSystemTools::SimpleGlob(gpath, gfiles, 1) ) { @@ -1191,7 +1191,7 @@ int cmCTestSubmitHandler::ProcessHandler() for ( cc = 0; cc < gfiles.size(); cc ++ ) { gfiles[cc] = gfiles[cc].substr(glen); - cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc].c_str() + cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc] << std::endl); this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str()); } @@ -1232,7 +1232,7 @@ int cmCTestSubmitHandler::ProcessHandler() cmCTest::SetOfStrings::iterator it; for ( it = files.begin(); it != files.end(); ++ it ) { - ofs << cnt << "\t" << it->c_str() << std::endl; + ofs << cnt << "\t" << *it << std::endl; cnt ++; } } @@ -1448,7 +1448,7 @@ int cmCTestSubmitHandler::ProcessHandler() oldWorkingDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(buildDirectory.c_str()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " - << buildDirectory.c_str() << std::endl); + << buildDirectory << std::endl); if ( !this->SubmitUsingCP( "Testing/"+this->CTest->GetCurrentTag(), diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index efeb658be..1d1dde4ad 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -616,7 +616,7 @@ int cmCTestTestHandler::ProcessHandler() ofs << ftit->TestCount << ":" << ftit->Name << std::endl; cmCTestLog(this->CTest, HANDLER_OUTPUT, "\t" << std::setw(3) << ftit->TestCount << " - " - << ftit->Name.c_str() << " (" + << ftit->Name << " (" << this->GetTestStatus(ftit->Status) << ")" << std::endl); } @@ -1022,7 +1022,7 @@ bool cmCTestTestHandler::GetValue(const char* tag, { cmCTestLog(this->CTest, ERROR_MESSAGE, "parse error: missing tag: " - << tag << " found [" << line.c_str() << "]" << std::endl); + << tag << " found [" << line << "]" << std::endl); ret = false; } return ret; @@ -1223,7 +1223,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os) { os << "\t\t\tfirst.c_str() << "\">" + << "name=\"" << measureIt->first << "\">" << cmXMLSafe(measureIt->second) << "\n"; } @@ -1820,7 +1820,7 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() else if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem reading file: " - << lastTestsFailedLog.c_str() << + << lastTestsFailedLog << " while generating list of previously failed tests." << std::endl); } } @@ -1960,7 +1960,7 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << " " << k1 << "=\"" << v1 << "\"" << " " << k2 << "=\"" << v2 << "\"" << " encoding=\"none\"" - << ">Image " << filename.c_str() + << ">Image " << filename << " is empty"; } else @@ -2014,10 +2014,10 @@ std::string cmCTestTestHandler::GenerateRegressionImages( << "\t\t\tFile " << filename.c_str() + << ">File " << filename << " not found" << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename.c_str() + cmCTestLog(this->CTest, HANDLER_OUTPUT, "File \"" << filename << "\" not found." << std::endl); } cxml.erase(measurementfile.start(), diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 11474ecb9..fda61ea49 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -331,7 +331,7 @@ int cmCTestUpdateHandler::DetectVCS(const char* dir) { std::string sourceDirectory = dir; cmCTestLog(this->CTest, DEBUG, "Check directory: " - << sourceDirectory.c_str() << std::endl); + << sourceDirectory << std::endl); sourceDirectory += "/.svn"; if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) { diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index caf2e5370..4c3f81b11 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -64,7 +64,7 @@ int cmCTestUploadHandler::ProcessHandler() for ( it = this->Files.begin(); it != this->Files.end(); it ++ ) { cmCTestLog(this->CTest, OUTPUT, - "\tUpload file: " << it->c_str() << std::endl); + "\tUpload file: " << *it << std::endl); ofs << "\n" << "\n"; ofs << this->CTest->Base64EncodeFile(*it); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index c3a9a16d4..d5f00ff12 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -286,7 +286,7 @@ bool cmAddCustomCommandCommand // No command for this output exists. cmOStringStream e; - e << "given APPEND option with output \"" << output[0].c_str() + e << "given APPEND option with output \"" << output[0] << "\" which is not already a custom command output."; this->SetError(e.str()); return false; diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index ba3a83245..58b61deef 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -79,7 +79,7 @@ bool cmCMakeMinimumRequired &required_patch, &required_tweak) < 2) { cmOStringStream e; - e << "could not parse VERSION \"" << version_string.c_str() << "\"."; + e << "could not parse VERSION \"" << version_string << "\"."; this->SetError(e.str()); return false; } @@ -98,7 +98,7 @@ bool cmCMakeMinimumRequired { // The current version is too low. cmOStringStream e; - e << "CMake " << version_string.c_str() + e << "CMake " << version_string << " or higher is required. You are running version " << cmVersion::GetCMakeVersion(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 678b497f4..9f711b73b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -78,7 +78,7 @@ struct tm* cmCTest::GetNightlyTime(std::string str, lctime->tm_mday, str.c_str()); cmCTestLog(this, OUTPUT, "Determine Nightly Start Time" << std::endl - << " Specified time: " << str.c_str() << std::endl); + << " Specified time: " << str << std::endl); //Convert the nightly start time to seconds. Since we are //providing only a time and a timezone, the current date of //the local machine is assumed. Consequently, nightlySeconds @@ -681,7 +681,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) if ( !fname.empty() ) { cmCTestLog(this, OUTPUT, " Reading ctest configuration file: " - << fname.c_str() << std::endl); + << fname << std::endl); bool readit = mf->ReadListFile(mf->GetCurrentListFile(), fname.c_str() ); if(!readit) @@ -696,10 +696,10 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { cmCTestLog(this, WARNING, "Cannot locate CTest configuration: in BuildDirectory: " - << bld_dir_fname.c_str() << std::endl); + << bld_dir_fname << std::endl); cmCTestLog(this, WARNING, "Cannot locate CTest configuration: in SourceDirectory: " - << src_dir_fname.c_str() << std::endl); + << src_dir_fname << std::endl); } this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime", @@ -748,13 +748,13 @@ bool cmCTest::UpdateCTestConfiguration() } } cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "UpdateCTestConfiguration from :" - << fileName.c_str() << "\n"); + << fileName << "\n"); if ( !cmSystemTools::FileExists(fileName.c_str()) ) { // No need to exit if we are not producing XML if ( this->ProduceXML ) { - cmCTestLog(this, ERROR_MESSAGE, "Cannot find file: " << fileName.c_str() + cmCTestLog(this, ERROR_MESSAGE, "Cannot find file: " << fileName << std::endl); return false; } @@ -762,7 +762,7 @@ bool cmCTest::UpdateCTestConfiguration() else { cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "Parse Config file:" - << fileName.c_str() << "\n"); + << fileName << "\n"); // parse the dart test file cmsys::ifstream fin(fileName.c_str()); @@ -1346,7 +1346,7 @@ int cmCTest::RunTest(std::vector argv, *output += oss.str(); if ( log ) { - *log << output->c_str(); + *log << *output; } cmSystemTools::ChangeDirectory(oldpath.c_str()); @@ -1562,7 +1562,7 @@ void cmCTest::AddSiteProperties(std::ostream& ostr) for(std::vector::iterator i = args.begin(); i != args.end(); ++i) { - ostr << " \n"; + ostr << " \n"; } ostr << " \n"; } @@ -1606,7 +1606,7 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, for ( it = files.begin(); it != files.end(); it ++ ) { - cmCTestLog(this, OUTPUT, "\tAdd file: " << it->c_str() << std::endl); + cmCTestLog(this, OUTPUT, "\tAdd file: " << *it << std::endl); std::string note_time = this->CurrentTime(); os << "\n" << "\n" @@ -1624,8 +1624,8 @@ int cmCTest::GenerateCTestNotesOutput(std::ostream& os, } else { - os << "Problem reading file: " << it->c_str() << std::endl; - cmCTestLog(this, ERROR_MESSAGE, "Problem reading file: " << it->c_str() + os << "Problem reading file: " << *it << std::endl; + cmCTestLog(this, ERROR_MESSAGE, "Problem reading file: " << *it << " while creating notes" << std::endl); } os << "\n" @@ -1732,7 +1732,7 @@ bool cmCTest::SubmitExtraFiles(const VectorOfStrings &files) if ( !cmSystemTools::FileExists(it->c_str()) ) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " - << it->c_str() << " to submit." + << *it << " to submit." << std::endl;); return false; } @@ -2319,7 +2319,7 @@ int cmCTest::Run(std::vector &args, std::string* output) executeTests = false; cmCTestLog(this, ERROR_MESSAGE, "CTest -T called with incorrect option: " - << args[i].c_str() << std::endl); + << args[i] << std::endl); cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl << " " << ctestExec << " -T all" << std::endl << " " << ctestExec << " -T start" << std::endl @@ -2356,7 +2356,7 @@ int cmCTest::Run(std::vector &args, std::string* output) { executeTests = false; cmCTestLog(this, ERROR_MESSAGE, - "CTest -M called with incorrect option: " << str.c_str() + "CTest -M called with incorrect option: " << str << std::endl); cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl << " " << ctestExec << " -M Continuous" << std::endl @@ -2527,11 +2527,11 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) std::string fname = dir; fname += "/CTestCustom.cmake"; cmCTestLog(this, DEBUG, "* Check for file: " - << fname.c_str() << std::endl); + << fname << std::endl); if ( cmSystemTools::FileExists(fname.c_str()) ) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " - << fname.c_str() << std::endl); + << fname << std::endl); bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); @@ -2540,7 +2540,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " - << fname.c_str() << std::endl); + << fname << std::endl); } found = true; if ( erroroc ) @@ -2552,7 +2552,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) std::string rexpr = dir; rexpr += "/CTestCustom.ctest"; cmCTestLog(this, DEBUG, "* Check for file: " - << rexpr.c_str() << std::endl); + << rexpr << std::endl); if ( !found && cmSystemTools::FileExists(rexpr.c_str()) ) { cmsys::Glob gl; @@ -2564,13 +2564,13 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) ++ fileIt ) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); if ( !mf->ReadListFile(0, fileIt->c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " - << fileIt->c_str() << std::endl); + << *fileIt << std::endl); } } found = true; @@ -2584,7 +2584,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration vectors for handler: " - << it->first.c_str() << " (" << it->second << ")" << std::endl); + << it->first << " (" << it->second << ")" << std::endl); it->second->PopulateCustomVectors(mf); } } @@ -2610,7 +2610,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, for ( it = slist.begin(); it != slist.end(); ++it ) { - cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl); + cmCTestLog(this, DEBUG, " -- " << *it << std::endl); vec.push_back(*it); } } @@ -2849,7 +2849,7 @@ void cmCTest::AddCTestConfigurationOverwrite(const std::string& overStr) "CTest configuration overwrite specified in the wrong format." << std::endl << "Valid format is: --overwrite key=value" << std::endl - << "The specified was: --overwrite " << overStr.c_str() << std::endl); + << "The specified was: --overwrite " << overStr << std::endl); return; } std::string key = overStr.substr(0, epos); diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 159f9c307..8f352b112 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -644,7 +644,7 @@ void cmCacheManager::OutputHelpString(std::ostream& fout, fout << "\\n"; } oneLine = helpString.substr(pos, i - pos); - fout << oneLine.c_str() << "\n"; + fout << oneLine << "\n"; pos = i; } } @@ -698,7 +698,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const { if((*i).second.Type != INTERNAL) { - out << (*i).first.c_str() << " = " << (*i).second.Value.c_str() + out << (*i).first << " = " << (*i).second.Value << std::endl; } } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index c9490ca53..a7f6b494c 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -293,7 +293,7 @@ int cmCommandArgumentParserHelper::ParseString(const char* str, int verb) if ( Verbose ) { std::cerr << "Expanding [" << str << "] produced: [" - << this->Result.c_str() << "]" << std::endl; + << this->Result << "]" << std::endl; } return 1; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 3987283bc..a3f327775 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -284,7 +284,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { cmOStringStream e; e << "Failed to open\n" - << " " << outFileName.c_str() << "\n" + << " " << outFileName << "\n" << cmSystemTools::GetLastSystemError(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return -1; @@ -519,9 +519,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) { cmOStringStream emsg; emsg << "Cannot copy output executable\n" - << " '" << this->OutputFile.c_str() << "'\n" + << " '" << this->OutputFile << "'\n" << "to destination specified by COPY_FILE:\n" - << " '" << copyFile.c_str() << "'\n"; + << " '" << copyFile << "'\n"; if(!this->FindErrorMessage.empty()) { emsg << this->FindErrorMessage.c_str(); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 56ef6e2f3..d26d3a90f 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -278,7 +278,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; - internalDepends << " " << i->c_str() << std::endl; + internalDepends << " " << *i << std::endl; } makeDepends << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 1d91b4aa8..79cb560b6 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -453,7 +453,7 @@ cmDependsFortran cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; - internalDepends << " " << i->c_str() << std::endl; + internalDepends << " " << *i << std::endl; } makeDepends << std::endl; @@ -666,7 +666,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) if(!cmSystemTools::CopyFileAlways(mod_upper.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_upper.c_str() << "\" to \"" << stamp.c_str() + << mod_upper << "\" to \"" << stamp << "\".\n"; return false; } @@ -681,7 +681,7 @@ bool cmDependsFortran::CopyModule(const std::vector& args) if(!cmSystemTools::CopyFileAlways(mod_lower.c_str(), stamp.c_str())) { std::cerr << "Error copying Fortran module from \"" - << mod_lower.c_str() << "\" to \"" << stamp.c_str() + << mod_lower << "\" to \"" << stamp << "\".\n"; return false; } @@ -689,9 +689,9 @@ bool cmDependsFortran::CopyModule(const std::vector& args) return true; } - std::cerr << "Error copying Fortran module \"" << args[2].c_str() - << "\". Tried \"" << mod_upper.c_str() - << "\" and \"" << mod_lower.c_str() << "\".\n"; + std::cerr << "Error copying Fortran module \"" << args[2] + << "\". Tried \"" << mod_upper + << "\" and \"" << mod_lower << "\".\n"; return false; } diff --git a/Source/cmDependsJavaParserHelper.cxx b/Source/cmDependsJavaParserHelper.cxx index e23e4b7ff..02f2d21d6 100644 --- a/Source/cmDependsJavaParserHelper.cxx +++ b/Source/cmDependsJavaParserHelper.cxx @@ -262,7 +262,7 @@ void cmDependsJavaParserHelper::PrintClasses() sit != files.end(); ++ sit ) { - std::cout << " " << sit->c_str() << ".class" << std::endl; + std::cout << " " << *sit << ".class" << std::endl; } } @@ -308,7 +308,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) if ( this->CurrentPackage.size() > 0 ) { std::cout << "Current package is: " << - this->CurrentPackage.c_str() << std::endl; + this->CurrentPackage << std::endl; } std::cout << "Imports packages:"; if ( this->PackagesImport.size() > 0 ) @@ -318,7 +318,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) it != this->PackagesImport.end(); ++ it ) { - std::cout << " " << it->c_str(); + std::cout << " " << *it; } } std::cout << std::endl; @@ -330,7 +330,7 @@ int cmDependsJavaParserHelper::ParseString(const char* str, int verb) it != this->ClassesFound.end(); ++ it ) { - std::cout << " " << it->c_str(); + std::cout << " " << *it; } } std::cout << std::endl; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index a4bc83d1f..d421889e7 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -693,7 +693,7 @@ bool cmDocumentation::PrintHelpOneManual(std::ostream& os) return true; } // Argument was not a manual. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-manual is not an available manual. " << "Use --help-manual-list to see all available manuals.\n"; return false; @@ -715,7 +715,7 @@ bool cmDocumentation::PrintHelpOneCommand(std::ostream& os) return true; } // Argument was not a command. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-command is not a CMake command. " << "Use --help-command-list to see all commands.\n"; return false; @@ -737,7 +737,7 @@ bool cmDocumentation::PrintHelpOneModule(std::ostream& os) return true; } // Argument was not a module. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-module is not a CMake module.\n"; return false; } @@ -772,7 +772,7 @@ bool cmDocumentation::PrintHelpOneProperty(std::ostream& os) return true; } // Argument was not a property. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-property is not a CMake property. " << "Use --help-property-list to see all properties.\n"; return false; @@ -796,7 +796,7 @@ bool cmDocumentation::PrintHelpOnePolicy(std::ostream& os) } // Argument was not a policy. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-policy is not a CMake policy.\n"; return false; } @@ -817,7 +817,7 @@ bool cmDocumentation::PrintHelpOneVariable(std::ostream& os) return true; } // Argument was not a variable. Complain. - os << "Argument \"" << this->CurrentArgument.c_str() + os << "Argument \"" << this->CurrentArgument << "\" to --help-variable is not a defined variable. " << "Use --help-variable-list to see all defined variables.\n"; return false; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 3dc1f6cea..a83a228b7 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -271,7 +271,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig( { std::string se = cmSystemTools::GetLastSystemError(); cmOStringStream e; - e << "cannot write to file \"" << fileName.c_str() + e << "cannot write to file \"" << fileName << "\": " << se; cmSystemTools::Error(e.str().c_str()); return false; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index edb9c38c0..dba240651 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -499,7 +499,7 @@ void cmExtraCodeBlocksGenerator sit!=otherFiles.end(); ++sit) { - fout<<" c_str() <<"\">\n" + fout<<" \n" " \n"; } @@ -653,7 +653,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, dirIt != uniqIncludeDirs.end(); ++dirIt) { - fout <<" c_str() << "\" />\n"; + fout <<" \n"; } fout<<" \n"; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index da397b191..1cbd0577a 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -311,7 +311,7 @@ void cmExtraCodeLiteGenerator { std::string relativePath = cmSystemTools::RelativePath(projectPath.c_str(), sit->first.c_str()); - fout<< " \n"; + fout<< " \n"; } fout<< " \n"; fout<< " \n"; @@ -322,7 +322,7 @@ void cmExtraCodeLiteGenerator { std::string relativePath = cmSystemTools::RelativePath(projectPath.c_str(), sit->c_str()); - fout << " \n"; + fout << " \n"; } fout << " \n"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d02e54df6..fcb95a0ed 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -1292,7 +1292,7 @@ void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout, std::string pathXml = cmExtraEclipseCDT4Generator::EscapeForXML(path); fout << "\n" "" << cmExtraEclipseCDT4Generator::GetEclipsePath(make) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 1d4e30c1e..a790e0040 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -268,7 +268,7 @@ bool cmFindPackageCommand else { cmOStringStream e; - e << "called with invalid argument \"" << args[i].c_str() << "\""; + e << "called with invalid argument \"" << args[i] << "\""; this->SetError(e.str()); return false; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b67da5bd6..b95ff81ae 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2318,7 +2318,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) it != componentsSet->end(); ++ it ) { - ostr << " \"" << it->c_str() << "\""; + ostr << " \"" << *it << "\""; } } else diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 2e856ba8e..df3ce108d 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -360,7 +360,7 @@ void cmGlobalKdevelopGenerator if (strstr(line, "")) { fout<< " KDevCustomProject\n"; - fout<< " " <" <\n"; //this one is important fout<<" true\n"; //and this one @@ -368,14 +368,14 @@ void cmGlobalKdevelopGenerator // inside kdevcustomproject the must be put if (strstr(line, "")) { - fout<<" "<"<\n"; } // buildtool and builddir go inside if (strstr(line, "")) { fout<<" make\n"; - fout<<" "<\n"; + fout<<" "<\n"; } } } @@ -417,7 +417,7 @@ void cmGlobalKdevelopGenerator " KDevCustomProject\n" " " << primaryLanguage << "\n" " \n" - " " << projectDir.c_str() << + " " << projectDir << "\n"; //this one is important fout<<" true\n"; //and this one @@ -444,12 +444,12 @@ void cmGlobalKdevelopGenerator fout<<" \n" " \n" - " " << outputDir.c_str() << + " " << outputDir << "\n" " \n" - " " << executable.c_str() << "\n" + " " << executable << "\n" " custom\n" - " "<\n" + " "<\n" " \n" " false\n" " true\n" @@ -457,7 +457,7 @@ void cmGlobalKdevelopGenerator " \n" " \n" " make\n"; //this one is important - fout<<" "<\n"; //and this one + fout<<" "<\n"; //and this one fout<<" \n" " \n" " false\n" @@ -480,7 +480,7 @@ void cmGlobalKdevelopGenerator dirIt != this->Blacklist.end(); ++dirIt) { - fout<<" " << dirIt->c_str() << "\n"; + fout<<" " << *dirIt << "\n"; } fout<<" \n"; @@ -558,7 +558,7 @@ void cmGlobalKdevelopGenerator // command fout<<" \n" " \n" - " \n"; if (enableCxx) @@ -601,7 +601,7 @@ void cmGlobalKdevelopGenerator "\n" "\n" " \n" - " \n" " \n" " \n" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4a19c0c97..f5c56a987 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -357,13 +357,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" << lg->Convert(cache, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; + cmLocalGenerator::START_OUTPUT) << "\"\n"; for(std::vector::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" - << lg->Convert(*i, cmLocalGenerator::START_OUTPUT).c_str() + << lg->Convert(*i, cmLocalGenerator::START_OUTPUT) << "\"\n"; } cmakefileStream @@ -380,10 +380,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" << lg->Convert(makefileName, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" + cmLocalGenerator::START_OUTPUT) << "\"\n" << " \"" << lg->Convert(check, - cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; + cmLocalGenerator::START_OUTPUT) << "\"\n"; cmakefileStream << " )\n\n"; // CMake must rerun if a byproduct is missing. @@ -397,7 +397,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() k != outfiles.end(); ++k) { cmakefileStream << " \"" << - lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } @@ -411,7 +411,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << - lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -450,7 +450,7 @@ void cmGlobalUnixMakefileGenerator3 std::string tname = lg->GetRelativeTargetDirectory(l->second); tname += "/DependInfo.cmake"; cmSystemTools::ConvertToUnixSlashes(tname); - cmakefileStream << " \"" << tname.c_str() << "\"\n"; + cmakefileStream << " \"" << tname << "\"\n"; } } } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 824e9e746..601993f95 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -349,8 +349,8 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName, this->WriteNode(libName, this->TargetPtrs.find(libName)->second, insertedNodes, str); - str << " \"" << myNodeName.c_str() << "\" -> \"" - << libNameIt->second.c_str() << "\""; + str << " \"" << myNodeName << "\" -> \"" + << libNameIt->second << "\""; str << " // " << targetName << " -> " << libName << std::endl; this->WriteConnections(libName, insertedNodes, insertedConnections, str); } @@ -455,7 +455,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName, std::map::const_iterator nameIt = this->TargetNamesNodes.find(targetName); - str << " \"" << nameIt->second.c_str() << "\" [ label=\"" + str << " \"" << nameIt->second << "\" [ label=\"" << targetName << "\" shape=\"" << getShapeForTarget(target) << "\"];" << std::endl; } diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 0fad9d66c..9370e4871 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -91,7 +91,7 @@ void cmInstallGenerator << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; os << indent << "endif()\n"; } - os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); + os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype; if(optional) { os << " OPTIONAL"; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 21957f9ef..de8dd514c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -503,7 +503,7 @@ void cmLocalGenerator::GenerateInstallRules() { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); - fout << " include(\"" << odir.c_str() + fout << " include(\"" << odir << "/cmake_install.cmake\")" << std::endl; } } @@ -523,12 +523,12 @@ void cmLocalGenerator::GenerateInstallRules() "endif()\n\n"; fout << "file(WRITE \"" - << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " + << homedir << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"\")" << std::endl; fout << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl << " file(APPEND \"" - << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " + << homedir << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"${file}\\n\")" << std::endl << "endforeach()" << std::endl; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5dd2bb12b..02d388a93 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -625,7 +625,7 @@ cmLocalUnixMakefileGenerator3 i != commands.end(); ++i) { replace = *i; - os << "\t" << replace.c_str() << "\n"; + os << "\t" << replace << "\n"; } if(symbolic && !this->WatcomWMake) { @@ -1933,7 +1933,7 @@ void cmLocalUnixMakefileGenerator3 for(ImplicitDependLanguageMap::const_iterator l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { - cmakefileStream << " \"" << l->first.c_str() << "\"\n"; + cmakefileStream << " \"" << l->first << "\"\n"; } cmakefileStream << " )\n"; @@ -1944,7 +1944,7 @@ void cmLocalUnixMakefileGenerator3 l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { cmakefileStream - << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; + << "set(CMAKE_DEPENDS_CHECK_" << l->first << "\n"; ImplicitDependFileMap const& implicitPairs = l->second; // for each file pair @@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3 if(cid && *cid) { cmakefileStream - << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" + << "set(CMAKE_" << l->first << "_COMPILER_ID \"" << cid << "\")\n"; } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6fef3718c..58625fbc1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -240,7 +240,7 @@ void cmMakefile::PrintStringVector(const char* s, for(std::vector::const_iterator i = v.begin(); i != v.end(); ++i) { - std::cout << (*i).c_str() << " "; + std::cout << *i << " "; } std::cout << " )\n"; } @@ -253,7 +253,7 @@ void cmMakefile for(std::vector >::const_iterator i = v.begin(); i != v.end(); ++i) { - std::cout << i->first.c_str() << " " << i->second; + std::cout << i->first << " " << i->second; } std::cout << " )\n"; } @@ -273,15 +273,15 @@ void cmMakefile::Print() const } std::cout << " this->StartOutputDirectory; " << - this->StartOutputDirectory.c_str() << std::endl; + this->StartOutputDirectory << std::endl; std::cout << " this->HomeOutputDirectory; " << - this->HomeOutputDirectory.c_str() << std::endl; + this->HomeOutputDirectory << std::endl; std::cout << " this->cmStartDirectory; " << - this->cmStartDirectory.c_str() << std::endl; + this->cmStartDirectory << std::endl; std::cout << " this->cmHomeDirectory; " << - this->cmHomeDirectory.c_str() << std::endl; + this->cmHomeDirectory << std::endl; std::cout << " this->ProjectName; " - << this->ProjectName.c_str() << std::endl; + << this->ProjectName << std::endl; this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); #if defined(CMAKE_BUILD_WITH_CMAKE) for( std::vector::const_iterator i = @@ -2619,7 +2619,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, << " " << filename << ":" << line << "\n"; } error << "when parsing string\n" - << " " << source.c_str() << "\n"; + << " " << source << "\n"; error << emsg; // If the parser failed ("res" is false) then this is a real diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0730bc371..983fd997f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -353,7 +353,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() std::string compiler = "CMAKE_"; compiler += *l; compiler += "_COMPILER"; - *this->FlagFileStream << "# compile " << l->c_str() << " with " << + *this->FlagFileStream << "# compile " << *l << " with " << this->Makefile->GetSafeDefinition(compiler) << "\n"; } @@ -1353,7 +1353,7 @@ cmMakefileTargetGenerator "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" - << variableName.c_str() << " ="; + << variableName << " ="; std::string object; const char* objName = this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS"); @@ -1390,7 +1390,7 @@ cmMakefileTargetGenerator << "\n" << "# External object files for target " << this->Target->GetName() << "\n" - << variableNameExternal.c_str() << " ="; + << variableNameExternal << " ="; for(std::vector::const_iterator i = this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 365665df6..edba5baf8 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -91,7 +91,7 @@ bool cmSourceGroupCommand else { cmOStringStream err; - err << "Unknown argument \"" << args[i].c_str() << "\". " + err << "Unknown argument \"" << args[i] << "\". " << "Perhaps the FILES keyword is missing.\n"; this->SetError(err.str()); return false; diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 60796ec4f..8d26f863a 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -107,12 +107,12 @@ CopyAndFullPathMesaHeader(const char* source, if(glDirLine.find(includeFile.c_str())) { std::string gfile = glDirLine.match(3); - fout << "#include \"" << outdir << "/" << gfile.c_str() << "\"\n"; + fout << "#include \"" << outdir << "/" << gfile << "\"\n"; } else if(glLine.find(includeFile.c_str())) { fout << "#include \"" << outdir << "/" << - includeLine.match(1).c_str() << "\"\n"; + includeLine.match(1) << "\"\n"; } else { diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 3c1fe466c..debe24340 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -84,7 +84,7 @@ static void cmVariableWatchCommandVariableAccessed( if ( !processed ) { cmOStringStream msg; - msg << "Variable \"" << variable.c_str() << "\" was accessed using " + msg << "Variable \"" << variable << "\" was accessed using " << accessString << " with value \"" << (newValue?newValue:"") << "\"."; makefile->IssueMessage(cmake::LOG, msg.str()); } @@ -136,7 +136,7 @@ bool cmVariableWatchCommand if ( variable == "CMAKE_CURRENT_LIST_FILE" ) { cmOStringStream ostr; - ostr << "cannot be set on the variable: " << variable.c_str(); + ostr << "cannot be set on the variable: " << variable; this->SetError(ostr.str()); return false; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ad8e5e61d..4ce1d7065 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -433,7 +433,7 @@ bool cmake::SetCacheArgs(const std::vector& args) return false; } } - std::cerr << "loading initial cache file " << path.c_str() << "\n"; + std::cerr << "loading initial cache file " << path << "\n"; this->ReadListFile(args, path.c_str()); } else if(arg.find("-P",0) == 0) @@ -1922,7 +1922,7 @@ int cmake::CheckBuildSystem() { cmOStringStream msg; msg << "Re-run cmake missing file: " - << this->CheckBuildSystemArgument.c_str() << "\n"; + << this->CheckBuildSystemArgument << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } return 1; @@ -1942,7 +1942,7 @@ int cmake::CheckBuildSystem() { cmOStringStream msg; msg << "Re-run cmake error reading : " - << this->CheckBuildSystemArgument.c_str() << "\n"; + << this->CheckBuildSystemArgument << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } // There was an error reading the file. Just rerun. @@ -2076,8 +2076,8 @@ int cmake::CheckBuildSystem() if(verbose) { cmOStringStream msg; - msg << "Re-run cmake file: " << out_oldest.c_str() - << " older than: " << dep_newest.c_str() << "\n"; + msg << "Re-run cmake file: " << out_oldest + << " older than: " << dep_newest << "\n"; cmSystemTools::Stdout(msg.str().c_str()); } return 1; @@ -2351,8 +2351,8 @@ int cmake::GetSystemInformation(std::vector& args) // Copy file if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) { - std::cerr << "Error copying file \"" << inFile.c_str() - << "\" to \"" << outFile.c_str() << "\".\n"; + std::cerr << "Error copying file \"" << inFile + << "\" to \"" << outFile << "\".\n"; return 1; } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index ad1f2a5a0..9aee975cc 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -102,8 +102,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str())) { - std::cerr << "Error copying file \"" << args[2].c_str() - << "\" to \"" << args[3].c_str() << "\".\n"; + std::cerr << "Error copying file \"" << args[2] + << "\" to \"" << args[3] << "\".\n"; return 1; } return 0; @@ -116,7 +116,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) args[3].c_str())) { std::cerr << "Error copying file (if different) from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\".\n"; return 1; } @@ -129,7 +129,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(!cmSystemTools::CopyADirectory(args[2].c_str(), args[3].c_str())) { std::cerr << "Error copying directory from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\".\n"; return 1; } @@ -143,7 +143,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { std::string e = cmSystemTools::GetLastSystemError(); std::cerr << "Error renaming from \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\": " << e << "\n"; return 1; } @@ -156,7 +156,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmSystemTools::FilesDiffer(args[2].c_str(), args[3].c_str())) { std::cerr << "Files \"" - << args[2].c_str() << "\" to \"" << args[3].c_str() + << args[2] << "\" to \"" << args[3] << "\" are different.\n"; return 1; } @@ -199,7 +199,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) std::vector::iterator it; for ( it = env.begin(); it != env.end(); ++ it ) { - std::cout << it->c_str() << std::endl; + std::cout << *it << std::endl; } return 0; } @@ -209,7 +209,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) { if(!cmSystemTools::MakeDirectory(args[2].c_str())) { - std::cerr << "Error making directory \"" << args[2].c_str() + std::cerr << "Error making directory \"" << args[2] << "\".\n"; return 1; } @@ -221,7 +221,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) if(cmSystemTools::FileIsDirectory(args[2].c_str()) && !cmSystemTools::RemoveADirectory(args[2].c_str())) { - std::cerr << "Error removing directory \"" << args[2].c_str() + std::cerr << "Error removing directory \"" << args[2] << "\".\n"; return 1; } @@ -1181,7 +1181,7 @@ bool cmcmd::RunCommand(const char* comment, for(std::vector::iterator i = command.begin(); i != command.end(); ++i) { - std::cout << i->c_str() << " "; + std::cout << *i << " "; } std::cout << "\n"; } @@ -1257,7 +1257,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, resourceInputFile += ".resource.txt"; if(verbose) { - std::cout << "Create " << resourceInputFile.c_str() << "\n"; + std::cout << "Create " << resourceInputFile << "\n"; } // Create input file for rc command cmsys::ofstream fout(resourceInputFile.c_str()); @@ -1269,7 +1269,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, manifestFile += ".embed.manifest"; std::string fullPath= cmSystemTools::CollapseFullPath(manifestFile.c_str()); fout << type << " /* CREATEPROCESS_MANIFEST_RESOURCE_ID " - "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath.c_str() << "\""; + "*/ 24 /* RT_MANIFEST */ " << "\"" << fullPath << "\""; fout.close(); manifestArg += tempManifest; // add the manifest arg to the linkCommand @@ -1281,7 +1281,7 @@ int cmcmd::VisualStudioLinkIncremental(std::vector& args, { if(verbose) { - std::cout << "Create empty: " << manifestFile.c_str() << "\n"; + std::cout << "Create empty: " << manifestFile << "\n"; } cmsys::ofstream foutTmp(manifestFile.c_str()); } From c4c6427ed656e181d569d1c7baca29813c12b9fb Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 12 Mar 2014 00:01:12 -0400 Subject: [PATCH 168/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 18e328a9b..aaddd9232 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140311) +set(CMake_VERSION_PATCH 20140312) #set(CMake_VERSION_RC 1) From ae32622bcfe4aee667b749f89e61d9a4fe44c762 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 12 Mar 2014 09:54:20 -0400 Subject: [PATCH 169/278] cmake-gui: Fix handling of missing CMAKE_EXTRA_GENERATOR (#14804) Since commit 1a1b737c (stringapi: Use strings for generator names, 2014-02-24) cmExternalMakefileProjectGenerator::CreateFullGeneratorName expects a std::string instead of const char*. When no extra generator name is available, pass an empty string to avoid NULL dereference. --- Source/QtDialog/QCMake.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 12da3209d..5f9ebafb0 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -117,7 +117,7 @@ void QCMake::setBinaryDirectory(const QString& _dir) { const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR"); std::string curGen = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(itm.GetValue(), extraGen); + CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : ""); this->setGenerator(QString::fromLocal8Bit(curGen.c_str())); } } From 3be265b304da0879c79e2fcdfff6f25b1a4e87c1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 12 Mar 2014 10:39:23 -0400 Subject: [PATCH 170/278] Workaround Sun C++ 5.9 compiler crash Adjust whitespace in Source/CPack/cpack.cxx to avoid a strange internal compiler crash. --- Source/CPack/cpack.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 7ebfedaf0..9eabdcae5 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -275,8 +275,8 @@ int main (int argc, char const* const* argv) else if ( cpackConfigFileSpecified ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, - "Cannot find CPack config file: \"" << cpackConfigFile - << "\"" << std::endl); + "Cannot find CPack config file: \"" << + cpackConfigFile << "\"" << std::endl); return 1; } From d45e7f34611cd678bdda29d7d2b2ff4ce1abbce7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Mar 2014 13:53:57 -0400 Subject: [PATCH 171/278] cmCustomCommand: Return std::string from GetWorkingDirectory --- Source/cmCustomCommand.cxx | 10 ---------- Source/cmCustomCommand.h | 7 ++++--- Source/cmGlobalXCodeGenerator.cxx | 5 +++-- Source/cmLocalNinjaGenerator.cxx | 6 +++--- Source/cmLocalUnixMakefileGenerator3.cxx | 13 +++++++------ Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudioGenerator.cxx | 8 ++++---- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index b67214854..ac2eef80e 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -100,16 +100,6 @@ const std::vector& cmCustomCommand::GetOutputs() const return this->Outputs; } -//---------------------------------------------------------------------------- -const char* cmCustomCommand::GetWorkingDirectory() const -{ - if(this->WorkingDirectory.size() == 0) - { - return 0; - } - return this->WorkingDirectory.c_str(); -} - //---------------------------------------------------------------------------- const std::vector& cmCustomCommand::GetDepends() const { diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 67c305e55..b5d7e6215 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -42,12 +42,13 @@ public: /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; - /** Get the working directory. */ - const char* GetWorkingDirectory() const; - /** Get the vector that holds the list of dependencies. */ const std::vector& GetDepends() const; + /** Get the working directory. */ + std::string const& GetWorkingDirectory() const + { return this->WorkingDirectory; } + /** Get the list of command lines. */ const cmCustomCommandLines& GetCommandLines() const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 30a2a1ec3..16c74b97b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1646,10 +1646,11 @@ void cmGlobalXCodeGenerator cmSystemTools::ReplaceString(cmd2, "/./", "/"); cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); std::string cmd; - if(cc.GetWorkingDirectory()) + std::string wd = cc.GetWorkingDirectory(); + if(!wd.empty()) { cmd += "cd "; - cmd += this->ConvertToRelativeForMake(cc.GetWorkingDirectory()); + cmd += this->ConvertToRelativeForMake(wd.c_str()); cmd += " && "; } cmd += cmd2; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index acaacdda3..d68a07bc0 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -364,8 +364,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, { cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile); if (ccg.GetNumberOfCommands() > 0) { - const char* wd = cc->GetWorkingDirectory(); - if (!wd) + std::string wd = cc->GetWorkingDirectory(); + if (wd.empty()) wd = this->GetMakefile()->GetStartOutputDirectory(); cmOStringStream cdCmd; @@ -491,7 +491,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( if(!outputs.empty()) { RelativeRoot relative_root = - cc.GetWorkingDirectory() ? NONE : START_OUTPUT; + cc.GetWorkingDirectory().empty() ? START_OUTPUT : NONE; output = this->Convert(outputs[0], relative_root, SHELL); } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3681e0e53..d3f63f51d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1023,9 +1023,9 @@ cmLocalUnixMakefileGenerator3 } // if the command specified a working directory use it. - const char* dir = this->Makefile->GetStartOutputDirectory(); - const char* workingDir = cc.GetWorkingDirectory(); - if(workingDir) + std::string dir = this->Makefile->GetStartOutputDirectory(); + std::string workingDir = cc.GetWorkingDirectory(); + if(!workingDir.empty()) { dir = workingDir; } @@ -1066,7 +1066,7 @@ cmLocalUnixMakefileGenerator3 // Convert the command to a relative path only if the current // working directory will be the start-output directory. bool had_slash = cmd.find("/") != cmd.npos; - if(!workingDir) + if(workingDir.empty()) { cmd = this->Convert(cmd,START_OUTPUT); } @@ -1079,7 +1079,8 @@ cmLocalUnixMakefileGenerator3 cmd = "./" + cmd; } std::string launcher = - this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT); + this->MakeLauncher(cc, target, + workingDir.empty()? START_OUTPUT : NONE); cmd = launcher + this->ConvertShellCommand(cmd, NONE); ccg.AppendArguments(c, cmd); @@ -1125,7 +1126,7 @@ cmLocalUnixMakefileGenerator3 } // Setup the proper working directory for the commands. - this->CreateCDCommand(commands1, dir, relative); + this->CreateCDCommand(commands1, dir.c_str(), relative); // push back the custom commands commands.insert(commands.end(), commands1.begin(), commands1.end()); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f1fd99461..d7130248b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -583,7 +583,7 @@ cmLocalVisualStudio6Generator this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, origCommand.GetCommandLines(), comment.c_str(), - origCommand.GetWorkingDirectory())) + origCommand.GetWorkingDirectory().c_str())) { target.AddSourceFile(outsf); } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 6e93d22c2..3075c1567 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -84,9 +84,9 @@ cmLocalVisualStudioGenerator const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); - const char* workingDirectory = cc.GetWorkingDirectory(); + std::string workingDirectory = cc.GetWorkingDirectory(); cmCustomCommandGenerator ccg(cc, configName, this->Makefile); - RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; + RelativeRoot relativeRoot = workingDirectory.empty()? START_OUTPUT : NONE; // Avoid leading or trailing newlines. std::string newline = ""; @@ -114,7 +114,7 @@ cmLocalVisualStudioGenerator script += "setlocal"; } - if(workingDirectory) + if(!workingDirectory.empty()) { // Change the working directory. script += newline; @@ -124,7 +124,7 @@ cmLocalVisualStudioGenerator script += check_error; // Change the working drive. - if(workingDirectory[0] && workingDirectory[1] == ':') + if(workingDirectory.size() > 1 && workingDirectory[1] == ':') { script += newline; newline = newline_text; From 9a5c55441418ef79415b9a1b99c35192d2b8c1b0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Mar 2014 15:04:38 -0400 Subject: [PATCH 172/278] cmGlobalXCodeGenerator: Simplify handling of multiple outputs Make the multiple output pair map more local. Generate it where we have the current configuration available. --- Source/cmGlobalXCodeGenerator.cxx | 49 ++++++++++++------------------- Source/cmGlobalXCodeGenerator.h | 4 +-- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 16c74b97b..2dd31f3ac 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1470,32 +1470,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, const & commands, const char* name) { - - // collect multiple outputs of custom commands into a set - // which will be used for every configuration - std::map multipleOutputPairs; - for(std::vector::const_iterator i = commands.begin(); - i != commands.end(); ++i) - { - cmCustomCommand const& cc = *i; - if(!cc.GetCommandLines().empty()) - { - const std::vector& outputs = cc.GetOutputs(); - if(!outputs.empty()) - { - // If there are more than one outputs treat the - // first as the primary output and make the rest depend on it. - std::vector::const_iterator o = outputs.begin(); - std::string primaryOutput = this->ConvertToRelativeForMake(o->c_str()); - for(++o; o != outputs.end(); ++o) - { - std::string currentOutput=this->ConvertToRelativeForMake(o->c_str()); - multipleOutputPairs[currentOutput] = primaryOutput; - } - } - } - } - + bool haveMultipleOutputPairs = false; std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); dir += "/CMakeScripts"; cmSystemTools::MakeDirectory(dir.c_str()); @@ -1515,7 +1490,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, target, commands, currentConfig->c_str(), - multipleOutputPairs); + haveMultipleOutputPairs); } std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory(); @@ -1525,7 +1500,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, makecmd += " -f "; makecmd += this->ConvertToRelativeForMake( (makefile+"$CONFIGURATION").c_str()); - if(!multipleOutputPairs.empty()) + if(haveMultipleOutputPairs) { makecmd += " cmake_check_multiple_outputs"; } @@ -1544,9 +1519,7 @@ void cmGlobalXCodeGenerator std::vector const & commands, const std::string& configName, - const std::map& multipleOutputPairs - ) + bool& haveMultipleOutputPairs) { std::string makefileName=makefileBasename; if(this->XcodeVersion > 20) @@ -1569,6 +1542,7 @@ void cmGlobalXCodeGenerator makefileStream << "all: "; std::map tname; int count = 0; + std::map multipleOutputPairs; for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { @@ -1584,6 +1558,16 @@ void cmGlobalXCodeGenerator makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(o->c_str()); } + + // If there is more than one output treat the first as the + // primary output and make the rest depend on it. + std::vector::const_iterator o = outputs.begin(); + std::string primaryOutput = this->ConvertToRelativeForMake(o->c_str()); + for(++o; o != outputs.end(); ++o) + { + std::string currentOutput=this->ConvertToRelativeForMake(o->c_str()); + multipleOutputPairs[currentOutput] = primaryOutput; + } } else { @@ -1683,6 +1667,9 @@ void cmGlobalXCodeGenerator << o->second << "; fi\n"; } } + + haveMultipleOutputPairs = + haveMultipleOutputPairs || !multipleOutputPairs.empty(); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 93315ba8a..be81cdc4c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -124,9 +124,7 @@ private: cmTarget& target, std::vector const & commands, const std::string& configName, - const std::map& - multipleOutputPairs - ); + bool& haveMultipleOutputPairs); cmXCodeObject* FindXCodeTarget(cmTarget const*); std::string GetOrCreateId(const std::string& name, const std::string& id); From bc993f277ebd44fabe8312a85c5682eed011336d Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Mar 2014 15:47:19 -0400 Subject: [PATCH 173/278] Generalize cmCustomCommandGenerator to more fields Until now the cmCustomCommandGenerator was used only to compute the command lines of a custom command. Generalize it to get the comment, working directory, dependencies, and outputs of custom commands. Update use in all generators to support this. --- Source/cmCustomCommandGenerator.cxx | 24 +++++++++++++ Source/cmCustomCommandGenerator.h | 5 +++ Source/cmGlobalXCodeGenerator.cxx | 29 ++++++++-------- Source/cmLocalGenerator.cxx | 13 ++++---- Source/cmLocalGenerator.h | 3 +- Source/cmLocalNinjaGenerator.cxx | 33 +++++++++--------- Source/cmLocalNinjaGenerator.h | 7 ++-- Source/cmLocalUnixMakefileGenerator3.cxx | 34 ++++++++++--------- Source/cmLocalUnixMakefileGenerator3.h | 9 ++--- Source/cmLocalVisualStudio6Generator.cxx | 39 +++++++++++++--------- Source/cmLocalVisualStudio7Generator.cxx | 24 +++++++------ Source/cmLocalVisualStudioGenerator.cxx | 6 ++-- Source/cmLocalVisualStudioGenerator.h | 4 +-- Source/cmMakefileTargetGenerator.cxx | 28 +++++++++------- Source/cmMakefileTargetGenerator.h | 4 +-- Source/cmNinjaNormalTargetGenerator.cxx | 5 ++- Source/cmNinjaTargetGenerator.cxx | 4 ++- Source/cmNinjaUtilityTargetGenerator.cxx | 11 ++++-- Source/cmVisualStudio10TargetGenerator.cxx | 23 +++++++------ 19 files changed, 182 insertions(+), 123 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index b9cf777a8..a091cff46 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -71,3 +71,27 @@ cmCustomCommandGenerator } } } + +//---------------------------------------------------------------------------- +const char* cmCustomCommandGenerator::GetComment() const +{ + return this->CC.GetComment(); +} + +//---------------------------------------------------------------------------- +std::string cmCustomCommandGenerator::GetWorkingDirectory() const +{ + return this->CC.GetWorkingDirectory(); +} + +//---------------------------------------------------------------------------- +std::vector const& cmCustomCommandGenerator::GetOutputs() const +{ + return this->CC.GetOutputs(); +} + +//---------------------------------------------------------------------------- +std::vector const& cmCustomCommandGenerator::GetDepends() const +{ + return this->CC.GetDepends(); +} diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index 17d644af3..cbcdb413f 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -33,9 +33,14 @@ public: const std::string& config, cmMakefile* mf); ~cmCustomCommandGenerator(); + cmCustomCommand const& GetCC() const { return this->CC; } unsigned int GetNumberOfCommands() const; std::string GetCommand(unsigned int c) const; void AppendArguments(unsigned int c, std::string& cmd) const; + const char* GetComment() const; + std::string GetWorkingDirectory() const; + std::vector const& GetOutputs() const; + std::vector const& GetDepends() const; }; #endif diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 2dd31f3ac..36196a23a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1546,10 +1546,10 @@ void cmGlobalXCodeGenerator for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; - if(!cc.GetCommandLines().empty()) + cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile); + if(ccg.GetNumberOfCommands() > 0) { - const std::vector& outputs = cc.GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); if(!outputs.empty()) { for(std::vector::const_iterator o = outputs.begin(); @@ -1573,8 +1573,8 @@ void cmGlobalXCodeGenerator { cmOStringStream str; str << "_buildpart_" << count++ ; - tname[&cc] = std::string(target.GetName()) + str.str(); - makefileStream << "\\\n\t" << tname[&cc]; + tname[&ccg.GetCC()] = std::string(target.GetName()) + str.str(); + makefileStream << "\\\n\t" << tname[&ccg.GetCC()]; } } } @@ -1582,12 +1582,11 @@ void cmGlobalXCodeGenerator for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand const& cc = *i; - if(!cc.GetCommandLines().empty()) + cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile); + if(ccg.GetNumberOfCommands() > 0) { - cmCustomCommandGenerator ccg(cc, configName, this->CurrentMakefile); makefileStream << "\n"; - const std::vector& outputs = cc.GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); if(!outputs.empty()) { // There is at least one output, start the rule for it @@ -1598,11 +1597,11 @@ void cmGlobalXCodeGenerator else { // There are no outputs. Use the generated force rule name. - makefileStream << tname[&cc] << ": "; + makefileStream << tname[&ccg.GetCC()] << ": "; } for(std::vector::const_iterator d = - cc.GetDepends().begin(); - d != cc.GetDepends().end(); ++d) + ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { std::string dep; if(this->CurrentLocalGenerator @@ -1614,11 +1613,11 @@ void cmGlobalXCodeGenerator } makefileStream << "\n"; - if(const char* comment = cc.GetComment()) + if(const char* comment = ccg.GetComment()) { std::string echo_cmd = "echo "; echo_cmd += (this->CurrentLocalGenerator-> - EscapeForShell(comment, cc.GetEscapeAllowMakeVars())); + EscapeForShell(comment, ccg.GetCC().GetEscapeAllowMakeVars())); makefileStream << "\t" << echo_cmd.c_str() << "\n"; } @@ -1630,7 +1629,7 @@ void cmGlobalXCodeGenerator cmSystemTools::ReplaceString(cmd2, "/./", "/"); cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); std::string cmd; - std::string wd = cc.GetWorkingDirectory(); + std::string wd = ccg.GetWorkingDirectory(); if(!wd.empty()) { cmd += "cd "; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index de8dd514c..ebcfa08c5 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -22,6 +22,7 @@ #include "cmSourceFile.h" #include "cmTest.h" #include "cmTestGenerator.h" +#include "cmCustomCommandGenerator.h" #include "cmVersion.h" #include "cmake.h" @@ -2482,23 +2483,23 @@ void cmLocalGenerator::AppendFeatureOptions( //---------------------------------------------------------------------------- std::string -cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, +cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, const char* default_comment) { // Check for a comment provided with the command. - if(cc.GetComment()) + if(ccg.GetComment()) { - return cc.GetComment(); + return ccg.GetComment(); } // Construct a reasonable default comment if possible. - if(!cc.GetOutputs().empty()) + if(!ccg.GetOutputs().empty()) { std::string comment; comment = "Generating "; const char* sep = ""; - for(std::vector::const_iterator o = cc.GetOutputs().begin(); - o != cc.GetOutputs().end(); ++o) + for(std::vector::const_iterator o = ccg.GetOutputs().begin(); + o != ccg.GetOutputs().end(); ++o) { comment += sep; comment += this->Convert(*o, cmLocalGenerator::START_OUTPUT); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 4d62833d9..afcaee9b5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -21,6 +21,7 @@ class cmTarget; class cmTargetManifest; class cmSourceFile; class cmCustomCommand; +class cmCustomCommandGenerator; /** \class cmLocalGenerator * \brief Create required build files for a directory. @@ -350,7 +351,7 @@ public: const std::string& targetName, const char* fname); /** Construct a comment for a custom command. */ - std::string ConstructComment(const cmCustomCommand& cc, + std::string ConstructComment(cmCustomCommandGenerator const& ccg, const char* default_comment = ""); // Compute object file names. std::string GetObjectFileNameWithoutTarget(const cmSourceFile& source, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index d68a07bc0..7c4aab87c 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -303,10 +303,11 @@ cmLocalNinjaGenerator this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs); } -void cmLocalNinjaGenerator::AppendCustomCommandDeps(const cmCustomCommand *cc, - cmNinjaDeps &ninjaDeps) +void cmLocalNinjaGenerator::AppendCustomCommandDeps( + cmCustomCommandGenerator const& ccg, + cmNinjaDeps &ninjaDeps) { - const std::vector &deps = cc->GetDepends(); + const std::vector &deps = ccg.GetDepends(); for (std::vector::const_iterator i = deps.begin(); i != deps.end(); ++i) { std::string dep; @@ -359,12 +360,12 @@ std::string cmLocalNinjaGenerator::BuildCommandLine( return cmd.str(); } -void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, - std::vector &cmdLines) +void cmLocalNinjaGenerator::AppendCustomCommandLines( + cmCustomCommandGenerator const& ccg, + std::vector &cmdLines) { - cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile); if (ccg.GetNumberOfCommands() > 0) { - std::string wd = cc->GetWorkingDirectory(); + std::string wd = ccg.GetWorkingDirectory(); if (wd.empty()) wd = this->GetMakefile()->GetStartOutputDirectory(); @@ -378,7 +379,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, cmdLines.push_back(cdCmd.str()); } - std::string launcher = this->MakeCustomLauncher(*cc); + std::string launcher = this->MakeCustomLauncher(ccg); for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) { cmdLines.push_back(launcher + @@ -396,19 +397,21 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) return; - const std::vector &outputs = cc->GetOutputs(); + cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile); + + const std::vector &outputs = ccg.GetOutputs(); cmNinjaDeps ninjaOutputs(outputs.size()), ninjaDeps; std::transform(outputs.begin(), outputs.end(), ninjaOutputs.begin(), MapToNinjaPath()); - this->AppendCustomCommandDeps(cc, ninjaDeps); + this->AppendCustomCommandDeps(ccg, ninjaDeps); for (cmNinjaDeps::iterator i = ninjaOutputs.begin(); i != ninjaOutputs.end(); ++i) this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(*i); std::vector cmdLines; - this->AppendCustomCommandLines(cc, cmdLines); + this->AppendCustomCommandLines(ccg, cmdLines); if (cmdLines.empty()) { this->GetGlobalNinjaGenerator()->WritePhonyBuild( @@ -423,7 +426,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( } else { this->GetGlobalNinjaGenerator()->WriteCustomCommandBuild( this->BuildCommandLine(cmdLines), - this->ConstructComment(*cc), + this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], ninjaOutputs, ninjaDeps, @@ -472,7 +475,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() } std::string cmLocalNinjaGenerator::MakeCustomLauncher( - const cmCustomCommand& cc) + cmCustomCommandGenerator const& ccg) { const char* property = "RULE_LAUNCH_CUSTOM"; const char* property_value = this->Makefile->GetProperty(property); @@ -487,11 +490,11 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( RuleVariables vars; vars.RuleLauncher = property; std::string output; - const std::vector& outputs = cc.GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); if(!outputs.empty()) { RelativeRoot relative_root = - cc.GetWorkingDirectory().empty() ? START_OUTPUT : NONE; + ccg.GetWorkingDirectory().empty() ? START_OUTPUT : NONE; output = this->Convert(outputs[0], relative_root, SHELL); } diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 2d870fb77..9d0b7b5bc 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -16,6 +16,7 @@ # include "cmLocalGenerator.h" # include "cmNinjaTypes.h" +class cmCustomCommandGenerator; class cmGlobalNinjaGenerator; class cmGeneratedFileStream; class cmake; @@ -92,9 +93,9 @@ public: void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs); void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target); - void AppendCustomCommandLines(const cmCustomCommand *cc, + void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg, std::vector &cmdLines); - void AppendCustomCommandDeps(const cmCustomCommand *cc, + void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg, cmNinjaDeps &ninjaDeps); virtual std::string ConvertToLinkReference(std::string const& lib, @@ -124,7 +125,7 @@ private: void WriteCustomCommandBuildStatements(); - std::string MakeCustomLauncher(const cmCustomCommand& cc); + std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg); std::string ConfigName; std::string HomeRelativeOutputPath; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index d3f63f51d..9f12ffef7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -960,7 +960,9 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - this->AppendCustomDepend(depends, *i); + cmCustomCommandGenerator ccg(*i, this->ConfigurationName, + this->Makefile); + this->AppendCustomDepend(depends, ccg); } } @@ -968,10 +970,10 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::AppendCustomDepend(std::vector& depends, - const cmCustomCommand& cc) + cmCustomCommandGenerator const& ccg) { - for(std::vector::const_iterator d = cc.GetDepends().begin(); - d != cc.GetDepends().end(); ++d) + for(std::vector::const_iterator d = ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { // Lookup the real name of the dependency in case it is a CMake target. std::string dep; @@ -994,7 +996,9 @@ cmLocalUnixMakefileGenerator3 for(std::vector::const_iterator i = ccs.begin(); i != ccs.end(); ++i) { - this->AppendCustomCommand(commands, *i, target, true, relative); + cmCustomCommandGenerator ccg(*i, this->ConfigurationName, + this->Makefile); + this->AppendCustomCommand(commands, ccg, target, true, relative); } } @@ -1002,7 +1006,7 @@ cmLocalUnixMakefileGenerator3 void cmLocalUnixMakefileGenerator3 ::AppendCustomCommand(std::vector& commands, - const cmCustomCommand& cc, + cmCustomCommandGenerator const& ccg, cmTarget* target, bool echo_comment, cmLocalGenerator::RelativeRoot relative, @@ -1014,8 +1018,8 @@ cmLocalUnixMakefileGenerator3 // their comments generated elsewhere. if(echo_comment) { - const char* comment = cc.GetComment(); - if(comment && *comment) + const char* comment = ccg.GetComment(); + if(comment && !*comment) { this->AppendEcho(commands, comment, cmLocalUnixMakefileGenerator3::EchoGenerate); @@ -1024,7 +1028,7 @@ cmLocalUnixMakefileGenerator3 // if the command specified a working directory use it. std::string dir = this->Makefile->GetStartOutputDirectory(); - std::string workingDir = cc.GetWorkingDirectory(); + std::string workingDir = ccg.GetWorkingDirectory(); if(!workingDir.empty()) { dir = workingDir; @@ -1033,8 +1037,6 @@ cmLocalUnixMakefileGenerator3 { *content << dir; } - cmCustomCommandGenerator ccg(cc, this->ConfigurationName, - this->Makefile); // Add each command line to the set of commands. std::vector commands1; @@ -1079,7 +1081,7 @@ cmLocalUnixMakefileGenerator3 cmd = "./" + cmd; } std::string launcher = - this->MakeLauncher(cc, target, + this->MakeLauncher(ccg, target, workingDir.empty()? START_OUTPUT : NONE); cmd = launcher + this->ConvertShellCommand(cmd, NONE); @@ -1134,9 +1136,9 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- std::string -cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc, - cmTarget* target, - RelativeRoot relative) +cmLocalUnixMakefileGenerator3::MakeLauncher( + cmCustomCommandGenerator const& ccg, + cmTarget* target, RelativeRoot relative) { // Short-circuit if there is no launcher. const char* prop = "RULE_LAUNCH_CUSTOM"; @@ -1152,7 +1154,7 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc, vars.RuleLauncher = prop; vars.CMTarget = target; std::string output; - const std::vector& outputs = cc.GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); if(!outputs.empty()) { output = this->Convert(outputs[0], relative, SHELL); diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 7987c961f..d5042472d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -18,6 +18,7 @@ #include "cmDepends.h" class cmCustomCommand; +class cmCustomCommandGenerator; class cmDependInformation; class cmDepends; class cmMakefileTargetGenerator; @@ -289,14 +290,14 @@ protected: void AppendCustomDepends(std::vector& depends, const std::vector& ccs); void AppendCustomDepend(std::vector& depends, - const cmCustomCommand& cc); + cmCustomCommandGenerator const& cc); void AppendCustomCommands(std::vector& commands, const std::vector& ccs, cmTarget* target, cmLocalGenerator::RelativeRoot relative = cmLocalGenerator::HOME_OUTPUT); void AppendCustomCommand(std::vector& commands, - const cmCustomCommand& cc, + cmCustomCommandGenerator const& ccg, cmTarget* target, bool echo_comment=false, cmLocalGenerator::RelativeRoot relative = @@ -313,8 +314,8 @@ protected: private: std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root); - std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target, - RelativeRoot relative); + std::string MakeLauncher(cmCustomCommandGenerator const& ccg, + cmTarget* target, RelativeRoot relative); friend class cmMakefileTargetGenerator; friend class cmMakefileExecutableTargetGenerator; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d7130248b..2ab25cc52 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -16,6 +16,7 @@ #include "cmSourceFile.h" #include "cmCacheManager.h" #include "cmGeneratorTarget.h" +#include "cmCustomCommandGenerator.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -59,6 +60,7 @@ public: } void Write(cmCustomCommand const& cc) { + cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile()); if(this->First) { this->Code += this->Event + "_Cmds="; @@ -68,7 +70,7 @@ public: { this->Code += "\\\n\t"; } - this->Code += this->LG->ConstructScript(cc, this->Config, "\\\n\t"); + this->Code += this->LG->ConstructScript(ccg, "\\\n\t"); } private: cmLocalVisualStudio6Generator* LG; @@ -575,14 +577,18 @@ cmLocalVisualStudio6Generator target.GetName().size() + 30)]; sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(), target.GetName().c_str(), count); - std::string comment = this->ConstructComment(origCommand, ""); + const char* comment = origCommand.GetComment(); + if(!comment && origCommand.GetOutputs().empty()) + { + comment = ""; + } // Add the rule with the given dependencies and commands. std::string no_main_dependency = ""; if(cmSourceFile* outsf = this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, - origCommand.GetCommandLines(), comment.c_str(), + origCommand.GetCommandLines(), comment, origCommand.GetWorkingDirectory().c_str())) { target.AddSourceFile(outsf); @@ -604,20 +610,21 @@ cmLocalVisualStudio6Generator const cmCustomCommand& command, const char* flags) { - std::string comment = - this->ConstructComment(command, "Building Custom Rule $(InputPath)"); - if(comment == "") - { - comment = ""; - } - // Write the rule for each configuration. std::vector::iterator i; for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { std::string config = this->GetConfigName(*i); + cmCustomCommandGenerator ccg(command, config, this->Makefile); + std::string comment = + this->ConstructComment(ccg, "Building Custom Rule $(InputPath)"); + if(comment == "") + { + comment = ""; + } + std::string script = - this->ConstructScript(command, config.c_str(), "\\\n\t"); + this->ConstructScript(ccg, "\\\n\t"); if (i == this->Configurations.begin()) { @@ -634,8 +641,8 @@ cmLocalVisualStudio6Generator // Write out the dependencies for the rule. fout << "USERDEP__HACK="; for(std::vector::const_iterator d = - command.GetDepends().begin(); - d != command.GetDepends().end(); + ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { // Lookup the real name of the dependency in case it is a CMake target. @@ -655,7 +662,7 @@ cmLocalVisualStudio6Generator fout << " " << comment.c_str(); } fout << "\n\n"; - if(command.GetOutputs().empty()) + if(ccg.GetOutputs().empty()) { fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; @@ -664,8 +671,8 @@ cmLocalVisualStudio6Generator else { for(std::vector::const_iterator o = - command.GetOutputs().begin(); - o != command.GetOutputs().end(); + ccg.GetOutputs().begin(); + o != ccg.GetOutputs().end(); ++o) { // Write a rule for every output generated by this command. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 449114015..14ad56778 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -18,6 +18,7 @@ #include "cmSourceFile.h" #include "cmCacheManager.h" #include "cmGeneratorTarget.h" +#include "cmCustomCommandGenerator.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -609,9 +610,10 @@ public: } void Write(cmCustomCommand const& cc) { + cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile()); if(this->First) { - const char* comment = cc.GetComment(); + const char* comment = ccg.GetComment(); if(comment && *comment) { this->Stream << "\nDescription=\"" @@ -624,7 +626,7 @@ public: { this->Stream << this->LG->EscapeForXML("\n"); } - std::string script = this->LG->ConstructScript(cc, this->Config); + std::string script = this->LG->ConstructScript(ccg); this->Stream << this->LG->EscapeForXML(script.c_str()); } private: @@ -1791,8 +1793,6 @@ WriteCustomRule(std::ostream& fout, const cmCustomCommand& command, FCInfo& fcinfo) { - std::string comment = this->ConstructComment(command); - // Write the rule for each configuration. std::vector::iterator i; std::vector *configs = @@ -1810,6 +1810,7 @@ WriteCustomRule(std::ostream& fout, } for(i = configs->begin(); i != configs->end(); ++i) { + cmCustomCommandGenerator ccg(command, *i, this->Makefile); cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\tPlatformName << "\">\n"; @@ -1821,7 +1822,8 @@ WriteCustomRule(std::ostream& fout, << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; } - std::string script = this->ConstructScript(command, i->c_str()); + std::string comment = this->ConstructComment(ccg); + std::string script = this->ConstructScript(ccg); if(this->FortranProject) { cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str()); @@ -1833,7 +1835,7 @@ WriteCustomRule(std::ostream& fout, << "\t\t\t\t\tCommandLine=\"" << this->EscapeForXML(script.c_str()) << "\"\n" << "\t\t\t\t\tAdditionalDependencies=\""; - if(command.GetDepends().empty()) + if(ccg.GetDepends().empty()) { // There are no real dependencies. Produce an artificial one to // make sure the rule runs reliably. @@ -1848,8 +1850,8 @@ WriteCustomRule(std::ostream& fout, { // Write out the dependencies for the rule. for(std::vector::const_iterator d = - command.GetDepends().begin(); - d != command.GetDepends().end(); + ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { // Get the real name of the dependency in case it is a CMake target. @@ -1863,7 +1865,7 @@ WriteCustomRule(std::ostream& fout, } fout << "\"\n"; fout << "\t\t\t\t\tOutputs=\""; - if(command.GetOutputs().empty()) + if(ccg.GetOutputs().empty()) { fout << source << "_force"; } @@ -1872,8 +1874,8 @@ WriteCustomRule(std::ostream& fout, // Write a rule for the output generated by this command. const char* sep = ""; for(std::vector::const_iterator o = - command.GetOutputs().begin(); - o != command.GetOutputs().end(); + ccg.GetOutputs().begin(); + o != ccg.GetOutputs().end(); ++o) { fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str()); diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 3075c1567..613ee975c 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -79,13 +79,11 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const //---------------------------------------------------------------------------- std::string cmLocalVisualStudioGenerator -::ConstructScript(cmCustomCommand const& cc, - const std::string& configName, +::ConstructScript(cmCustomCommandGenerator const& ccg, const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); - std::string workingDirectory = cc.GetWorkingDirectory(); - cmCustomCommandGenerator ccg(cc, configName, this->Makefile); + std::string workingDirectory = ccg.GetWorkingDirectory(); RelativeRoot relativeRoot = workingDirectory.empty()? START_OUTPUT : NONE; // Avoid leading or trailing newlines. diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 94a6293b6..a89e21930 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -19,6 +19,7 @@ class cmSourceFile; class cmSourceGroup; class cmCustomCommand; +class cmCustomCommandGenerator; /** \class cmLocalVisualStudioGenerator * \brief Base class for Visual Studio generators. @@ -46,8 +47,7 @@ public: virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ - std::string ConstructScript(cmCustomCommand const& cc, - const std::string& configName, + std::string ConstructScript(cmCustomCommandGenerator const& ccg, const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 983fd997f..3161abaf5 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -21,6 +21,7 @@ #include "cmTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" +#include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" #include "cmMakefileExecutableTargetGenerator.h" @@ -158,11 +159,13 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() si = customCommands.begin(); si != customCommands.end(); ++si) { - cmCustomCommand const* cc = (*si)->GetCustomCommand(); - this->GenerateCustomRuleFile(*cc); + cmCustomCommandGenerator ccg(*(*si)->GetCustomCommand(), + this->ConfigName, + this->Makefile); + this->GenerateCustomRuleFile(ccg); if (clean) { - const std::vector& outputs = cc->GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); for(std::vector::const_iterator o = outputs.begin(); o != outputs.end(); ++o) { @@ -1178,7 +1181,8 @@ cmMakefileTargetGenerator { if(cmCustomCommand* cc = (*source)->GetCustomCommand()) { - const std::vector& outputs = cc->GetOutputs(); + cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile); + const std::vector& outputs = ccg.GetOutputs(); for(std::vector::const_iterator o = outputs.begin(); o != outputs.end(); ++o) { @@ -1210,11 +1214,11 @@ void cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator -::GenerateCustomRuleFile(const cmCustomCommand& cc) +::GenerateCustomRuleFile(cmCustomCommandGenerator const& ccg) { // Collect the commands. std::vector commands; - std::string comment = this->LocalGenerator->ConstructComment(cc); + std::string comment = this->LocalGenerator->ConstructComment(ccg); if(!comment.empty()) { // add in a progress call if needed @@ -1229,19 +1233,19 @@ void cmMakefileTargetGenerator // Now append the actual user-specified commands. cmOStringStream content; - this->LocalGenerator->AppendCustomCommand(commands, cc, this->Target, false, + this->LocalGenerator->AppendCustomCommand(commands, ccg, this->Target, false, cmLocalGenerator::HOME_OUTPUT, &content); // Collect the dependencies. std::vector depends; - this->LocalGenerator->AppendCustomDepend(depends, cc); + this->LocalGenerator->AppendCustomDepend(depends, ccg); // Check whether we need to bother checking for a symbolic output. bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); // Write the rule. - const std::vector& outputs = cc.GetOutputs(); + const std::vector& outputs = ccg.GetOutputs(); std::vector::const_iterator o = outputs.begin(); { bool symbolic = false; @@ -1259,7 +1263,7 @@ void cmMakefileTargetGenerator // If the rule has changed make sure the output is rebuilt. if(!symbolic) { - this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), content.str()); + this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str()); } } @@ -1280,8 +1284,8 @@ void cmMakefileTargetGenerator // Setup implicit dependency scanning. for(cmCustomCommand::ImplicitDependsList::const_iterator - idi = cc.GetImplicitDepends().begin(); - idi != cc.GetImplicitDepends().end(); ++idi) + idi = ccg.GetCC().GetImplicitDepends().begin(); + idi != ccg.GetCC().GetImplicitDepends().end(); ++idi) { std::string objFullPath = this->Convert(outputs[0], cmLocalGenerator::FULL); diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index bed945bb5..97c58b982 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -15,7 +15,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmOSXBundleGenerator.h" -class cmCustomCommand; +class cmCustomCommandGenerator; class cmDependInformation; class cmDepends; class cmGeneratorTarget; @@ -102,7 +102,7 @@ protected: std::vector& depends); // write the build rule for a custom command - void GenerateCustomRuleFile(const cmCustomCommand& cc); + void GenerateCustomRuleFile(cmCustomCommandGenerator const& ccg); // write a rule to drive building of more than one output from // another rule diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 34b2e6319..2d1bc76df 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -18,6 +18,7 @@ #include "cmMakefile.h" #include "cmOSXBundleGenerator.h" #include "cmGeneratorTarget.h" +#include "cmCustomCommandGenerator.h" #include #include @@ -555,7 +556,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() for (std::vector::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { - this->GetLocalGenerator()->AppendCustomCommandLines(&*ci, + cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), + this->GetMakefile()); + this->GetLocalGenerator()->AppendCustomCommandLines(ccg, *cmdLineLists[i]); } } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d6520184a..ed3782c2a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -577,7 +577,9 @@ cmNinjaTargetGenerator si != customCommands.end(); ++si) { cmCustomCommand const* cc = (*si)->GetCustomCommand(); - const std::vector& ccoutputs = cc->GetOutputs(); + cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), + this->GetMakefile()); + const std::vector& ccoutputs = ccg.GetOutputs(); std::transform(ccoutputs.begin(), ccoutputs.end(), std::back_inserter(orderOnlyDeps), MapToNinjaPath()); } diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 1a7b445bb..0fb40c043 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -17,6 +17,7 @@ #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmTarget.h" +#include "cmCustomCommandGenerator.h" cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( cmGeneratorTarget *target) @@ -37,8 +38,10 @@ void cmNinjaUtilityTargetGenerator::Generate() for (unsigned i = 0; i != 2; ++i) { for (std::vector::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { - this->GetLocalGenerator()->AppendCustomCommandDeps(&*ci, deps); - this->GetLocalGenerator()->AppendCustomCommandLines(&*ci, commands); + cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), + this->GetMakefile()); + this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); + this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands); } } @@ -49,10 +52,12 @@ void cmNinjaUtilityTargetGenerator::Generate() { if(cmCustomCommand* cc = (*source)->GetCustomCommand()) { + cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), + this->GetMakefile()); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); // Depend on all custom command outputs. - const std::vector& ccOutputs = cc->GetOutputs(); + const std::vector& ccOutputs = ccg.GetOutputs(); std::transform(ccOutputs.begin(), ccOutputs.end(), std::back_inserter(deps), MapToNinjaPath()); } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 90155b413..7c55f645e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -19,6 +19,7 @@ #include "cmSourceFile.h" #include "cmVisualStudioGeneratorOptions.h" #include "cmLocalVisualStudio7Generator.h" +#include "cmCustomCommandGenerator.h" #include "cmVS10CLFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" @@ -616,8 +617,6 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, } } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; - std::string comment = lg->ConstructComment(command); - comment = cmVS10EscapeComment(comment); std::vector *configs = static_cast (this->GlobalGenerator)->GetConfigurations(); @@ -627,8 +626,11 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, for(std::vector::iterator i = configs->begin(); i != configs->end(); ++i) { + cmCustomCommandGenerator ccg(command, *i, this->Makefile); + std::string comment = lg->ConstructComment(ccg); + comment = cmVS10EscapeComment(comment); std::string script = - cmVS10EscapeXML(lg->ConstructScript(command, i->c_str())); + cmVS10EscapeXML(lg->ConstructScript(ccg)); this->WritePlatformConfigTag("Message",i->c_str(), 3); (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "\n"; this->WritePlatformConfigTag("Command", i->c_str(), 3); @@ -637,8 +639,8 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, (*this->BuildFileStream ) << source->GetFullPath(); for(std::vector::const_iterator d = - command.GetDepends().begin(); - d != command.GetDepends().end(); + ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { std::string dep; @@ -652,8 +654,8 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, this->WritePlatformConfigTag("Outputs", i->c_str(), 3); const char* sep = ""; for(std::vector::const_iterator o = - command.GetOutputs().begin(); - o != command.GetOutputs().end(); + ccg.GetOutputs().begin(); + o != ccg.GetOutputs().end(); ++o) { std::string out = *o; @@ -1835,13 +1837,12 @@ void cmVisualStudio10TargetGenerator::WriteEvent( for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - const cmCustomCommand& command = *i; + cmCustomCommandGenerator ccg(*i, configName, this->Makefile); comment += pre; - comment += lg->ConstructComment(command); + comment += lg->ConstructComment(ccg); script += pre; pre = "\n"; - script += - cmVS10EscapeXML(lg->ConstructScript(command, configName.c_str())); + script += cmVS10EscapeXML(lg->ConstructScript(ccg)); } comment = cmVS10EscapeComment(comment); this->WriteString("",3); From c1dde67e62868529aaea807a3664b2eef9389a5b Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 12 Mar 2014 10:58:16 -0400 Subject: [PATCH 174/278] KWSys 2014-03-12 (dd873734) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ dd873734 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' 9c653603..dd873734 Brad King (1): 88c5a768 Set policy CMP0025 to NEW within KWSys Stephen Kelly (1): dd873734 SystemTools: Remove some unnecessary c_str() calls Change-Id: I5487fefcb3e44875ed5748fb2c4ab8302fcef984 --- CMakeLists.txt | 3 +++ SystemTools.cxx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 52bcfe147..977d57bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,9 @@ # written. CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) +IF(POLICY CMP0025) + CMAKE_POLICY(SET CMP0025 NEW) +ENDIF() #----------------------------------------------------------------------------- # If a namespace is not specified, use "kwsys" and enable testing. diff --git a/SystemTools.cxx b/SystemTools.cxx index b6a243706..32e79e62f 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -4918,8 +4918,8 @@ void SystemTools::ClassInitialize() // Strip off one directory level and see if the logical // mapping still works. - pwd_str = SystemTools::GetFilenamePath(pwd_str.c_str()); - cwd_str = SystemTools::GetFilenamePath(cwd_str.c_str()); + pwd_str = SystemTools::GetFilenamePath(pwd_str); + cwd_str = SystemTools::GetFilenamePath(cwd_str); Realpath(pwd_str.c_str(), pwd_path); } From c34216cf8a265b617d4422d772187e38e57647ba Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Wed, 12 Mar 2014 20:48:46 -0600 Subject: [PATCH 175/278] cmake-gui: Fix compile with Qt5 using UTF-8 internal encoding. Because we already call [to|from]Local8Bit() with C strings where we are supposed to, we do not need to specify UTF-8 encoding when converting C strings to QString. --- Source/QtDialog/CMakeSetup.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 995929e3b..1b04a0052 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -81,9 +81,7 @@ int main(int argc, char** argv) #if defined(KWSYS_CP_UTF8) QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); - QTextCodec::setCodecForCStrings(utf8_codec); QTextCodec::setCodecForLocale(utf8_codec); - QTextCodec::setCodecForTr(utf8_codec); #endif // clean out standard Qt paths for plugins, which we don't use anyway From 4a6a59a120eeb9a60e0da77eb701af80439a34db Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 13 Mar 2014 00:01:10 -0400 Subject: [PATCH 176/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index aaddd9232..be11dce70 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140312) +set(CMake_VERSION_PATCH 20140313) #set(CMake_VERSION_RC 1) From d5b2e33be2119ad12744ed62920a8f8d9b6d705d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 16:35:58 +0100 Subject: [PATCH 177/278] Makefiles: Compute local object files on demand. Don't compute them up front. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 8 +--- Source/cmLocalUnixMakefileGenerator3.cxx | 58 ++++++++++++++++++----- Source/cmLocalUnixMakefileGenerator3.h | 8 ++-- 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index f5c56a987..0e03e8932 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -109,9 +109,6 @@ cmGlobalUnixMakefileGenerator3 ::ComputeTargetObjects(cmGeneratorTarget* gt) const { cmTarget* target = gt->Target; - cmLocalUnixMakefileGenerator3* lg = - static_cast(gt->LocalGenerator); - // Compute full path to object file directory for this target. std::string dir_max; dir_max += gt->Makefile->GetCurrentOutputDirectory(); @@ -128,12 +125,9 @@ cmGlobalUnixMakefileGenerator3 si != objectSources.end(); ++si) { cmSourceFile* sf = *si; - bool hasSourceExtension = true; std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, dir_max, - &hasSourceExtension); + ->GetObjectFileNameWithoutTarget(*sf, dir_max); gt->AddObject(sf, objectName); - lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); } } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9f12ffef7..a838ce3b5 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -172,26 +172,57 @@ void cmLocalUnixMakefileGenerator3::Generate() } //---------------------------------------------------------------------------- -void cmLocalUnixMakefileGenerator3::AddLocalObjectFile( - cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir, - bool hasSourceExtension) +void cmLocalUnixMakefileGenerator3:: +GetLocalObjectFiles(std::map &localObjectFiles) { - if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) + std::set emitted; + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator ti = targets.begin(); + ti != targets.end(); ++ti) { - objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir); + cmGeneratorTarget* gt = ti->second; + if (gt->GetType() == cmTarget::INTERFACE_LIBRARY) + { + continue; + } + std::vector objectSources; + gt->GetObjectSources(objectSources); + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += this->GetTargetDirectory(*gt->Target); + dir_max += "/"; + // Compute the name of each object file. + for(std::vector::iterator + si = objectSources.begin(); + si != objectSources.end(); ++si) + { + cmSourceFile* sf = *si; + bool hasSourceExtension = true; + std::string objectName = this->GetObjectFileNameWithoutTarget(*sf, + dir_max, + &hasSourceExtension); + if(cmSystemTools::FileIsFullPath(objectName.c_str())) + { + objectName = cmSystemTools::GetFilenameName(objectName); + } + LocalObjectInfo& info = localObjectFiles[objectName]; + info.HasSourceExtension = hasSourceExtension; + info.push_back(LocalObjectEntry(gt->Target, sf->GetLanguage())); + } } - LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir]; - info.HasSourceExtension = hasSourceExtension; - info.push_back(LocalObjectEntry(target, sf->GetLanguage())); } //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets (std::vector& targets) { + std::map localObjectFiles; + this->GetLocalObjectFiles(localObjectFiles); for (std::map::iterator lo = - this->LocalObjectFiles.begin(); - lo != this->LocalObjectFiles.end(); ++lo) + localObjectFiles.begin(); + lo != localObjectFiles.end(); ++lo) { targets.push_back(lo->first); @@ -253,11 +284,14 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() bool do_assembly_rules = this->GetCreateAssemblySourceRules(); + std::map localObjectFiles; + this->GetLocalObjectFiles(localObjectFiles); + // now write out the object rules // for each object file name for (std::map::iterator lo = - this->LocalObjectFiles.begin(); - lo != this->LocalObjectFiles.end(); ++lo) + localObjectFiles.begin(); + lo != localObjectFiles.end(); ++lo) { // Add a convenience rule for building the object file. this->WriteObjectConvenienceRule(ruleFileStream, diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index d5042472d..27070e2dc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -224,10 +224,6 @@ public: // write the target rules for the local Makefile into the stream void WriteLocalAllRules(std::ostream& ruleFileStream); - void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf, - std::string objNoTargetDir, - bool hasSourceExtension); - std::vector const& GetLocalHelp() { return this->LocalHelp; } /** Get whether to create rules to generate preprocessed and @@ -366,7 +362,9 @@ private: LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false), HasAssembleRule(false) {} }; - std::map LocalObjectFiles; + void GetLocalObjectFiles( + std::map &localObjectFiles); + void WriteObjectConvenienceRule(std::ostream& ruleFileStream, const char* comment, const char* output, LocalObjectInfo const& info); From cd43433de56ab31269a076fb2b2ace8babaa107d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Mar 2014 21:09:20 +0100 Subject: [PATCH 178/278] cmGlobalGenerator: Extract a ComputeTargetObjectDirectory interface. Make it public for future external calls. --- Source/cmGlobalGenerator.cxx | 6 +++++ Source/cmGlobalGenerator.h | 2 ++ Source/cmGlobalNinjaGenerator.cxx | 27 ++++++++++++++--------- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 27 ++++++++++++++--------- Source/cmGlobalUnixMakefileGenerator3.h | 1 + Source/cmGlobalVisualStudioGenerator.cxx | 7 +++++- Source/cmGlobalVisualStudioGenerator.h | 1 + Source/cmGlobalXCodeGenerator.cxx | 5 +++++ Source/cmGlobalXCodeGenerator.h | 1 + 10 files changed, 56 insertions(+), 23 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b95ff81ae..c9ae79937 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1449,6 +1449,7 @@ void cmGlobalGenerator::ComputeGeneratorTargetObjects() continue; } cmGeneratorTarget* gt = ti->second; + this->ComputeTargetObjectDirectory(gt); gt->LookupObjectLibraries(); this->ComputeTargetObjects(gt); } @@ -1520,6 +1521,11 @@ void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const // Implemented in generator subclasses that need this. } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const +{ +} + void cmGlobalGenerator::CheckLocalGenerators() { std::map notFoundMap; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 91e71a82d..ed07b10cc 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -323,6 +323,8 @@ public: GetExportedTargetsFile(const std::string &filename) const; void AddCMP0042WarnTarget(const std::string& target); + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + protected: typedef std::vector GeneratorVector; // for a project collect all its targets by following depend diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 0a05f5a3e..686414d3f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -634,16 +634,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const // TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl. void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const { - cmTarget* target = gt->Target; - - // Compute full path to object file directory for this target. - std::string dir_max; - dir_max += gt->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += gt->LocalGenerator->GetTargetDirectory(*target); - dir_max += "/"; - gt->ObjectDirectory = dir_max; - std::vector objectSources; gt->GetObjectSources(objectSources); // Compute the name of each object file. @@ -653,11 +643,26 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const { cmSourceFile* sf = *si; std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, dir_max); + ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); gt->AddObject(sf, objectName); } } +//---------------------------------------------------------------------------- +void cmGlobalNinjaGenerator +::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const +{ + cmTarget* target = gt->Target; + + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += gt->LocalGenerator->GetTargetDirectory(*target); + dir_max += "/"; + gt->ObjectDirectory = dir_max; +} + //---------------------------------------------------------------------------- // Private methods diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 7725cf352..e3a22e57c 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -299,7 +299,7 @@ public: void AddTargetAlias(const std::string& alias, cmTarget* target); - + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: /// Overloaded methods. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0e03e8932..f9ec0a9a6 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -108,15 +108,6 @@ void cmGlobalUnixMakefileGenerator3 ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - cmTarget* target = gt->Target; - // Compute full path to object file directory for this target. - std::string dir_max; - dir_max += gt->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += gt->LocalGenerator->GetTargetDirectory(*target); - dir_max += "/"; - gt->ObjectDirectory = dir_max; - std::vector objectSources; gt->GetObjectSources(objectSources); // Compute the name of each object file. @@ -126,11 +117,27 @@ cmGlobalUnixMakefileGenerator3 { cmSourceFile* sf = *si; std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, dir_max); + ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); gt->AddObject(sf, objectName); } } +//---------------------------------------------------------------------------- +void +cmGlobalUnixMakefileGenerator3 +::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const +{ + cmTarget* target = gt->Target; + + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += gt->LocalGenerator->GetTargetDirectory(*target); + dir_max += "/"; + gt->ObjectDirectory = dir_max; +} + void cmGlobalUnixMakefileGenerator3::Configure() { // Initialize CMAKE_EDIT_COMMAND cache entry. diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 811517627..42453f281 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -128,6 +128,7 @@ public: /** Does the make tool tolerate .NOTPARALLEL? */ virtual bool AllowNotParallel() const { return true; } + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: void WriteMainMakefile2(); void WriteMainCMakefile(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 69c893cc8..f3cba5a68 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -159,10 +159,15 @@ cmGlobalVisualStudioGenerator } gt->AddObject(sf, objectName); } +} +//---------------------------------------------------------------------------- +void cmGlobalVisualStudioGenerator +::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const +{ std::string dir = gt->Makefile->GetCurrentOutputDirectory(); dir += "/"; - std::string tgtDir = lg->GetTargetDirectory(*gt->Target); + std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target); if(!tgtDir.empty()) { dir += tgtDir; diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 7e8dcf8b7..f957056b2 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -88,6 +88,7 @@ public: virtual std::string ExpandCFGIntDir(const std::string& str, const std::string& config) const; + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: // Does this VS version link targets to each other if there are // dependencies in the SLN file? This was done for VS versions diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 36196a23a..6c12040c9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3964,7 +3964,12 @@ cmGlobalXCodeGenerator gt->AddObject(sf, objectName); } +} +//---------------------------------------------------------------------------- +void cmGlobalXCodeGenerator +::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const +{ const char* configName = this->GetCMakeCFGIntDir(); std::string dir = this->GetObjectsNormalDirectory( "$(PROJECT_NAME)", configName, gt->Target); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index be81cdc4c..f9dd58f97 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -204,6 +204,7 @@ private: std::vector const& defines, bool dflag = false); + void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; protected: virtual const char* GetInstallTargetName() const { return "install"; } virtual const char* GetPackageTargetName() const { return "package"; } From bc51221164330a24e90cf896300ded637b86d740 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Mar 2014 23:43:43 +0100 Subject: [PATCH 179/278] cmGeneratorTarget: Constify the AddObject API. The storage is already const. --- Source/cmGeneratorTarget.cxx | 3 ++- Source/cmGeneratorTarget.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index db8874981..1d8d2ddf4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -321,7 +321,8 @@ const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file) return this->Objects[file]; } -void cmGeneratorTarget::AddObject(cmSourceFile *sf, std::string const&name) +void cmGeneratorTarget::AddObject(cmSourceFile const* sf, + std::string const&name) { this->Objects[sf] = name; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 81a447f46..e5ed27167 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -35,7 +35,7 @@ public: void GetObjectSources(std::vector &) const; const std::string& GetObjectName(cmSourceFile const* file); - void AddObject(cmSourceFile *sf, std::string const&name); + void AddObject(cmSourceFile const* sf, std::string const&name); bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile* sf); From 6132d979d9d7877f5b116a2a110245adbb89e1b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Mar 2014 12:28:32 +0100 Subject: [PATCH 180/278] cmGeneratorTarget: Constify the AddExplicitObjectName API. The storage is already const. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGeneratorTarget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1d8d2ddf4..4d335cdbb 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -328,7 +328,7 @@ void cmGeneratorTarget::AddObject(cmSourceFile const* sf, } //---------------------------------------------------------------------------- -void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile* sf) +void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf) { this->ExplicitObjectName.insert(sf); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e5ed27167..d1a0e0610 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -37,7 +37,7 @@ public: void AddObject(cmSourceFile const* sf, std::string const&name); bool HasExplicitObjectName(cmSourceFile const* file) const; - void AddExplicitObjectName(cmSourceFile* sf); + void AddExplicitObjectName(cmSourceFile const* sf); void GetResxSources(std::vector&) const; void GetIDLSources(std::vector&) const; From 04cf50ff62a022296832cef6b48fb532508eb853 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Mar 2014 23:45:43 +0100 Subject: [PATCH 181/278] cmOSXBundleGenerator: Make MacOSXContentGeneratorType arg const. --- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 2 +- Source/cmOSXBundleGenerator.h | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3161abaf5..fdca7f72b 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -373,7 +373,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() //---------------------------------------------------------------------------- void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() - (cmSourceFile& source, const char* pkgloc) + (cmSourceFile const& source, const char* pkgloc) { // Skip OS X content when not building a Framework or Bundle. if(!this->Generator->GetTarget()->IsBundleOnApple()) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 97c58b982..f59bd9ba4 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -81,7 +81,7 @@ protected: MacOSXContentGeneratorType(cmMakefileTargetGenerator* gen) : Generator(gen) {} - void operator()(cmSourceFile& source, const char* pkgloc); + void operator()(cmSourceFile const& source, const char* pkgloc); private: cmMakefileTargetGenerator* Generator; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index ed3782c2a..149b12915 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -733,7 +733,7 @@ cmNinjaTargetGenerator //---------------------------------------------------------------------------- void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()( - cmSourceFile& source, const char* pkgloc) + cmSourceFile const& source, const char* pkgloc) { // Skip OS X content when not building a Framework or Bundle. if(!this->Generator->GetTarget()->IsBundleOnApple()) diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e66e55fef..900e2bd1d 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -129,7 +129,7 @@ protected: MacOSXContentGeneratorType(cmNinjaTargetGenerator* g) : Generator(g) {} - void operator()(cmSourceFile& source, const char* pkgloc); + void operator()(cmSourceFile const& source, const char* pkgloc); private: cmNinjaTargetGenerator* Generator; diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 95b4aef6c..5acdd9f27 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -44,7 +44,8 @@ public: struct MacOSXContentGeneratorType { virtual ~MacOSXContentGeneratorType() {} - virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0; + virtual void operator()(cmSourceFile const& source, + const char* pkgloc) = 0; }; void GenerateMacOSXContentStatements( From dcfcd23ed53d3bfe8ef299b8a3a38c47c27fa6b6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 13 Mar 2014 00:19:50 +0100 Subject: [PATCH 182/278] cmGeneratorTarget: Make GetSourceDepends const. --- Source/cmGeneratorTarget.cxx | 2 +- Source/cmGeneratorTarget.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4d335cdbb..bde60b834 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -241,7 +241,7 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const //---------------------------------------------------------------------------- std::vector const* -cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const +cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const { SourceEntriesType::const_iterator i = this->SourceEntries.find(sf); if(i != this->SourceEntries.end()) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d1a0e0610..1c4276cb1 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -87,7 +87,8 @@ public: void LookupObjectLibraries(); /** Get sources that must be built before the given source. */ - std::vector const* GetSourceDepends(cmSourceFile* sf) const; + std::vector const* + GetSourceDepends(cmSourceFile const* sf) const; /** * Flags for a given source file as used in this target. Typically assigned @@ -121,7 +122,7 @@ public: private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector Depends; }; - typedef std::map SourceEntriesType; + typedef std::map SourceEntriesType; SourceEntriesType SourceEntries; std::map Objects; From c725bb3cbd51edd4043f81d01b7a01bbd42adb2f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Mar 2014 23:50:42 +0100 Subject: [PATCH 183/278] Constify some APIs in generators. --- Source/cmGlobalVisualStudio10Generator.cxx | 2 +- Source/cmGlobalVisualStudio10Generator.h | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 9 +++++---- Source/cmMakefileTargetGenerator.h | 9 +++++---- Source/cmNinjaTargetGenerator.cxx | 10 +++++----- Source/cmNinjaTargetGenerator.h | 10 +++++----- Source/cmVisualStudio10TargetGenerator.cxx | 11 ++++++----- Source/cmVisualStudio10TargetGenerator.h | 13 +++++++------ 8 files changed, 36 insertions(+), 32 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 840e8888e..37a416b3b 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -470,7 +470,7 @@ cmGlobalVisualStudio10Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::PathTooLong( - cmTarget* target, cmSourceFile* sf, std::string const& sfRel) + cmTarget* target, cmSourceFile const* sf, std::string const& sfRel) { size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) + 1 + sfRel.length()); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 999a9d54c..ede6b1b98 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -87,7 +87,7 @@ public: /** Generate an .rule file path for a given command output. */ virtual std::string GenerateRuleFile(std::string const& output) const; - void PathTooLong(cmTarget* target, cmSourceFile* sf, + void PathTooLong(cmTarget* target, cmSourceFile const* sf, std::string const& sfRel); virtual const char* GetToolsVersion() { return "4.0"; } @@ -112,7 +112,7 @@ private: LongestSourcePath(): Length(0), Target(0), SourceFile(0) {} size_t Length; cmTarget* Target; - cmSourceFile* SourceFile; + cmSourceFile const* SourceFile; std::string SourceRel; }; LongestSourcePath LongestSource; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index fdca7f72b..32e1c1ae1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -423,7 +423,8 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) +void cmMakefileTargetGenerator +::WriteObjectRuleFiles(cmSourceFile const& source) { // Identify the language of the source file. const std::string& lang = @@ -498,7 +499,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) //---------------------------------------------------------------------------- void cmMakefileTargetGenerator -::AppendFortranFormatFlags(std::string& flags, cmSourceFile& source) +::AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source) { const char* srcfmt = source.GetProperty("Fortran_FORMAT"); cmLocalGenerator::FortranFormat format = @@ -529,7 +530,7 @@ void cmMakefileTargetGenerator ::WriteObjectBuildFile(std::string &obj, const std::string& lang, - cmSourceFile& source, + cmSourceFile const& source, std::vector& depends) { this->LocalGenerator->AppendRuleDepend(depends, @@ -1194,7 +1195,7 @@ cmMakefileTargetGenerator //---------------------------------------------------------------------------- void cmMakefileTargetGenerator -::WriteObjectDependRules(cmSourceFile& source, +::WriteObjectDependRules(cmSourceFile const& source, std::vector& depends) { // Create the list of dependencies known at cmake time. These are diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f59bd9ba4..7ff6da9c1 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -89,16 +89,16 @@ protected: friend struct MacOSXContentGeneratorType; // write the rules for an object - void WriteObjectRuleFiles(cmSourceFile& source); + void WriteObjectRuleFiles(cmSourceFile const& source); // write the build rule for an object void WriteObjectBuildFile(std::string &obj, const std::string& lang, - cmSourceFile& source, + cmSourceFile const& source, std::vector& depends); // write the depend.make file for an object - void WriteObjectDependRules(cmSourceFile& source, + void WriteObjectDependRules(cmSourceFile const& source, std::vector& depends); // write the build rule for a custom command @@ -126,7 +126,8 @@ protected: // Return the a string with -F flags on apple std::string GetFrameworkFlags(std::string const& l); - void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source); + void AppendFortranFormatFlags(std::string& flags, + cmSourceFile const& source); // append intertarget dependencies void AppendTargetDepends(std::vector& depends); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 149b12915..3738ca75c 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -126,7 +126,7 @@ void cmNinjaTargetGenerator::AddFeatureFlags(std::string& flags, // void cmMakefileTargetGenerator::WriteTargetLanguageFlags() // Refactor it. std::string -cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, +cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile const* source, const std::string& language) { // TODO: Fortran support. @@ -211,7 +211,7 @@ bool cmNinjaTargetGenerator::needsDepFile(const std::string& lang) // void cmMakefileTargetGenerator::WriteTargetLanguageFlags(). std::string cmNinjaTargetGenerator:: -ComputeDefines(cmSourceFile *source, const std::string& language) +ComputeDefines(cmSourceFile const* source, const std::string& language) { std::set defines; @@ -269,14 +269,14 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const std::string cmNinjaTargetGenerator -::GetSourceFilePath(cmSourceFile* source) const +::GetSourceFilePath(cmSourceFile const* source) const { return ConvertToNinjaPath(source->GetFullPath().c_str()); } std::string cmNinjaTargetGenerator -::GetObjectFilePath(cmSourceFile* source) const +::GetObjectFilePath(cmSourceFile const* source) const { std::string path = this->LocalGenerator->GetHomeRelativeOutputPath(); if(!path.empty()) @@ -536,7 +536,7 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator -::WriteObjectBuildStatement(cmSourceFile* source) +::WriteObjectBuildStatement(cmSourceFile const* source) { std::string comment; const std::string language = source->GetLanguage(); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 900e2bd1d..8669e6e34 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -79,10 +79,10 @@ protected: * @note Generally it is the value of the variable whose name is computed * by LanguageFlagsVarName(). */ - std::string ComputeFlagsForObject(cmSourceFile *source, + std::string ComputeFlagsForObject(cmSourceFile const* source, const std::string& language); - std::string ComputeDefines(cmSourceFile *source, + std::string ComputeDefines(cmSourceFile const* source, const std::string& language); std::string ConvertToNinjaPath(const char *path) const { @@ -96,10 +96,10 @@ protected: cmNinjaDeps ComputeLinkDeps() const; /// @return the source file path for the given @a source. - std::string GetSourceFilePath(cmSourceFile* source) const; + std::string GetSourceFilePath(cmSourceFile const* source) const; /// @return the object file path for the given @a source. - std::string GetObjectFilePath(cmSourceFile* source) const; + std::string GetObjectFilePath(cmSourceFile const* source) const; /// @return the file path where the target named @a name is generated. std::string GetTargetFilePath(const std::string& name) const; @@ -110,7 +110,7 @@ protected: void WriteLanguageRules(const std::string& language); void WriteCompileRule(const std::string& language); void WriteObjectBuildStatements(); - void WriteObjectBuildStatement(cmSourceFile* source); + void WriteObjectBuildStatement(cmSourceFile const* source); void WriteCustomCommandBuildStatement(cmCustomCommand *cc); cmNinjaDeps GetObjects() const diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7c55f645e..cc1fdbce6 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -562,7 +562,8 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands() } //---------------------------------------------------------------------------- -void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf) +void cmVisualStudio10TargetGenerator +::WriteCustomCommand(cmSourceFile const* sf) { if(this->SourcesVisited.insert(sf).second) { @@ -585,7 +586,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommand(cmSourceFile* sf) } void -cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, +cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source, cmCustomCommand const & command) { @@ -928,7 +929,7 @@ WriteGroupSources(const char* name, } void cmVisualStudio10TargetGenerator::WriteSource( - const char* tool, cmSourceFile* sf, const char* end) + const char* tool, cmSourceFile const* sf, const char* end) { // Visual Studio tools append relative paths to the current dir, as in: // @@ -1091,9 +1092,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( - cmSourceFile* source) + cmSourceFile const* source) { - cmSourceFile& sf = *source; + cmSourceFile const& sf = *source; std::string objectName; if(this->GeneratorTarget->HasExplicitObjectName(&sf)) diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 02b951cc8..8faeb8ecb 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -45,7 +45,7 @@ public: private: struct ToolSource { - cmSourceFile* SourceFile; + cmSourceFile const* SourceFile; bool RelativePath; }; struct ToolSources: public std::vector {}; @@ -55,7 +55,8 @@ private: void WriteString(const char* line, int indentLevel); void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); - void WriteSource(const char* tool, cmSourceFile* sf, const char* end = 0); + void WriteSource(const char* tool, cmSourceFile const* sf, + const char* end = 0); void WriteSources(const char* tool, std::vector const&); void WriteAllSources(); void WriteDotNetReferences(); @@ -77,13 +78,13 @@ private: std::vector const & includes); void OutputIncludes(std::vector const & includes); void OutputLinkIncremental(std::string const& configName); - void WriteCustomRule(cmSourceFile* source, + void WriteCustomRule(cmSourceFile const* source, cmCustomCommand const & command); void WriteCustomCommands(); - void WriteCustomCommand(cmSourceFile* sf); + void WriteCustomCommand(cmSourceFile const* sf); void WriteGroups(); void WriteProjectReferences(); - bool OutputSourceSpecificFlags(cmSourceFile* source); + bool OutputSourceSpecificFlags(cmSourceFile const* source); void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring); void WriteLibOptions(std::string const& config); void WriteEvents(std::string const& configName); @@ -111,7 +112,7 @@ private: cmGlobalVisualStudio10Generator* GlobalGenerator; cmGeneratedFileStream* BuildFileStream; cmLocalVisualStudio7Generator* LocalGenerator; - std::set SourcesVisited; + std::set SourcesVisited; typedef std::map ToolSourceMap; ToolSourceMap Tools; From 9ad804ac7be18efb92040434808f89174586b13d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 12 Mar 2014 23:06:05 +0100 Subject: [PATCH 184/278] cmGeneratorTarget: Constify cmSourceFile* in containers. Some of them will be used with other APIs which require value_type to be cmSourceFile const*. --- Source/cmGeneratorTarget.cxx | 27 +++++++++++------- Source/cmGeneratorTarget.h | 18 ++++++------ Source/cmGlobalNinjaGenerator.cxx | 6 ++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 6 ++-- Source/cmGlobalVisualStudioGenerator.cxx | 10 +++---- Source/cmGlobalXCodeGenerator.cxx | 6 ++-- Source/cmLocalUnixMakefileGenerator3.cxx | 6 ++-- Source/cmMakefileTargetGenerator.cxx | 16 +++++------ Source/cmNinjaTargetGenerator.cxx | 20 +++++++------- Source/cmOSXBundleGenerator.cxx | 7 +++-- Source/cmOSXBundleGenerator.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 32 +++++++++++----------- Source/cmVisualStudio10TargetGenerator.h | 3 +- 13 files changed, 84 insertions(+), 75 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index bde60b834..8efd7bb52 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -97,7 +97,7 @@ struct DoAccept template<> struct DoAccept { - static void Do(std::vector& files, cmSourceFile* f) + static void Do(std::vector& files, cmSourceFile* f) { files.push_back(f); } @@ -120,7 +120,7 @@ struct DoAccept }; //---------------------------------------------------------------------------- -template > +template > struct TagVisitor { DataType& Data; @@ -306,7 +306,8 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt, //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetObjectSources(std::vector &data) const +cmGeneratorTarget +::GetObjectSources(std::vector &data) const { IMPLEMENT_VISIT(ObjectSources); if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY) @@ -342,34 +343,39 @@ bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetIDLSources(std::vector& data) const +void cmGeneratorTarget +::GetIDLSources(std::vector& data) const { IMPLEMENT_VISIT(IDLSources); } //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetHeaderSources(std::vector& data) const +cmGeneratorTarget +::GetHeaderSources(std::vector& data) const { IMPLEMENT_VISIT(HeaderSources); } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetExtraSources(std::vector& data) const +void cmGeneratorTarget +::GetExtraSources(std::vector& data) const { IMPLEMENT_VISIT(ExtraSources); } //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetCustomCommands(std::vector& data) const +cmGeneratorTarget +::GetCustomCommands(std::vector& data) const { IMPLEMENT_VISIT(CustomCommands); } //---------------------------------------------------------------------------- void -cmGeneratorTarget::GetExternalObjects(std::vector& data) const +cmGeneratorTarget +::GetExternalObjects(std::vector& data) const { IMPLEMENT_VISIT(ExternalObjects); } @@ -384,7 +390,8 @@ cmGeneratorTarget::GetExpectedResxHeaders(std::set& srcs) const } //---------------------------------------------------------------------------- -void cmGeneratorTarget::GetResxSources(std::vector& srcs) const +void cmGeneratorTarget +::GetResxSources(std::vector& srcs) const { ResxData data; IMPLEMENT_VISIT_IMPL(Resx, COMMA cmGeneratorTarget::ResxData) @@ -570,7 +577,7 @@ cmGeneratorTarget::UseObjectLibraries(std::vector& objs) const cmTarget* objLib = *ti; cmGeneratorTarget* ogt = this->GlobalGenerator->GetGeneratorTarget(objLib); - for(std::vector::const_iterator + for(std::vector::const_iterator si = ogt->ObjectSources.begin(); si != ogt->ObjectSources.end(); ++si) { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 1c4276cb1..139e736c8 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -32,19 +32,19 @@ public: bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector& files) const; - void GetObjectSources(std::vector &) const; + void GetObjectSources(std::vector &) const; const std::string& GetObjectName(cmSourceFile const* file); void AddObject(cmSourceFile const* sf, std::string const&name); bool HasExplicitObjectName(cmSourceFile const* file) const; void AddExplicitObjectName(cmSourceFile const* sf); - void GetResxSources(std::vector&) const; - void GetIDLSources(std::vector&) const; - void GetExternalObjects(std::vector&) const; - void GetHeaderSources(std::vector&) const; - void GetExtraSources(std::vector&) const; - void GetCustomCommands(std::vector&) const; + void GetResxSources(std::vector&) const; + void GetIDLSources(std::vector&) const; + void GetExternalObjects(std::vector&) const; + void GetHeaderSources(std::vector&) const; + void GetExtraSources(std::vector&) const; + void GetCustomCommands(std::vector&) const; void GetExpectedResxHeaders(std::set&) const; cmTarget* Target; @@ -117,7 +117,7 @@ public: struct ResxData { mutable std::set ExpectedResxHeaders; - mutable std::vector ResxSources; + mutable std::vector ResxSources; }; private: friend class cmTargetTraceDependencies; @@ -127,7 +127,7 @@ private: std::map Objects; std::set ExplicitObjectName; - mutable std::vector ObjectSources; + mutable std::vector ObjectSources; std::vector ObjectLibraries; mutable std::map > SystemIncludesCache; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 686414d3f..e9c31e9dd 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -634,14 +634,14 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const // TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl. void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const { - std::vector objectSources; + std::vector objectSources; gt->GetObjectSources(objectSources); // Compute the name of each object file. - for(std::vector::iterator + for(std::vector::iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; std::string objectName = gt->LocalGenerator ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); gt->AddObject(sf, objectName); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index f9ec0a9a6..6ce867806 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -108,14 +108,14 @@ void cmGlobalUnixMakefileGenerator3 ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - std::vector objectSources; + std::vector objectSources; gt->GetObjectSources(objectSources); // Compute the name of each object file. - for(std::vector::iterator + for(std::vector::iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; std::string objectName = gt->LocalGenerator ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); gt->AddObject(sf, objectName); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index f3cba5a68..bd57d0c1d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -129,13 +129,13 @@ cmGlobalVisualStudioGenerator // Count the number of object files with each name. Note that // windows file names are not case sensitive. std::map counts; - std::vector objectSources; + std::vector objectSources; gt->GetObjectSources(objectSources); - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; std::string objectNameLower = cmSystemTools::LowerCase( cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); objectNameLower += ".obj"; @@ -144,11 +144,11 @@ cmGlobalVisualStudioGenerator // For all source files producing duplicate names we need unique // object name computation. - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); objectName += ".obj"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6c12040c9..4904d511c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3944,13 +3944,13 @@ cmGlobalXCodeGenerator // to avoid exact duplicate file names. Note that Mac file names are not // typically case sensitive, hence the LowerCase. std::map counts; - std::vector objectSources; + std::vector objectSources; gt->GetObjectSources(objectSources); - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; std::string objectName = cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); objectName += ".o"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index a838ce3b5..79240e1c4 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -185,7 +185,7 @@ GetLocalObjectFiles(std::map &localObjectFiles) { continue; } - std::vector objectSources; + std::vector objectSources; gt->GetObjectSources(objectSources); // Compute full path to object file directory for this target. std::string dir_max; @@ -194,11 +194,11 @@ GetLocalObjectFiles(std::map &localObjectFiles) dir_max += this->GetTargetDirectory(*gt->Target); dir_max += "/"; // Compute the name of each object file. - for(std::vector::iterator + for(std::vector::iterator si = objectSources.begin(); si != objectSources.end(); ++si) { - cmSourceFile* sf = *si; + cmSourceFile const* sf = *si; bool hasSourceExtension = true; std::string objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max, diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 32e1c1ae1..6759d050e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -153,9 +153,9 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() // First generate the object rule files. Save a list of all object // files for this target. - std::vector customCommands; + std::vector customCommands; this->GeneratorTarget->GetCustomCommands(customCommands); - for(std::vector::const_iterator + for(std::vector::const_iterator si = customCommands.begin(); si != customCommands.end(); ++si) { @@ -176,27 +176,27 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() } } } - std::vector headerSources; + std::vector headerSources; this->GeneratorTarget->GetHeaderSources(headerSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( headerSources, this->MacOSXContentGenerator); - std::vector extraSources; + std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( extraSources, this->MacOSXContentGenerator); - std::vector externalObjects; + std::vector externalObjects; this->GeneratorTarget->GetExternalObjects(externalObjects); - for(std::vector::const_iterator + for(std::vector::const_iterator si = externalObjects.begin(); si != externalObjects.end(); ++si) { this->ExternalObjects.push_back((*si)->GetFullPath()); } - std::vector objectSources; + std::vector objectSources; this->GeneratorTarget->GetObjectSources(objectSources); - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { // Generate this object file's rule file. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3738ca75c..4319f3cb3 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -480,36 +480,36 @@ cmNinjaTargetGenerator << this->GetTargetName() << "\n\n"; - std::vector customCommands; + std::vector customCommands; this->GeneratorTarget->GetCustomCommands(customCommands); - for(std::vector::const_iterator + for(std::vector::const_iterator si = customCommands.begin(); si != customCommands.end(); ++si) { cmCustomCommand const* cc = (*si)->GetCustomCommand(); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); } - std::vector headerSources; + std::vector headerSources; this->GeneratorTarget->GetHeaderSources(headerSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( headerSources, this->MacOSXContentGenerator); - std::vector extraSources; + std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources); this->OSXBundleGenerator->GenerateMacOSXContentStatements( extraSources, this->MacOSXContentGenerator); - std::vector externalObjects; + std::vector externalObjects; this->GeneratorTarget->GetExternalObjects(externalObjects); - for(std::vector::const_iterator + for(std::vector::const_iterator si = externalObjects.begin(); si != externalObjects.end(); ++si) { this->Objects.push_back(this->GetSourceFilePath(*si)); } - std::vector objectSources; + std::vector objectSources; this->GeneratorTarget->GetObjectSources(objectSources); - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { this->WriteObjectBuildStatement(*si); @@ -570,9 +570,9 @@ cmNinjaTargetGenerator } // Add order-only dependencies on custom command outputs. - std::vector customCommands; + std::vector customCommands; this->GeneratorTarget->GetCustomCommands(customCommands); - for(std::vector::const_iterator + for(std::vector::const_iterator si = customCommands.begin(); si != customCommands.end(); ++si) { diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 835f892ba..6f16913d6 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -190,13 +190,14 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, //---------------------------------------------------------------------------- void cmOSXBundleGenerator:: -GenerateMacOSXContentStatements(std::vector const& sources, - MacOSXContentGeneratorType* generator) +GenerateMacOSXContentStatements( + std::vector const& sources, + MacOSXContentGeneratorType* generator) { if (this->MustSkip()) return; - for(std::vector::const_iterator + for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { cmGeneratorTarget::SourceFileFlags tsFlags = diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index 5acdd9f27..f945c15a8 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -49,7 +49,7 @@ public: }; void GenerateMacOSXContentStatements( - std::vector const& sources, + std::vector const& sources, MacOSXContentGeneratorType* generator); std::string InitMacOSXContentDirectory(const char* pkgloc); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index cc1fdbce6..b8631ca18 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -377,12 +377,12 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences() void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() { - std::vector resxObjs; + std::vector resxObjs; this->GeneratorTarget->GetResxSources(resxObjs); if(!resxObjs.empty()) { this->WriteString("\n", 1); - for(std::vector::const_iterator oi = resxObjs.begin(); + for(std::vector::const_iterator oi = resxObjs.begin(); oi != resxObjs.end(); ++oi) { std::string obj = (*oi)->GetFullPath(); @@ -551,9 +551,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() void cmVisualStudio10TargetGenerator::WriteCustomCommands() { this->SourcesVisited.clear(); - std::vector customCommands; + std::vector customCommands; this->GeneratorTarget->GetCustomCommands(customCommands); - for(std::vector::const_iterator + for(std::vector::const_iterator si = customCommands.begin(); si != customCommands.end(); ++si) { @@ -746,12 +746,12 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups); } - std::vector resxObjs; + std::vector resxObjs; this->GeneratorTarget->GetResxSources(resxObjs); if(!resxObjs.empty()) { this->WriteString("\n", 1); - for(std::vector::const_iterator oi = resxObjs.begin(); + for(std::vector::const_iterator oi = resxObjs.begin(); oi != resxObjs.end(); ++oi) { std::string obj = (*oi)->GetFullPath(); @@ -902,7 +902,7 @@ WriteGroupSources(const char* name, for(ToolSources::const_iterator s = sources.begin(); s != sources.end(); ++s) { - cmSourceFile* sf = s->SourceFile; + cmSourceFile const* sf = s->SourceFile; std::string const& source = sf->GetFullPath(); cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); @@ -985,9 +985,9 @@ void cmVisualStudio10TargetGenerator::WriteSource( } void cmVisualStudio10TargetGenerator::WriteSources( - const char* tool, std::vector const& sources) + const char* tool, std::vector const& sources) { - for(std::vector::const_iterator + for(std::vector::const_iterator si = sources.begin(); si != sources.end(); ++si) { this->WriteSource(tool, *si); @@ -1002,16 +1002,16 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } this->WriteString("\n", 1); - std::vector headerSources; + std::vector headerSources; this->GeneratorTarget->GetHeaderSources(headerSources); this->WriteSources("ClInclude", headerSources); - std::vector idlSources; + std::vector idlSources; this->GeneratorTarget->GetIDLSources(idlSources); this->WriteSources("Midl", idlSources); - std::vector objectSources; + std::vector objectSources; this->GeneratorTarget->GetObjectSources(objectSources); - for(std::vector::const_iterator + for(std::vector::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { @@ -1050,7 +1050,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } } - std::vector externalObjects; + std::vector externalObjects; this->GeneratorTarget->GetExternalObjects(externalObjects); if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10) { @@ -1062,7 +1062,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() { // If an object file is generated in this target, then vs10 will use // it in the build, and we have to list it as None instead of Object. - for(std::vector::const_iterator + for(std::vector::const_iterator si = externalObjects.begin(); si != externalObjects.end(); ++si) { @@ -1072,7 +1072,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() } } - std::vector extraSources; + std::vector extraSources; this->GeneratorTarget->GetExtraSources(extraSources); this->WriteSources("None", extraSources); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 8faeb8ecb..d72c6fd6a 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -57,7 +57,8 @@ private: void WriteProjectConfigurationValues(); void WriteSource(const char* tool, cmSourceFile const* sf, const char* end = 0); - void WriteSources(const char* tool, std::vector const&); + void WriteSources(const char* tool, + std::vector const&); void WriteAllSources(); void WriteDotNetReferences(); void WriteEmbeddedResourceGroup(); From f6da044080d854b9ad87cef5c2a6f5195722a6da Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 17:37:26 +0100 Subject: [PATCH 185/278] cmLocalGenerator: Add ComputeObjectFilenames interface. Implement it in the local generators and use it in the global generators. --- Source/cmGlobalNinjaGenerator.cxx | 23 ++++++++----- Source/cmGlobalUnixMakefileGenerator3.cxx | 21 +++++++----- Source/cmGlobalVisualStudioGenerator.cxx | 40 ++++++----------------- Source/cmGlobalXCodeGenerator.cxx | 30 +++++++---------- Source/cmLocalGenerator.cxx | 8 +++++ Source/cmLocalGenerator.h | 4 +++ Source/cmLocalNinjaGenerator.cxx | 14 ++++++++ Source/cmLocalNinjaGenerator.h | 4 +++ Source/cmLocalUnixMakefileGenerator3.cxx | 14 ++++++++ Source/cmLocalUnixMakefileGenerator3.h | 4 +++ Source/cmLocalVisualStudioGenerator.cxx | 40 +++++++++++++++++++++++ Source/cmLocalVisualStudioGenerator.h | 4 +++ Source/cmLocalXCodeGenerator.cxx | 28 ++++++++++++++++ Source/cmLocalXCodeGenerator.h | 3 ++ 14 files changed, 172 insertions(+), 65 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e9c31e9dd..08507eb5e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -19,6 +19,7 @@ #include "cmVersion.h" #include +#include const char* cmGlobalNinjaGenerator::NINJA_BUILD_FILE = "build.ninja"; const char* cmGlobalNinjaGenerator::NINJA_RULES_FILE = "rules.ninja"; @@ -636,15 +637,21 @@ void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const { std::vector objectSources; gt->GetObjectSources(objectSources); - // Compute the name of each object file. - for(std::vector::iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) { - cmSourceFile const* sf = *si; - std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); - gt->AddObject(sf, objectName); + mapping[*it]; + } + + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + for(std::map::const_iterator it + = mapping.begin(); it != mapping.end(); ++it) + { + assert(!it->second.empty()); + gt->AddObject(it->first, it->second); } } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 6ce867806..91258ed0d 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -110,15 +110,20 @@ cmGlobalUnixMakefileGenerator3 { std::vector objectSources; gt->GetObjectSources(objectSources); - // Compute the name of each object file. - for(std::vector::iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) { - cmSourceFile const* sf = *si; - std::string objectName = gt->LocalGenerator - ->GetObjectFileNameWithoutTarget(*sf, gt->ObjectDirectory); - gt->AddObject(sf, objectName); + mapping[*it]; + } + + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + for(std::map::const_iterator it + = mapping.begin(); it != mapping.end(); ++it) + { + gt->AddObject(it->first, it->second); } } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index bd57d0c1d..9740fbfb8 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -122,42 +122,22 @@ void cmGlobalVisualStudioGenerator ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - cmLocalVisualStudioGenerator* lg = - static_cast(gt->LocalGenerator); - std::string dir_max = lg->ComputeLongestObjectDirectory(*gt->Target); - - // Count the number of object files with each name. Note that - // windows file names are not case sensitive. - std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); - for(std::vector::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) { - cmSourceFile const* sf = *si; - std::string objectNameLower = cmSystemTools::LowerCase( - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); - objectNameLower += ".obj"; - counts[objectNameLower] += 1; + mapping[*it]; } - // For all source files producing duplicate names we need unique - // object name computation. - for(std::vector::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + for(std::map::const_iterator it + = mapping.begin(); it != mapping.end(); ++it) { - cmSourceFile const* sf = *si; - std::string objectName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); - objectName += ".obj"; - if(counts[cmSystemTools::LowerCase(objectName)] > 1) - { - gt->AddExplicitObjectName(sf); - objectName = lg->GetObjectFileNameWithoutTarget(*sf, dir_max); - } - gt->AddObject(sf, objectName); + gt->AddObject(it->first, it->second); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4904d511c..0a4b51cdc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3939,30 +3939,22 @@ void cmGlobalXCodeGenerator ::ComputeTargetObjects(cmGeneratorTarget* gt) const { - // Count the number of object files with each name. Warn about duplicate - // names since Xcode names them uniquely automatically with a numeric suffix - // to avoid exact duplicate file names. Note that Mac file names are not - // typically case sensitive, hence the LowerCase. - std::map counts; std::vector objectSources; gt->GetObjectSources(objectSources); - for(std::vector::const_iterator - si = objectSources.begin(); - si != objectSources.end(); ++si) + + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) { - cmSourceFile const* sf = *si; - std::string objectName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); - objectName += ".o"; + mapping[*it]; + } - std::string objectNameLower = cmSystemTools::LowerCase(objectName); - counts[objectNameLower] += 1; - if (2 == counts[objectNameLower]) - { - // TODO: emit warning about duplicate name? - } + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - gt->AddObject(sf, objectName); + for(std::map::const_iterator it + = mapping.begin(); it != mapping.end(); ++it) + { + gt->AddObject(it->first, it->second); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ebcfa08c5..c63de792b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -3080,6 +3080,14 @@ cmLocalGenerator return it->second; } +//---------------------------------------------------------------------------- +void cmLocalGenerator::ComputeObjectFilenames( + std::map&, + cmGeneratorTarget const*) +{ + +} + //---------------------------------------------------------------------------- std::string cmLocalGenerator diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index afcaee9b5..61488fecd 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -372,6 +372,10 @@ public: std::string& linkPath, cmGeneratorTarget* target); + virtual void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt = 0); + protected: ///! put all the libraries for a target on into the given stream virtual void OutputLinkLibraries(std::string& linkLibraries, diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 7c4aab87c..2f763cecf 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -267,6 +267,20 @@ void cmLocalNinjaGenerator::SetConfigName() } } +//---------------------------------------------------------------------------- +void cmLocalNinjaGenerator::ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt) +{ + for(std::map::iterator + si = mapping.begin(); si != mapping.end(); ++si) + { + cmSourceFile const* sf = si->first; + si->second = this->GetObjectFileNameWithoutTarget(*sf, + gt->ObjectDirectory); + } +} + void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h index 9d0b7b5bc..e91e60b1b 100644 --- a/Source/cmLocalNinjaGenerator.h +++ b/Source/cmLocalNinjaGenerator.h @@ -101,6 +101,10 @@ public: virtual std::string ConvertToLinkReference(std::string const& lib, OutputFormat format = SHELL); + virtual void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt = 0); + protected: virtual std::string ConvertToIncludeReference(std::string const& path, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 79240e1c4..2d3608925 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -171,6 +171,20 @@ void cmLocalUnixMakefileGenerator3::Generate() this->WriteDirectoryInformationFile(); } +//---------------------------------------------------------------------------- +void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt) +{ + for(std::map::iterator + si = mapping.begin(); si != mapping.end(); ++si) + { + cmSourceFile const* sf = si->first; + si->second = this->GetObjectFileNameWithoutTarget(*sf, + gt->ObjectDirectory); + } +} + //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3:: GetLocalObjectFiles(std::map &localObjectFiles) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 27070e2dc..14543fbaa 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -313,6 +313,10 @@ private: std::string MakeLauncher(cmCustomCommandGenerator const& ccg, cmTarget* target, RelativeRoot relative); + virtual void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt = 0); + friend class cmMakefileTargetGenerator; friend class cmMakefileExecutableTargetGenerator; friend class cmMakefileLibraryTargetGenerator; diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 613ee975c..9680d43b1 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -30,6 +30,46 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator() { } +//---------------------------------------------------------------------------- +void cmLocalVisualStudioGenerator::ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt) +{ + std::string dir_max = this->ComputeLongestObjectDirectory(*gt->Target); + + // Count the number of object files with each name. Note that + // windows file names are not case sensitive. + std::map counts; + + for(std::map::iterator + si = mapping.begin(); si != mapping.end(); ++si) + { + cmSourceFile const* sf = si->first; + std::string objectNameLower = cmSystemTools::LowerCase( + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath())); + objectNameLower += ".obj"; + counts[objectNameLower] += 1; + } + + // For all source files producing duplicate names we need unique + // object name computation. + + for(std::map::iterator + si = mapping.begin(); si != mapping.end(); ++si) + { + cmSourceFile const* sf = si->first; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".obj"; + if(counts[cmSystemTools::LowerCase(objectName)] > 1) + { + const_cast(gt)->AddExplicitObjectName(sf); + objectName = this->GetObjectFileNameWithoutTarget(*sf, dir_max); + } + si->second = objectName; + } +} + //---------------------------------------------------------------------------- cmsys::auto_ptr cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index a89e21930..3bf4f4339 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -61,6 +61,10 @@ public: virtual void AddCMakeListsRules() = 0; + virtual void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* = 0); + protected: virtual const char* ReportErrorLabel() const; virtual bool CustomCommandUseLocal() const { return false; } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 5857aefa0..8ff6c87d6 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -71,3 +71,31 @@ void cmLocalXCodeGenerator::GenerateInstallRules() t->HasMacOSXRpathInstallNameDir(""); } } + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const*) +{ + // Count the number of object files with each name. Warn about duplicate + // names since Xcode names them uniquely automatically with a numeric suffix + // to avoid exact duplicate file names. Note that Mac file names are not + // typically case sensitive, hence the LowerCase. + std::map counts; + for(std::map::iterator + si = mapping.begin(); si != mapping.end(); ++si) + { + cmSourceFile const* sf = si->first; + std::string objectName = + cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath()); + objectName += ".o"; + + std::string objectNameLower = cmSystemTools::LowerCase(objectName); + counts[objectNameLower] += 1; + if (2 == counts[objectNameLower]) + { + // TODO: emit warning about duplicate name? + } + si->second = objectName; + } +} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index 3bfe3a30a..f553a17ef 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -32,6 +32,9 @@ public: const std::string& rawFlag); virtual void Generate(); virtual void GenerateInstallRules(); + virtual void ComputeObjectFilenames( + std::map& mapping, + cmGeneratorTarget const* gt = 0); private: }; From 328c217960ac3ee92270739a2dc4fc9d566789c3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Mar 2014 15:11:08 -0400 Subject: [PATCH 186/278] Help: Drop cmStdString from cmake-developer(7) examples The type no longer exists within CMake. --- Help/manual/cmake-developer.7.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 376b56cc4..d025d6347 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -55,7 +55,7 @@ used in a comparison with the iterator returned by ``end()``: .. code-block:: c++ - const std::set& someSet = getSet(); + const std::set& someSet = getSet(); if (someSet.find("needle") == someSet.end()) // Wrong { // ... @@ -66,8 +66,8 @@ The return value of ``find()`` must be assigned to an intermediate .. code-block:: c++ - const std::set& someSet; - const std::set::const_iterator i = someSet.find("needle"); + const std::set& someSet; + const std::set::const_iterator i = someSet.find("needle"); if (i != propSet.end()) // Ok { // ... @@ -110,7 +110,7 @@ conversion is not allowed: .. code-block:: c++ - std::set theSet; + std::set theSet; std::vector theVector; theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong @@ -118,9 +118,9 @@ A loop must be used instead: .. code-block:: c++ - std::set theSet; + std::set theSet; std::vector theVector; - for(std::set::iterator li = theSet.begin(); + for(std::set::iterator li = theSet.begin(); li != theSet.end(); ++li) { theVector.push_back(*li); From d363cbf3156c5e8ef160ffbb45cfa269addebb50 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Mar 2014 15:46:30 -0400 Subject: [PATCH 187/278] Tests: Make RunCMake.find_dependency tolerate line number changes --- Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt | 2 +- Tests/RunCMake/find_dependency/extra-args-stderr.txt | 2 +- Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt index 6f4fc0411..348f8bb25 100644 --- a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt +++ b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:35 \(message\): +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/find_dependency/extra-args-stderr.txt b/Tests/RunCMake/find_dependency/extra-args-stderr.txt index 1b523807e..83a7f0266 100644 --- a/Tests/RunCMake/find_dependency/extra-args-stderr.txt +++ b/Tests/RunCMake/find_dependency/extra-args-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:47 \(message\): +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): Invalid arguments to find_dependency Call Stack \(most recent call first\): extra-args.cmake:4 \(find_dependency\) diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt index c36148fad..fee8d5db7 100644 --- a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt +++ b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt @@ -1,4 +1,4 @@ -CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:42 \(message\): +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): Invalid arguments to find_dependency Call Stack \(most recent call first\): invalid-arg-3.cmake:4 \(find_dependency\) From a25b809f2075828e5ae488f74d85f5a31940460a Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 13 Mar 2014 15:49:08 -0400 Subject: [PATCH 188/278] Tests: Check find_dependency empty extra arguments Add cases for empty arg 2 and arg 3. --- Tests/RunCMake/find_dependency/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/find_dependency/empty-arg-3-result.txt | 1 + Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt | 5 +++++ Tests/RunCMake/find_dependency/empty-arg-3.cmake | 4 ++++ Tests/RunCMake/find_dependency/empty-version-result.txt | 1 + Tests/RunCMake/find_dependency/empty-version-stderr.txt | 5 +++++ Tests/RunCMake/find_dependency/empty-version.cmake | 4 ++++ 7 files changed, 22 insertions(+) create mode 100644 Tests/RunCMake/find_dependency/empty-arg-3-result.txt create mode 100644 Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt create mode 100644 Tests/RunCMake/find_dependency/empty-arg-3.cmake create mode 100644 Tests/RunCMake/find_dependency/empty-version-result.txt create mode 100644 Tests/RunCMake/find_dependency/empty-version-stderr.txt create mode 100644 Tests/RunCMake/find_dependency/empty-version.cmake diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake index b85104aa6..9403136b7 100644 --- a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) run_cmake(EXACT-no-version) +run_cmake(empty-version) +run_cmake(empty-arg-3) run_cmake(invalid-arg-3) run_cmake(extra-args) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-result.txt b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt new file mode 100644 index 000000000..bf9b02b43 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency +Call Stack \(most recent call first\): + empty-arg-3.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-arg-3.cmake b/Tests/RunCMake/find_dependency/empty-arg-3.cmake new file mode 100644 index 000000000..b08200a5a --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-arg-3.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 1.2 "") diff --git a/Tests/RunCMake/find_dependency/empty-version-result.txt b/Tests/RunCMake/find_dependency/empty-version-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_dependency/empty-version-stderr.txt b/Tests/RunCMake/find_dependency/empty-version-stderr.txt new file mode 100644 index 000000000..b5e9f4643 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\): + Invalid arguments to find_dependency. VERSION is empty +Call Stack \(most recent call first\): + empty-version.cmake:4 \(find_dependency\) + CMakeLists.txt:4 \(include\) diff --git a/Tests/RunCMake/find_dependency/empty-version.cmake b/Tests/RunCMake/find_dependency/empty-version.cmake new file mode 100644 index 000000000..e6f17cd13 --- /dev/null +++ b/Tests/RunCMake/find_dependency/empty-version.cmake @@ -0,0 +1,4 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack1 "") From 9840320dff7d6bc0fc64d06271a639303ea53ce7 Mon Sep 17 00:00:00 2001 From: Volkan Gezer Date: Thu, 27 Feb 2014 14:37:52 +0100 Subject: [PATCH 189/278] CTest: Add support for Intel coverage files By default, Intel compiler coverage tools generate HTML files as reports, but the option -txtlcov can be given to codecov to output a coverage file with LCov format. To use Intel coverage: * build the project with coverage flags * run the application * run profmerge * run codecov The output file will be "build_dir/CodeCoverage/SRCFILEDIR.LCOV". Ask users to compile with -prof-dir${BUILD_DIR} instead of searching the entire build tree recursively to find coverage files. --- Source/CTest/cmCTestCoverageHandler.cxx | 305 ++++++++++++++++++++++++ Source/CTest/cmCTestCoverageHandler.h | 4 + 2 files changed, 309 insertions(+) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f0b11241f..cb6e56ef6 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -379,6 +379,12 @@ int cmCTestCoverageHandler::ProcessHandler() int file_count = 0; file_count += this->HandleGCovCoverage(&cont); error = cont.Error; + if ( file_count < 0 ) + { + return error; + } + file_count += this->HandleLCovCoverage(&cont); + error = cont.Error; if ( file_count < 0 ) { return error; @@ -880,6 +886,13 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string gcovExtraFlags = this->CTest->GetCTestConfiguration("CoverageExtraFlags"); + // Immediately skip to next coverage option since codecov is only for Intel + // compiler + if ( gcovCommand == "codecov" ) + { + return 0; + } + // Style 1 std::string st1gcovOutputRex1 = "[0-9]+\\.[0-9]+% of [0-9]+ (source |)lines executed in file (.*)$"; @@ -1296,6 +1309,270 @@ int cmCTestCoverageHandler::HandleGCovCoverage( return file_count; } +//---------------------------------------------------------------------- +int cmCTestCoverageHandler::HandleLCovCoverage( + cmCTestCoverageHandlerContainer* cont) +{ + std::string lcovCommand + = this->CTest->GetCTestConfiguration("CoverageCommand"); + std::string lcovExtraFlags + = this->CTest->GetCTestConfiguration("CoverageExtraFlags"); + if ( lcovCommand != "codecov" ) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Not a valid Intel Coverage command." + << std::endl); + return 0; + } + // There is only percentage completed output from LCOV + std::string st2lcovOutputRex3 = "[0-9]+%"; + cmsys::RegularExpression st2re3(st2lcovOutputRex3.c_str()); + + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " This is coverage command: " << lcovCommand + << std::endl); + + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " These are coverage command flags: " << lcovExtraFlags + << std::endl); + + std::vector files; + this->FindLCovFiles(files); + std::vector::iterator it; + + if ( files.size() == 0 ) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " Cannot find any LCov coverage files." + << std::endl); + // No coverage files is a valid thing, so the exit code is 0 + return 0; + } + std::string testingDir = this->CTest->GetBinaryDir(); + std::string tempDir = testingDir; + std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); + + std::set missingFiles; + + std::string actualSourceFile = ""; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Processing coverage (each . represents one file):" << std::endl); + cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + int file_count = 0; + + // make sure output from lcov is in English! + cmCTestCoverageHandlerLocale locale_C; + static_cast(locale_C); + + // In intel compiler we have to call codecov only once in each executable + // directory. It collects all *.dyn files to generate .dpi file. + for ( it = files.begin(); it != files.end(); ++ it ) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); + std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); + cmSystemTools::ChangeDirectory(fileDir.c_str()); + std::string command = "\"" + lcovCommand + "\" " + + lcovExtraFlags + " "; + + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: " + << fileDir.c_str() << std::endl); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() + << std::endl); + + std::string output = ""; + std::string errors = ""; + int retVal = 0; + *cont->OFS << "* Run coverage for: " << fileDir.c_str() << std::endl; + *cont->OFS << " Command: " << command.c_str() << std::endl; + int res = this->CTest->RunCommand(command.c_str(), &output, &errors, + &retVal, fileDir.c_str(), 0 /*this->TimeOut*/); + + *cont->OFS << " Output: " << output.c_str() << std::endl; + *cont->OFS << " Errors: " << errors.c_str() << std::endl; + if ( ! res ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Problem running coverage on file: " << it->c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Command produced error: " << errors << std::endl); + cont->Error ++; + continue; + } + if ( retVal != 0 ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Coverage command returned: " + << retVal << " while processing: " << it->c_str() << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Command produced error: " << cont->Error << std::endl); + } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "--------------------------------------------------------------" + << std::endl + << output << std::endl + << "--------------------------------------------------------------" + << std::endl); + + std::vector lines; + std::vector::iterator line; + + cmSystemTools::Split(output.c_str(), lines); + + for ( line = lines.begin(); line != lines.end(); ++line) + { + std::string sourceFile; + std::string lcovFile; + + if ( line->size() == 0 ) + { + // Ignore empty line + } + // Look for LCOV files in binary directory + // Intel Compiler creates a CodeCoverage dir for each subfolder and + // each subfolder has LCOV files + cmsys::Glob gl; + gl.RecurseOn(); + gl.RecurseThroughSymlinksOff(); + std::string dir; + std::vector lcovFiles; + dir = this->CTest->GetBinaryDir(); + std::string daGlob; + daGlob = dir; + daGlob += "/*.LCOV"; + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for LCOV files in: " << daGlob << std::endl); + gl.FindFiles(daGlob); + // Keep a list of all LCOV files + lcovFiles.insert(lcovFiles.end(), gl.GetFiles().begin(), + gl.GetFiles().end()); + + for(std::vector::iterator a = lcovFiles.begin(); + a != lcovFiles.end(); ++a) + { + lcovFile = *a; + cmsys::ifstream srcead(lcovFile.c_str()); + if ( ! srcead ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: " + << lcovFile << std::endl); + } + std::string srcname; + + int success = cmSystemTools::GetLineFromStream(srcead, srcname); + if ( !success ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error while parsing lcov file '" << lcovFile << "':" + << " No source file name found!" << std::endl); + return 0; + } + srcname = srcname.substr(18); + // We can directly read found LCOV files to determine the source + // files + sourceFile = srcname; + actualSourceFile = srcname; + + for(std::vector::iterator t = lcovFiles.begin(); + t != lcovFiles.end(); ++t) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found LCOV File: " + << *t << std::endl); + } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SourceFile: " + << sourceFile << std::endl); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "lCovFile: " + << lcovFile << std::endl); + + // If we have some LCOV files to process + if ( !lcovFile.empty() && !actualSourceFile.empty() ) + { + cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec + = cont->TotalCoverage[actualSourceFile]; + + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in lcovFile: " + << lcovFile << std::endl); + + cmsys::ifstream ifile(lcovFile.c_str()); + if ( ! ifile ) + { + cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open file: " + << lcovFile << std::endl); + } + else + { + long cnt = -1; + std::string nl; + + // Skip the first line + cmSystemTools::GetLineFromStream(ifile, nl); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "File is ready, start reading." << std::endl); + while ( cmSystemTools::GetLineFromStream(ifile, nl) ) + { + cnt ++; + + // Skip empty lines + if ( !nl.size() ) + { + continue; + } + + // Skip unused lines + if ( nl.size() < 12 ) + { + continue; + } + + // Read the coverage count from the beginning of the lcov + // output line + std::string prefix = nl.substr(0, 17); + int cov = atoi(prefix.c_str()); + + // Read the line number starting at the 17th character of the + // lcov output line + std::string lineNumber = nl.substr(17, 7); + + int lineIdx = atoi(lineNumber.c_str())-1; + if ( lineIdx >= 0 ) + { + while ( vec.size() <= static_cast(lineIdx) ) + { + vec.push_back(-1); + } + + // Initially all entries are -1 (not used). If we get coverage + // information, increment it to 0 first. + if ( vec[lineIdx] < 0 ) + { + if ( cov > 0 || prefix.find("#") != prefix.npos ) + { + vec[lineIdx] = 0; + } + } + + vec[lineIdx] += cov; + } + } + } + + actualSourceFile = ""; + } + } + } + + file_count++; + + if ( file_count % 50 == 0 ) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count + << " out of " << files.size() << std::endl); + cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); + } + } + + cmSystemTools::ChangeDirectory(currentDirectory.c_str()); + return file_count; +} + //---------------------------------------------------------------------------- void cmCTestCoverageHandler::FindGCovFiles(std::vector& files) { @@ -1327,6 +1604,34 @@ void cmCTestCoverageHandler::FindGCovFiles(std::vector& files) } } +//---------------------------------------------------------------------------- +void cmCTestCoverageHandler::FindLCovFiles(std::vector& files) +{ + cmsys::Glob gl; + gl.RecurseOff(); // No need of recurse if -prof_dir${BUILD_DIR} flag is + // used while compiling. + gl.RecurseThroughSymlinksOff(); + std::string prevBinaryDir; + cmSystemTools::ChangeDirectory( + this->CTest->GetCTestConfiguration("BuildDirectory").c_str()); + + // Run profmerge to merge all *.dyn files into dpi files + cmSystemTools::RunSingleCommand("profmerge"); + + prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory().c_str(); + + // DPI file should appear in build directory + std::string daGlob; + daGlob = prevBinaryDir; + daGlob += "/*.dpi"; + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + " looking for dpi files in: " << daGlob << std::endl); + gl.FindFiles(daGlob); + files.insert(files.end(), gl.GetFiles().begin(), gl.GetFiles().end()); + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Now searching in: " << daGlob << std::endl); +} + //---------------------------------------------------------------------- int cmCTestCoverageHandler::HandleTracePyCoverage( cmCTestCoverageHandlerContainer* cont) diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index 6a8f55def..0a0fe8156 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -68,6 +68,10 @@ private: int HandleGCovCoverage(cmCTestCoverageHandlerContainer* cont); void FindGCovFiles(std::vector& files); + //! Handle coverage using Intel's LCov + int HandleLCovCoverage(cmCTestCoverageHandlerContainer* cont); + void FindLCovFiles(std::vector& files); + //! Handle coverage using xdebug php coverage int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont); From 9a026b902b7c7c263e6c3a70f755f974e8953132 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 14 Mar 2014 00:01:14 -0400 Subject: [PATCH 190/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index be11dce70..040cd273d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140313) +set(CMake_VERSION_PATCH 20140314) #set(CMake_VERSION_RC 1) From 1af77f3f1dcd2fe160a9ea1d7936742c968f25d1 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 14 Mar 2014 11:51:45 +0100 Subject: [PATCH 191/278] FeatureSummary: Add missing titles for PACKAGES_FOUND and PACKAGES_NOT_FOUND Since now these can be used with the WHAT argument a title is required. --- Modules/FeatureSummary.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index 66965158b..a72954c10 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -492,6 +492,8 @@ function(FEATURE_SUMMARY) set(title_ENABLED_FEATURES "The following features have been enabled:") set(title_DISABLED_FEATURES "The following features have been disabled:") + set(title_PACKAGES_FOUND "The following packages have been found:") + set(title_PACKAGES_NOT_FOUND "The following packages have not been found:") set(title_OPTIONAL_PACKAGES_FOUND "The following OPTIONAL packages have been found:") set(title_OPTIONAL_PACKAGES_NOT_FOUND "The following OPTIONAL packages have not been found:") set(title_RECOMMENDED_PACKAGES_FOUND "The following RECOMMENDED packages have been found:") From a9e6de2acc1ac2e51b4d737b3abbeee3bf43832c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 5 Mar 2014 17:01:26 -0500 Subject: [PATCH 192/278] FindPythonInterp: Use consistent version with PythonLibs (#13794) If find_package(PythonLibs) find_package(PythonInterp) is called, help PythonInterp to get a version of PYTHON_EXECUTABLE consistent with the library versions found by PythonLibs. --- Modules/FindPythonInterp.cmake | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 8da848c4e..780cda8f7 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -71,18 +71,23 @@ if(PythonInterp_FIND_VERSION) else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) endif() - -list(APPEND _Python_NAMES python) - -# Search for the current active python version first find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}) # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. -set(_Python_VERSIONS - ${Python_ADDITIONAL_VERSIONS} - ${_PYTHON_FIND_OTHER_VERSIONS} - ) +set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS}) +# If FindPythonInterp has already found the major and minor version, +# insert that version next to get consistent versions of the interpreter and +# library. +if(DEFINED PYTHONLIBS_VERSION_STRING) + string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}") + list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR) + list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR) + list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR}) +endif() +# Search for the current active python version first +list(APPEND _Python_VERSIONS ";") +list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS}) unset(_PYTHON_FIND_OTHER_VERSIONS) unset(_PYTHON1_VERSIONS) @@ -91,7 +96,7 @@ unset(_PYTHON3_VERSIONS) # Search for newest python version if python executable isn't found if(NOT PYTHON_EXECUTABLE) - foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS) set(_Python_NAMES python${_CURRENT_VERSION}) if(WIN32) list(APPEND _Python_NAMES python) From 59220198022d2e081ddba164c1ec62a6e9d438eb Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 13 Mar 2014 11:19:11 -0400 Subject: [PATCH 193/278] FindPython*: Document suggested find_package order (#13794) Document in both FindPythonInterp.cmake and FindPythonLibs.cmake that find_package(PythonInterp) should be called before find_package(PythonLibs). --- Modules/FindPythonInterp.cmake | 4 ++++ Modules/FindPythonLibs.cmake | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 780cda8f7..f8ff5d88b 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -27,6 +27,10 @@ # of version numbers that should be taken into account when searching # for Python. You need to set this variable before calling # find_package(PythonInterp). +# +# If also calling find_package(PythonLibs), call find_package(PythonInterp) +# first to get the currently active Python version by default with a consistent +# version of PYTHON_LIBRARIES. #============================================================================= # Copyright 2005-2010 Kitware, Inc. diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 656ed7be7..1f90f5b14 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -31,6 +31,10 @@ # # PYTHON_LIBRARY - path to the python library # PYTHON_INCLUDE_DIR - path to where Python.h is found +# +# If also calling find_package(PythonInterp), call find_package(PythonInterp) +# first to get the currently active Python version by default with a consistent +# version of PYTHON_LIBRARIES. #============================================================================= # Copyright 2001-2009 Kitware, Inc. From 13778cd3be03de966c006b7acc6c1ec07019ab07 Mon Sep 17 00:00:00 2001 From: Sean D'Epagnier Date: Mon, 10 Mar 2014 13:37:26 +0800 Subject: [PATCH 194/278] CPackDeb: Add option to set compression type Add a CPACK_DEBIAN_COMPRESSION_TYPE option to set the compression type. Default to 'gzip' to preserve existing behavior. Use "cmake -E tar" for 'gzip', 'bzip2', and 'none'. Use system "tar" for 'lzma' and 'xz'. --- Modules/CPackDeb.cmake | 13 +++++++- Source/CPack/cmCPackDebGenerator.cxx | 46 ++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index c79ef0633..b210bbb8d 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -67,7 +67,12 @@ # * Mandatory : YES # * Default : 'devel' # -# The debian package section +# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE +# +# * Mandatory : YES +# * Default : 'gzip' +# +# Possible values are: lzma, xz, bzip2 and gzip. # # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY # @@ -390,6 +395,12 @@ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") endif() +# Compression: (recommended) +if(NOT CPACK_DEBIAN_COMPRESSION_TYPE) + set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip") +endif() + + # Recommends: # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 27e9d9fde..936942b9b 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -403,9 +403,39 @@ int cmCPackDebGenerator::createDeb() if (NULL != this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE")) { cmd += this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE"); } - cmd += " \""; - cmd += cmakeExecutable; - cmd += "\" -E tar cfz data.tar.gz "; + + const char* debian_compression_type = + this->GetOption("CPACK_DEBIAN_COMPRESSION_TYPE"); + if(!debian_compression_type) + { + debian_compression_type = "gzip"; + } + + std::string cmake_tar = " ", compression_modifier = "a", compression_suffix; + if(!strcmp(debian_compression_type, "lzma")) { + compression_suffix = ".lzma"; + } else if(!strcmp(debian_compression_type, "xz")) { + compression_suffix = ".xz"; + } else if(!strcmp(debian_compression_type, "bzip2")) { + compression_suffix = ".bz2"; + compression_modifier = "j"; + cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E "; + } else if(!strcmp(debian_compression_type, "gzip")) { + compression_suffix = ".gz"; + compression_modifier = "z"; + cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E "; + } else if(!strcmp(debian_compression_type, "none")) { + compression_suffix = ""; + compression_modifier = ""; + cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E "; + } else { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error unrecognized compression type: " + << debian_compression_type << std::endl); + } + + cmd += cmake_tar + "tar c" + compression_modifier + "f data.tar" + + compression_suffix; // now add all directories which have to be compressed // collect all top level install dirs for that @@ -493,9 +523,7 @@ int cmCPackDebGenerator::createDeb() { cmd = this->GetOption("CPACK_DEBIAN_FAKEROOT_EXECUTABLE"); } - cmd += " \""; - cmd += cmakeExecutable; - cmd += "\" -E tar cfz control.tar.gz ./control ./md5sums"; + cmd += cmake_tar + "tar czf control.tar.gz ./control ./md5sums"; const char* controlExtra = this->GetOption("CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA"); if( controlExtra ) @@ -514,7 +542,7 @@ int cmCPackDebGenerator::createDeb() if( cmsys::SystemTools::CopyFileIfDifferent( i->c_str(), localcopy.c_str()) ) { - // debian is picky and need relative to ./ path in the tar.gz + // debian is picky and need relative to ./ path in the tar.* cmd += " ./"; cmd += filenamename; } @@ -538,7 +566,7 @@ int cmCPackDebGenerator::createDeb() return 0; } - // ar -r your-package-name.deb debian-binary control.tar.gz data.tar.gz + // ar -r your-package-name.deb debian-binary control.tar.* data.tar.* // since debian packages require BSD ar (most Linux distros and even // FreeBSD and NetBSD ship GNU ar) we use a copy of OpenBSD ar here. std::vector arFiles; @@ -546,7 +574,7 @@ int cmCPackDebGenerator::createDeb() topLevelString += "/"; arFiles.push_back(topLevelString + "debian-binary"); arFiles.push_back(topLevelString + "control.tar.gz"); - arFiles.push_back(topLevelString + "data.tar.gz"); + arFiles.push_back(topLevelString + "data.tar" + compression_suffix); std::string outputFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); outputFileName += "/"; outputFileName += this->GetOption("CPACK_OUTPUT_FILE_NAME"); From 16caa6ecba698e08cb1b2608aa479b7484cad73a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 14 Mar 2014 09:34:14 -0400 Subject: [PATCH 195/278] Help: Add release notes for topic 'cpack-deb-compression-types' --- Help/release/dev/cpack-deb-compression-types.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/cpack-deb-compression-types.rst diff --git a/Help/release/dev/cpack-deb-compression-types.rst b/Help/release/dev/cpack-deb-compression-types.rst new file mode 100644 index 000000000..a33e3331a --- /dev/null +++ b/Help/release/dev/cpack-deb-compression-types.rst @@ -0,0 +1,6 @@ +cpack-deb-compression-types +--------------------------- + +* The :module:`CPackDeb` module learned a new + :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the + tarball compression type. From 3a7501d9eb7e1a22a8c4161c88008c7929451554 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 14 Mar 2014 10:31:30 -0400 Subject: [PATCH 196/278] Help: Add release notes for topic 'ctest-intel-coverage' --- Help/release/dev/ctest-intel-coverage.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/ctest-intel-coverage.rst diff --git a/Help/release/dev/ctest-intel-coverage.rst b/Help/release/dev/ctest-intel-coverage.rst new file mode 100644 index 000000000..11455a50a --- /dev/null +++ b/Help/release/dev/ctest-intel-coverage.rst @@ -0,0 +1,5 @@ +ctest-intel-coverage +-------------------- + +* The :command:`ctest_coverage` command learned to support + Intel coverage files with the ``codecov`` tool. From 91fd99b86532dbf35d8c7396654b9beac058c8f3 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 14 Mar 2014 08:47:37 -0600 Subject: [PATCH 197/278] Encoding: Provide option to configure CMake to use UTF-8 encoding. --- CMakeLists.txt | 7 +++++++ Source/CMakeLists.txt | 5 +++++ Source/QtDialog/CMakeLists.txt | 5 ----- Source/QtDialog/CMakeSetup.cxx | 2 +- Source/cmConfigure.cmake.h.in | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f8301505..b0793d028 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,13 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") endmacro() endif() +# option to set the internal encoding of CMake to UTF-8 +option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally (experimental)." OFF) +mark_as_advanced(CMAKE_ENCODING_UTF8) +if(CMAKE_ENCODING_UTF8) + set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8) +endif() + #----------------------------------------------------------------------- # a macro to deal with system libraries, implemented as a macro # simply to improve readability of the main script diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 966e0f68c..9fb8d9a4c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -24,6 +24,11 @@ endif() set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) +# ensure Unicode friendly APIs are used on Windows +if(WIN32) + add_definitions(-DUNICODE -D_UNICODE) +endif() + # configure the .h file configure_file( "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 0dd01d848..4308a4d6f 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -55,11 +55,6 @@ else() endif() endif() - -if(WIN32 AND KWSYS_ENCODING_DEFAULT_CODEPAGE MATCHES CP_UTF8) - add_definitions(-DKWSYS_CP_UTF8) -endif() - set(SRCS AddCacheEntry.cxx AddCacheEntry.h diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 995929e3b..e37bd9d0b 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -79,7 +79,7 @@ int main(int argc, char** argv) QApplication app(argc, argv); -#if defined(KWSYS_CP_UTF8) +#if defined(CMAKE_ENCODING_UTF8) QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); QTextCodec::setCodecForCStrings(utf8_codec); QTextCodec::setCodecForLocale(utf8_codec); diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index c5e95d0ca..2b0280db5 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -16,4 +16,5 @@ #cmakedefine HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER +#cmakedefine CMAKE_ENCODING_UTF8 #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" From ee8cef8725486519a7ab47eb16208d4d64e0ab99 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 14 Mar 2014 08:48:42 -0600 Subject: [PATCH 198/278] Encoding: If configured, write Visual Studio project files as UTF-8. --- Source/cmGlobalVisualStudio7Generator.cxx | 14 +++++++++++++- Source/cmGlobalVisualStudio7Generator.h | 3 +++ Source/cmGlobalVisualStudioGenerator.cxx | 3 ++- Source/cmLocalVisualStudio7Generator.cxx | 12 ++++++++---- Source/cmVisualStudio10TargetGenerator.cxx | 6 ++++-- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 320b4403a..42033c5be 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -873,7 +873,8 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) std::string guid = this->GetGUID(pname.c_str()); fout << - "\n" + "Encoding() << "\"?>\n" "GetIDEVersion() << "0\"\n" @@ -1038,3 +1039,14 @@ cmIDEFlagTable const* cmGlobalVisualStudio7Generator::GetExtraFlagTableVS7() { return cmVS7ExtraFlagTable; } + +std::string cmGlobalVisualStudio7Generator::Encoding() +{ + std::ostringstream encoding; +#ifdef CMAKE_ENCODING_UTF8 + encoding << "UTF-8"; +#else + encoding << "Windows-1252"; +#endif + return encoding.str(); +} diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 0d2e410c8..1dc709ddd 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -109,6 +109,9 @@ public: virtual void FindMakeProgram(cmMakefile*); + // Encoding for Visual Studio files + virtual std::string Encoding(); + protected: virtual const char* GetIDEVersion() { return "7.0"; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 69c893cc8..2b2a4715c 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -1,3 +1,4 @@ + /*============================================================================ CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc., Insight Software Consortium @@ -918,4 +919,4 @@ std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( i += config.size(); } return tmp; -} +} \ No newline at end of file diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 14ad56778..52524aa57 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1975,7 +1975,8 @@ cmLocalVisualStudio7Generator cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); - fout << "\n" + fout << "Encoding() << "\"?>\n" << "GetIntelProjectVersion() << "\"\n"; @@ -2038,7 +2039,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, this->WriteProjectStartFortran(fout, libName, target); return; } - fout << "\n" + + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); + + fout << "Encoding() << "\"?>\n" << "Version == VS71) @@ -2059,8 +2065,6 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { keyword = "Win32Proj"; } - cmGlobalVisualStudio7Generator* gg = - static_cast(this->GlobalGenerator); fout << "\tName=\"" << projLabel << "\"\n"; if(this->Version >= VS8) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7c55f645e..8e8968d9e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -222,7 +222,8 @@ void cmVisualStudio10TargetGenerator::Generate() //get the tools version to use const std::string toolsVer(this->GlobalGenerator->GetToolsVersion()); std::string project_defaults= - "\n"; + "GlobalGenerator->Encoding() + "\"?>\n"; project_defaults.append("GlobalGenerator->GetToolsVersion()); std::string project_defaults= - "\n"; + "GlobalGenerator->Encoding() + "\"?>\n"; project_defaults.append(" Date: Sat, 15 Mar 2014 00:01:11 -0400 Subject: [PATCH 199/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 040cd273d..6a8a82300 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140314) +set(CMake_VERSION_PATCH 20140315) #set(CMake_VERSION_RC 1) From c481fadc07e72193f16a4f1fb9d477db133f1120 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 14 Mar 2014 11:02:47 +0100 Subject: [PATCH 200/278] cmGeneratorTarget: Don't store ObjectSources for object libraries. Compute them on demand instead. --- Source/cmGeneratorTarget.cxx | 10 ++++------ Source/cmGeneratorTarget.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8efd7bb52..2a144c6b2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -310,10 +310,6 @@ cmGeneratorTarget ::GetObjectSources(std::vector &data) const { IMPLEMENT_VISIT(ObjectSources); - if (this->Target->GetType() == cmTarget::OBJECT_LIBRARY) - { - this->ObjectSources = data; - } } //---------------------------------------------------------------------------- @@ -577,9 +573,11 @@ cmGeneratorTarget::UseObjectLibraries(std::vector& objs) const cmTarget* objLib = *ti; cmGeneratorTarget* ogt = this->GlobalGenerator->GetGeneratorTarget(objLib); + std::vector objectSources; + ogt->GetObjectSources(objectSources); for(std::vector::const_iterator - si = ogt->ObjectSources.begin(); - si != ogt->ObjectSources.end(); ++si) + si = objectSources.begin(); + si != objectSources.end(); ++si) { std::string obj = ogt->ObjectDirectory; obj += ogt->Objects[*si]; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 139e736c8..53e27c510 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -127,7 +127,6 @@ private: std::map Objects; std::set ExplicitObjectName; - mutable std::vector ObjectSources; std::vector ObjectLibraries; mutable std::map > SystemIncludesCache; From 6c9dd0ec7b1e000b0bedd567fa52074671d639c9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 11 Mar 2014 20:39:01 +0100 Subject: [PATCH 201/278] cmGlobalGenerator: Make ComputeTargetObjects non-virtual Implement it in terms of the ComputeObjectFilenames virtual method on the local generators. Remove the reimplementation from the global generators which are now all functionally identical. --- Source/cmGlobalGenerator.cxx | 21 ++++++++++++++++++-- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalNinjaGenerator.cxx | 23 ---------------------- Source/cmGlobalNinjaGenerator.h | 2 -- Source/cmGlobalUnixMakefileGenerator3.cxx | 24 ----------------------- Source/cmGlobalUnixMakefileGenerator3.h | 1 - Source/cmGlobalVisualStudioGenerator.cxx | 24 ----------------------- Source/cmGlobalVisualStudioGenerator.h | 1 - Source/cmGlobalXCodeGenerator.cxx | 24 ----------------------- Source/cmGlobalXCodeGenerator.h | 1 - 10 files changed, 20 insertions(+), 103 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c9ae79937..5b6d729d5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1516,9 +1516,26 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const } //---------------------------------------------------------------------------- -void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const +void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const { - // Implemented in generator subclasses that need this. + std::vector objectSources; + gt->GetObjectSources(objectSources); + + std::map mapping; + for(std::vector::const_iterator it + = objectSources.begin(); it != objectSources.end(); ++it) + { + mapping[*it]; + } + + gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); + + for(std::map::const_iterator it + = mapping.begin(); it != mapping.end(); ++it) + { + assert(!it->second.empty()); + gt->AddObject(it->first, it->second); + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ed07b10cc..49a418d73 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -443,7 +443,7 @@ private: void CreateGeneratorTargets(cmMakefile* mf); void CreateGeneratorTargets(); void ComputeGeneratorTargetObjects(); - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; + void ComputeTargetObjects(cmGeneratorTarget* gt) const; void ClearGeneratorMembers(); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 08507eb5e..49ce1b52a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -632,29 +632,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const return cmSystemTools::GetCMakeGUICommand(); } -// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl. -void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::vector objectSources; - gt->GetObjectSources(objectSources); - - std::map mapping; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - for(std::map::const_iterator it - = mapping.begin(); it != mapping.end(); ++it) - { - assert(!it->second.empty()); - gt->AddObject(it->first, it->second); - } -} - //---------------------------------------------------------------------------- void cmGlobalNinjaGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index e3a22e57c..f2643af2d 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -310,8 +310,6 @@ protected: private: virtual std::string GetEditCacheCommand() const; - /// @see cmGlobalGenerator::ComputeTargetObjects - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; void OpenBuildFileStream(); void CloseBuildFileStream(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 91258ed0d..4632071bf 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -103,30 +103,6 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const return edit_cmd? edit_cmd : ""; } -//---------------------------------------------------------------------------- -void -cmGlobalUnixMakefileGenerator3 -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::vector objectSources; - gt->GetObjectSources(objectSources); - - std::map mapping; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - for(std::map::const_iterator it - = mapping.begin(); it != mapping.end(); ++it) - { - gt->AddObject(it->first, it->second); - } -} - //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3 diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 42453f281..d003789eb 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -199,7 +199,6 @@ protected: private: virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; } virtual std::string GetEditCacheCommand() const; - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; }; #endif diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 9740fbfb8..749517c60 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -117,30 +117,6 @@ void cmGlobalVisualStudioGenerator::Generate() this->cmGlobalGenerator::Generate(); } -//---------------------------------------------------------------------------- -void -cmGlobalVisualStudioGenerator -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::vector objectSources; - gt->GetObjectSources(objectSources); - - std::map mapping; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - for(std::map::const_iterator it - = mapping.begin(); it != mapping.end(); ++it) - { - gt->AddObject(it->first, it->second); - } -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudioGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index f957056b2..1ab899097 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -117,7 +117,6 @@ private: virtual std::string GetVSMakeProgram() = 0; void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} - void ComputeTargetObjects(cmGeneratorTarget* gt) const; void FollowLinkDepends(cmTarget const* target, std::set& linked); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0a4b51cdc..d4eb85bc6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3934,30 +3934,6 @@ bool cmGlobalXCodeGenerator::IsMultiConfig() return true; } - //---------------------------------------------------------------------------- -void -cmGlobalXCodeGenerator -::ComputeTargetObjects(cmGeneratorTarget* gt) const -{ - std::vector objectSources; - gt->GetObjectSources(objectSources); - - std::map mapping; - for(std::vector::const_iterator it - = objectSources.begin(); it != objectSources.end(); ++it) - { - mapping[*it]; - } - - gt->LocalGenerator->ComputeObjectFilenames(mapping, gt); - - for(std::map::const_iterator it - = mapping.begin(); it != mapping.end(); ++it) - { - gt->AddObject(it->first, it->second); - } -} - //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index f9dd58f97..23616b4f9 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -217,7 +217,6 @@ protected: private: void PrintCompilerAdvice(std::ostream&, std::string const&, const char*) const {} - void ComputeTargetObjects(cmGeneratorTarget* gt) const; std::string GetObjectsNormalDirectory( const std::string &projName, From 7d6d45f23c25355f1da0ad9fcd9e45cdb05194f8 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Sat, 15 Mar 2014 22:56:47 +0100 Subject: [PATCH 202/278] CheckTypeSize: Support for CXX when C language is not enabled This example now works without need to enable C language: cmake_minimum_required(VERSION x.x.x) project(foo CXX) include(CheckTypeSize) check_type_size("short" SIZEOF_SHORT LANGUAGE CXX) Fixes #14056 --- Modules/CheckTypeSize.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index ec28d8b6f..333b325f8 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -75,6 +75,7 @@ # License text for the above reference.) include(CheckIncludeFile) +include(CheckIncludeFileCXX) cmake_policy(PUSH) cmake_minimum_required(VERSION 2.6 FATAL_ERROR) @@ -218,9 +219,15 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) set(_builtin 0) else() set(_builtin 1) - check_include_file(sys/types.h HAVE_SYS_TYPES_H) - check_include_file(stdint.h HAVE_STDINT_H) - check_include_file(stddef.h HAVE_STDDEF_H) + if("${_language}" STREQUAL "C") + check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(stdint.h HAVE_STDINT_H) + check_include_file(stddef.h HAVE_STDDEF_H) + elseif("${_language}" STREQUAL "CXX") + check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H) + check_include_file_cxx(stdint.h HAVE_STDINT_H) + check_include_file_cxx(stddef.h HAVE_STDDEF_H) + endif() endif() unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY) unset(_CHECK_TYPE_SIZE_LANGUAGE) From 2eb158caf0bee12d5d74e0b50b9ea2bad9a0c7fc Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 16 Mar 2014 00:01:05 -0400 Subject: [PATCH 203/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6a8a82300..5ed534b77 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140315) +set(CMake_VERSION_PATCH 20140316) #set(CMake_VERSION_RC 1) From 6313be44aa465ea883e3578b3a0424ae0c217d5c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 17 Mar 2014 00:01:05 -0400 Subject: [PATCH 204/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5ed534b77..562040a72 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140316) +set(CMake_VERSION_PATCH 20140317) #set(CMake_VERSION_RC 1) From ea17a03be5794a934991b1f958cab12b7011da74 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 15 Mar 2014 11:07:57 +0100 Subject: [PATCH 205/278] cmTarget: Port _LOCATION support to updated string APIs --- Source/cmTarget.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c07fd0f24..17c8a4d82 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2673,7 +2673,7 @@ const char *cmTarget::GetProperty(const std::string& prop, // Support "_LOCATION". if(cmHasLiteralSuffix(prop, "_LOCATION")) { - std::string configName(prop, strlen(prop) - 9); + std::string configName(prop.c_str(), prop.size() - 9); if(configName != "IMPORTED") { if (!this->HandleLocationPropertyPolicy()) @@ -2681,7 +2681,7 @@ const char *cmTarget::GetProperty(const std::string& prop, return 0; } this->Properties.SetProperty(prop, - this->GetLocation(configName.c_str()), + this->GetLocation(configName), cmProperty::TARGET); } } From 3df5147043d83aa09acd5c9ce31d5c602efb99db Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 6 Mar 2014 18:55:04 +0100 Subject: [PATCH 206/278] FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables (#12926) Use CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment variables to extend PKG_CONFIG_PATH before calling pkg-config. In each of the path in these variables it searches for lib/pkgconfig. Then, depending on the system, it searches for lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig (debian) or for lib64/pkgconfig (other 64 bit unixes). If any of these path is found, it is appended to the PKG_CONFIG_PATH enviromnent variable. Add two new arguments to the pkg_check_module and pkg_search_module macro, NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH. The new signature are therefore: pkg_check_modules( [REQUIRED] [QUIET] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] []*) pkg_search_module( [REQUIRED] [QUIET] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] []*) By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later (in order to keep compatibility with the previous behavior), or if PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set, the CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment variables will be added to pkgconfig search path. The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this behavior for the cache variables and the environment variables, respectively, similarly to the find_package() command. --- Modules/FindPkgConfig.cmake | 158 +++++++++++++++++- Tests/RunCMake/CMakeLists.txt | 5 + Tests/RunCMake/FindPkgConfig/CMakeLists.txt | 3 + .../FindPkgConfig_PKGCONFIG_PATH.cmake | 51 ++++++ .../RunCMake/FindPkgConfig/RunCMakeTest.cmake | 3 + .../FindPkgConfig/dummy-pkg-config.bat | 16 ++ .../FindPkgConfig/dummy-pkg-config.sh | 20 +++ .../lib/i386-linux-gnu/pkgconfig/.placeholder | 0 .../pc-bar/lib/pkgconfig/.placeholder | 0 .../x86_64-linux-gnu/pkgconfig/.placeholder | 0 .../pc-bar/lib64/pkgconfig/.placeholder | 0 .../lib/i386-linux-gnu/pkgconfig/.placeholder | 0 .../pc-foo/lib/pkgconfig/.placeholder | 0 .../x86_64-linux-gnu/pkgconfig/.placeholder | 0 .../pc-foo/lib64/pkgconfig/.placeholder | 0 15 files changed, 248 insertions(+), 8 deletions(-) create mode 100644 Tests/RunCMake/FindPkgConfig/CMakeLists.txt create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake create mode 100644 Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake create mode 100755 Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat create mode 100755 Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder create mode 100644 Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index b0ceb2b24..812bb922f 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -99,9 +99,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) endmacro() # Splits given arguments into options and a package list -macro(_pkgconfig_parse_options _result _is_req _is_silent) +macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path) set(${_is_req} 0) set(${_is_silent} 0) + set(${_no_cmake_path} 0) + set(${_no_cmake_environment_path} 0) + if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH) + if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH) + set(${_no_cmake_path} 1) + set(${_no_cmake_environment_path} 1) + endif() + elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1) + set(${_no_cmake_path} 1) + set(${_no_cmake_environment_path} 1) + endif() foreach(_pkg ${ARGN}) if (_pkg STREQUAL "REQUIRED") @@ -110,15 +121,23 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent) if (_pkg STREQUAL "QUIET") set(${_is_silent} 1) endif () + if (_pkg STREQUAL "NO_CMAKE_PATH") + set(${_no_cmake_path} 1) + endif() + if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH") + set(${_no_cmake_environment_path} 1) + endif() endforeach() set(${_result} ${ARGN}) list(REMOVE_ITEM ${_result} "REQUIRED") list(REMOVE_ITEM ${_result} "QUIET") + list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH") + list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH") endmacro() ### -macro(_pkg_check_modules_internal _is_required _is_silent _prefix) +macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix) _pkgconfig_unset(${_prefix}_FOUND) _pkgconfig_unset(${_prefix}_VERSION) _pkgconfig_unset(${_prefix}_PREFIX) @@ -157,6 +176,95 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) set(_pkg_check_modules_packages) set(_pkg_check_modules_failed) + set(_extra_paths) + + if(NOT _no_cmake_path) + if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "") + list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) + endif() + if(NOT "${CMAKE_FRAMEWORK_PATH}" STREQUAL "") + list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) + endif() + if(NOT "${CMAKE_APPBUNDLE_PATH}" STREQUAL "") + list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) + endif() + endif() + + if(NOT _no_cmake_environment_path) + if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _path) + list(APPEND _extra_paths ${_path}) + unset(_path) + endif() + if(NOT "$ENV{CMAKE_FRAMEWORK_PATH}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _path) + list(APPEND _extra_paths ${_path}) + unset(_path) + endif() + if(NOT "$ENV{CMAKE_APPBUNDLE_PATH}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{CMAKE_APPBUNDLE_PATH}" _path) + list(APPEND _extra_paths ${_path}) + unset(_path) + endif() + endif() + + if(NOT "${_extra_paths}" STREQUAL "") + # Save the PKG_CONFIG_PATH environment variable, and add paths + # from the CMAKE_PREFIX_PATH variables + set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH}) + set(_pkgconfig_path ${_pkgconfig_path_old}) + if(NOT "${_pkgconfig_path}" STREQUAL "") + file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path) + endif() + + # Create a list of the possible pkgconfig subfolder (depending on + # the system + set(_lib_dirs) + if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE) + list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + list(APPEND _lib_dirs "lib64/pkgconfig") + endif() + endif() + endif() + list(APPEND _lib_dirs "lib/pkgconfig") + + # Check if directories exist and eventually append them to the + # pkgconfig path list + foreach(_prefix_dir ${_extra_paths}) + foreach(_lib_dir ${_lib_dirs}) + if(EXISTS "${_prefix_dir}/${_lib_dir}") + list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}") + list(REMOVE_DUPLICATES _pkgconfig_path) + endif() + endforeach() + endforeach() + + # Prepare and set the environment variable + if(NOT "${_pkgconfig_path}" STREQUAL "") + # remove empty values from the list + list(REMOVE_ITEM _pkgconfig_path "") + file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path) + if(UNIX) + string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}") + string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}") + endif() + set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + endif() + + # Unset variables + unset(_lib_dirs) + unset(_pkgconfig_path) + endif() + # iterate through module list and check whether they exist and match the required version foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) set(_pkg_check_modules_exist_query) @@ -260,6 +368,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) endif() + + if(NOT "${_extra_paths}" STREQUAL "") + # Restore the environment variable + set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path}) + endif() + + unset(_extra_paths) + unset(_pkgconfig_path_old) else() if (${_is_required}) message(SEND_ERROR "pkg-config tool not found") @@ -276,13 +392,25 @@ endmacro() Checks for all the given modules. :: - pkg_check_modules( [REQUIRED] [QUIET] []*) + pkg_check_modules( [REQUIRED] [QUIET] + [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] + []*) + When the ``REQUIRED`` argument was set, macros will fail with an error when module(s) could not be found. When the ``QUIET`` argument is set, no status messages will be printed. + By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or + later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the + :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and + :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will + be added to ``pkg-config`` search path. + The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments + disable this behavior for the cache variables and the environment + variables, respectively. + It sets the following variables: :: PKG_CONFIG_FOUND ... if pkg-config executable was found @@ -362,8 +490,8 @@ endmacro() macro(pkg_check_modules _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) - _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) - _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules}) + _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN}) + _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules}) _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) endif() @@ -376,7 +504,9 @@ endmacro() Same as :command:`pkg_check_modules`, but instead it checks for given modules and uses the first working one. :: - pkg_search_module( [REQUIRED] [QUIET] []*) + pkg_search_module( [REQUIRED] [QUIET] + [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] + []*) Examples @@ -388,7 +518,7 @@ macro(pkg_search_module _prefix _module0) # check cached value if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) set(_pkg_modules_found 0) - _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN}) + _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN}) if (NOT ${_pkg_is_silent}) message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") @@ -397,7 +527,7 @@ macro(pkg_search_module _prefix _module0) # iterate through all modules and stop at the first working one. foreach(_pkg_alt ${_pkg_modules_alt}) if(NOT _pkg_modules_found) - _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") + _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}") endif() if (${_prefix}_FOUND) @@ -420,6 +550,18 @@ endmacro() .. variable:: PKG_CONFIG_EXECUTABLE Path to the pkg-config executable. + + +.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH + + Whether :command:`pkg_check_modules` and :command:`pkg_search_module` + should add the paths in :variable:`CMAKE_PREFIX_PATH`, + :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH` + cache and environment variables to ``pkg-config`` search path. + + If this variable is not set, this behavior is enabled by default if + :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled + otherwise. #]========================================] diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d401a932d..c7091d669 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -106,6 +106,11 @@ if (QT4_FOUND) add_RunCMake_test(ObsoleteQtMacros) endif() +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + add_RunCMake_test(FindPkgConfig) +endif() + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio [^6]") add_RunCMake_test(include_external_msproject) add_RunCMake_test(SolutionGlobalSections) diff --git a/Tests/RunCMake/FindPkgConfig/CMakeLists.txt b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt new file mode 100644 index 000000000..72abfc809 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.11) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake new file mode 100644 index 000000000..5f9913f79 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules (FOO "${expected_path}") + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake new file mode 100644 index 000000000..ad77ad06e --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(FindPkgConfig_PKGCONFIG_PATH) diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat new file mode 100755 index 000000000..b2096edc6 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat @@ -0,0 +1,16 @@ +@ECHO OFF +IF "%1"=="" ( + EXIT /B 255 +) +IF "%1"=="--version" ( + ECHO 0.0-cmake-dummy + EXIT /B 0 +) + +IF "%1"=="--exists" ( + SHIFT + IF NOT "%*"=="%PKG_CONFIG_PATH%" ( + EXIT /B 1 + ) +) +EXIT /B 0 diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh new file mode 100755 index 000000000..e62bb749b --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# This is a replacement for pkg-config that compares the string passed +# to the --exists argument with the PKG_CONFIG_PATH environment variable +# and returns 1 if they are different. + +case $1 in + --version) + echo "0.0-cmake-dummy" + ;; + --exists) + shift + echo "$@" + echo "${PKG_CONFIG_PATH}" + [ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1 + ;; + *) + exit 255 + ;; +esac diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/i386-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib/x86_64-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-bar/lib64/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/i386-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib/x86_64-linux-gnu/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder b/Tests/RunCMake/FindPkgConfig/pc-foo/lib64/pkgconfig/.placeholder new file mode 100644 index 000000000..e69de29bb From fbc883c94237a488084e863a79e5301c12171aa6 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Sun, 16 Mar 2014 12:35:18 +0100 Subject: [PATCH 207/278] Watcom: Add one blank line to Makefile for better readability --- Source/cmLocalUnixMakefileGenerator3.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2d3608925..d3836df4d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -829,6 +829,7 @@ cmLocalUnixMakefileGenerator3 "!ifndef VERBOSE\n" ".SILENT\n" "!endif\n" + "\n" ; } else From d83ef53a1293899c0ab58aca184b7d5866051876 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Mar 2014 15:27:01 +0100 Subject: [PATCH 208/278] Rename local 'dir_max' variables to 'dir' The code is not computing the maximum length directory, as is the case in cmLocalVisualStudioGenerator::ComputeLongestObjectDirectory. --- Source/cmGlobalNinjaGenerator.cxx | 12 ++++++------ Source/cmGlobalUnixMakefileGenerator3.cxx | 12 ++++++------ Source/cmLocalUnixMakefileGenerator3.cxx | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 49ce1b52a..88f1b08f0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -639,12 +639,12 @@ void cmGlobalNinjaGenerator cmTarget* target = gt->Target; // Compute full path to object file directory for this target. - std::string dir_max; - dir_max += gt->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += gt->LocalGenerator->GetTargetDirectory(*target); - dir_max += "/"; - gt->ObjectDirectory = dir_max; + std::string dir; + dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + dir += gt->LocalGenerator->GetTargetDirectory(*target); + dir += "/"; + gt->ObjectDirectory = dir; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 4632071bf..e37ee10ed 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -111,12 +111,12 @@ cmGlobalUnixMakefileGenerator3 cmTarget* target = gt->Target; // Compute full path to object file directory for this target. - std::string dir_max; - dir_max += gt->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += gt->LocalGenerator->GetTargetDirectory(*target); - dir_max += "/"; - gt->ObjectDirectory = dir_max; + std::string dir; + dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + dir += gt->LocalGenerator->GetTargetDirectory(*target); + dir += "/"; + gt->ObjectDirectory = dir; } void cmGlobalUnixMakefileGenerator3::Configure() diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2d3608925..6e2e6a818 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -202,11 +202,11 @@ GetLocalObjectFiles(std::map &localObjectFiles) std::vector objectSources; gt->GetObjectSources(objectSources); // Compute full path to object file directory for this target. - std::string dir_max; - dir_max += gt->Makefile->GetCurrentOutputDirectory(); - dir_max += "/"; - dir_max += this->GetTargetDirectory(*gt->Target); - dir_max += "/"; + std::string dir; + dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + dir += this->GetTargetDirectory(*gt->Target); + dir += "/"; // Compute the name of each object file. for(std::vector::iterator si = objectSources.begin(); @@ -215,7 +215,7 @@ GetLocalObjectFiles(std::map &localObjectFiles) cmSourceFile const* sf = *si; bool hasSourceExtension = true; std::string objectName = this->GetObjectFileNameWithoutTarget(*sf, - dir_max, + dir, &hasSourceExtension); if(cmSystemTools::FileIsFullPath(objectName.c_str())) { From 2e0611f981f17889cb701db2ffd9436c771bb7e1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Mar 2014 15:29:49 +0100 Subject: [PATCH 209/278] cmGeneratorExpression: Remove unused include. --- Source/cmGeneratorExpression.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 5b97e8b2a..d0a6aef5f 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -16,8 +16,6 @@ #include "cmStandardIncludes.h" #include "cmListFileCache.h" -#include - #include #include From c3a2f78b5a322bd14123cb301dc62dc3b58073b5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Mar 2014 15:32:19 +0100 Subject: [PATCH 210/278] Makefiles: Remove duplicate code. The cmGlobalUnixMakefileGenerator3::ProgressMapCompare struct is logically equivalent to cmStrictTargetComparison. --- Source/cmGlobalUnixMakefileGenerator3.cxx | 15 --------------- Source/cmGlobalUnixMakefileGenerator3.h | 4 +--- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index e37ee10ed..3aa293e73 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -957,21 +957,6 @@ cmGlobalUnixMakefileGenerator3::RecordTargetProgress( tp.VariableFile = tg->GetProgressFileNameFull(); } -//---------------------------------------------------------------------------- -bool -cmGlobalUnixMakefileGenerator3::ProgressMapCompare -::operator()(cmTarget const* l, cmTarget const* r) const -{ - // Order by target name. - if(int c = strcmp(l->GetName().c_str(), r->GetName().c_str())) - { - return c < 0; - } - // Order duplicate targets by binary directory. - return strcmp(l->GetMakefile()->GetCurrentOutputDirectory(), - r->GetMakefile()->GetCurrentOutputDirectory()) < 0; -} - //---------------------------------------------------------------------------- void cmGlobalUnixMakefileGenerator3::TargetProgress diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index d003789eb..f44dd124a 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -185,10 +185,8 @@ protected: std::vector Marks; void WriteProgressVariables(unsigned long total, unsigned long& current); }; - struct ProgressMapCompare { bool operator()(cmTarget const*, - cmTarget const*) const; }; typedef std::map ProgressMapType; + cmStrictTargetComparison> ProgressMapType; ProgressMapType ProgressMap; size_t CountProgressMarksInTarget(cmTarget const* target, From 10e6f1e716758c5ad5dcb63a5c69551ff3b9f6ff Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Mar 2014 15:33:54 +0100 Subject: [PATCH 211/278] cmMakefile: Fix typo in comment. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 58625fbc1..f3123993a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2071,7 +2071,7 @@ cmMakefile::LinearGetSourceFileWithOutput(const std::string& name) const // does this source file have a custom command? if ((*i)->GetCustomCommand()) { - // is the output of the custom command match the source files name + // Does the output of the custom command match the source file name? const std::vector& outputs = (*i)->GetCustomCommand()->GetOutputs(); for(std::vector::const_iterator o = outputs.begin(); From 19012b4652953ea8d8a470d1790419b1d8682850 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 17 Mar 2014 15:34:53 +0100 Subject: [PATCH 212/278] cmMakefile: Fix style. Use this-> for member access. --- Source/cmMakefile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f3123993a..f390237bc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2101,7 +2101,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput( // linear-time search for an output with a matching suffix. if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(name); + return this->LinearGetSourceFileWithOutput(name); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); From 413282c0cfb0bafc6ab325c6d4798e4765e021fa Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Mar 2014 11:05:34 -0400 Subject: [PATCH 213/278] file: Avoid runaway DOWNLOAD/UPLOAD progress reports (#14807) Curl makes progress callbacks frequently but we round to the nearest percent and report only when that changes so that we make at most 101 progress reports. However, when unexpected data beyond the total are transferred the progress can get beyond 100% and lead to unlimited reports. Avoid this case by capping the reported progress to 100%. --- Source/cmFileCommand.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9fabdc753..5bfb66454 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2539,6 +2539,11 @@ namespace { if (total > 0.0) { this->CurrentPercentage = static_cast(value/total*100.0 + 0.5); + if(this->CurrentPercentage > 100) + { + // Avoid extra progress reports for unexpected data beyond total. + this->CurrentPercentage = 100; + } } bool updated = (OldPercentage != this->CurrentPercentage); From 7d35b550605596b441af65e96be320ab7d33acc1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Mar 2014 11:24:20 -0400 Subject: [PATCH 214/278] ExternalProject: Add option to disable download progress (#14807) Add a DOWNLOAD_NO_PROGRESS option to disable progress reports while downloading source tarballs. --- Modules/ExternalProject.cmake | 14 +++++++++++--- Tests/ExternalProject/CMakeLists.txt | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1e8316319..8235dda53 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -20,6 +20,7 @@ # [DOWNLOAD_NAME fname] # File name to store (if not end of URL) # [DOWNLOAD_DIR dir] # Directory to store downloaded files # [DOWNLOAD_COMMAND cmd...] # Command to download source tree +# [DOWNLOAD_NO_PROGRESS 1] # Disable download progress reports # [CVS_REPOSITORY cvsroot] # CVSROOT of CVS repository # [CVS_MODULE mod] # Module to checkout from CVS repo # [CVS_TAG tag] # Tag to checkout from CVS repo @@ -515,7 +516,7 @@ endif() endfunction(_ep_write_gitupdate_script) -function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) +function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -524,6 +525,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash set(timeout_msg "none") endif() + if(no_progress) + set(show_progress "") + else() + set(show_progress "SHOW_PROGRESS") + endif() + if("${hash}" MATCHES "${_ep_hash_regex}") set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) else() @@ -563,7 +570,7 @@ ${tls_cainfo} file(DOWNLOAD \"${remote}\" \"${local}\" - SHOW_PROGRESS + ${show_progress} ${hash_args} ${timeout_args} STATUS status @@ -1443,10 +1450,11 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) + get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS) get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) set(download_script "${stamp_dir}/download-${name}.cmake") - _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") + _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}") set(cmd ${CMAKE_COMMAND} -P "${download_script}" COMMAND) set(retries 3) diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index d9344eca2..0ed556163 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -98,6 +98,7 @@ ExternalProject_Add(${proj} CVS_TAG "" DEPENDS "MinimalNoOpProject" NonExternalProjectTarget DOWNLOAD_COMMAND "" + DOWNLOAD_NO_PROGRESS 1 INSTALL_COMMAND "" PATCH_COMMAND "" STEP_TARGETS install update From 7f857775e212436dbca623a4bfe37a20c6c98e0a Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 17 Mar 2014 17:36:14 +0100 Subject: [PATCH 215/278] CheckTypeSize: Add unit test to cover the no-C case --- Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake | 4 ++++ Tests/RunCMake/CheckModules/RunCMakeTest.cmake | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake diff --git a/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake b/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake new file mode 100644 index 000000000..b2dcd7f9b --- /dev/null +++ b/Tests/RunCMake/CheckModules/CheckTypeSizeOkNoC.cmake @@ -0,0 +1,4 @@ +enable_language(CXX) +include(CheckTypeSize) +check_type_size(int SIZEOF_INT LANGUAGE CXX) +check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE CXX) diff --git a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake index fda7ebff3..5b4e57edc 100644 --- a/Tests/RunCMake/CheckModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CheckModules/RunCMakeTest.cmake @@ -12,3 +12,5 @@ run_cmake(CheckTypeSizeUnknownLanguage) run_cmake(CheckTypeSizeMissingLanguage) run_cmake(CheckTypeSizeUnknownArgument) run_cmake(CheckTypeSizeMixedArgs) + +run_cmake(CheckTypeSizeOkNoC) From 453d2b2438a1c9e8a21e89addf446f5bec3a4000 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 17 Mar 2014 17:50:29 +0100 Subject: [PATCH 216/278] FindPkgConfig: small refactoring --- Modules/FindPkgConfig.cmake | 55 +++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 812bb922f..286cc2366 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -136,6 +136,31 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cma list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH") endmacro() +# Add the content of a variable or an environment variable to a list of +# paths +# Usage: +# - _pkgconfig_add_extra_path(_extra_paths VAR) +# - _pkgconfig_add_extra_path(_extra_paths ENV VAR) +function(_pkgconfig_add_extra_path _extra_paths_var _var) + set(_is_env 0) + if(_var STREQUAL "ENV") + set(_var ${ARGV2}) + set(_is_env 1) + endif() + if(NOT _is_env) + if(NOT "${${_var}}" STREQUAL "") + list(APPEND ${_extra_paths_var} ${CMAKE_PREFIX_PATH}) + endif() + else() + if(NOT "$ENV{${_var}}" STREQUAL "") + file(TO_CMAKE_PATH "$ENV{${_var}}" _path) + list(APPEND ${_extra_paths_var} ${_path}) + unset(_path) + endif() + endif() + set(${_extra_paths_var} ${${_extra_paths_var}} PARENT_SCOPE) +endfunction() + ### macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix) _pkgconfig_unset(${_prefix}_FOUND) @@ -179,33 +204,15 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma set(_extra_paths) if(NOT _no_cmake_path) - if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "") - list(APPEND _extra_paths ${CMAKE_PREFIX_PATH}) - endif() - if(NOT "${CMAKE_FRAMEWORK_PATH}" STREQUAL "") - list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) - endif() - if(NOT "${CMAKE_APPBUNDLE_PATH}" STREQUAL "") - list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH}) - endif() + _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH) + _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH) + _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH) endif() if(NOT _no_cmake_environment_path) - if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") - file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _path) - list(APPEND _extra_paths ${_path}) - unset(_path) - endif() - if(NOT "$ENV{CMAKE_FRAMEWORK_PATH}" STREQUAL "") - file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _path) - list(APPEND _extra_paths ${_path}) - unset(_path) - endif() - if(NOT "$ENV{CMAKE_APPBUNDLE_PATH}" STREQUAL "") - file(TO_CMAKE_PATH "$ENV{CMAKE_APPBUNDLE_PATH}" _path) - list(APPEND _extra_paths ${_path}) - unset(_path) - endif() + _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH) + _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH) + _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH) endif() if(NOT "${_extra_paths}" STREQUAL "") From cc5a0d8f42f9ad8bc5ac50be343db05128a0c6ea Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 17 Mar 2014 18:09:54 +0100 Subject: [PATCH 217/278] FindPkgConfig: More unit tests --- .../FindPkgConfig_NO_PKGCONFIG_PATH.cmake | 41 +++++++++++++++ .../FindPkgConfig_PKGCONFIG_PATH.cmake | 2 +- ...ONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake | 51 +++++++++++++++++++ ...gConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake | 51 +++++++++++++++++++ .../RunCMake/FindPkgConfig/RunCMakeTest.cmake | 3 ++ .../FindPkgConfig/dummy-pkg-config.bat | 2 + .../FindPkgConfig/dummy-pkg-config.sh | 4 +- 7 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake new file mode 100644 index 000000000..924976efa --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -0,0 +1,41 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + +if(WIN32) + set(expected_path "C:\\baz") +else() + set(expected_path "/baz") +endif() + + +pkg_check_modules(FOO "${expected_path}") + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() + + + +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) + +pkg_check_modules(BAR "${expected_path}" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) + +if(NOT "BAR_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index 5f9913f79..4a66e8506 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -44,7 +44,7 @@ else() endif() -pkg_check_modules (FOO "${expected_path}") +pkg_check_modules(FOO "${expected_path}") if(NOT "FOO_FOUND") message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake new file mode 100644 index 000000000..0b057b8d7 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules(FOO "${expected_path}" NO_CMAKE_ENVIRONMENT_PATH) + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake new file mode 100644 index 000000000..a3154f13d --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -0,0 +1,51 @@ +# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS +enable_language(C) + +# Prepare environment and variables +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo") +if(WIN32) + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem") + set(ENV{PKG_CONFIG_PATH} "C:\\baz") +else() + set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh") + set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem") + set(ENV{PKG_CONFIG_PATH} "/baz") +endif() + + +find_package(PkgConfig) + + +if(NOT DEFINED CMAKE_SYSTEM_NAME + OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" + AND NOT CMAKE_CROSSCOMPILING)) + if(EXISTS "/etc/debian_version") # is this a debian system ? + if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$") + # Cannot create directories for all the existing architectures... + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + else() + # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property + get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + if(uselib64) + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() + endif() +else() + if(WIN32) + set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig") + else() + set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig") + endif() +endif() + + +pkg_check_modules(FOO "${expected_path}" NO_CMAKE_PATH) + +if(NOT "FOO_FOUND") + message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index ad77ad06e..bca93bb64 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -1,3 +1,6 @@ include(RunCMake) +run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH) run_cmake(FindPkgConfig_PKGCONFIG_PATH) +run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH) +run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH) diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat index b2096edc6..f2f86b0a6 100755 --- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat @@ -9,6 +9,8 @@ IF "%1"=="--version" ( IF "%1"=="--exists" ( SHIFT + ECHO Expected: %* + ECHO Found: %PKG_CONFIG_PATH% IF NOT "%*"=="%PKG_CONFIG_PATH%" ( EXIT /B 1 ) diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh index e62bb749b..852e841ad 100755 --- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh +++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh @@ -10,8 +10,8 @@ case $1 in ;; --exists) shift - echo "$@" - echo "${PKG_CONFIG_PATH}" + echo "Expected: $@" + echo "Found: ${PKG_CONFIG_PATH}" [ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1 ;; *) From f1b953ec9b71375b1ecb2bcb2eac5af0f2a895d3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 17 Mar 2014 13:12:10 -0400 Subject: [PATCH 218/278] Help: Add notes for topic 'ExternalProject-no-download-progress' --- Help/release/dev/ExternalProject-no-download-progress.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Help/release/dev/ExternalProject-no-download-progress.rst diff --git a/Help/release/dev/ExternalProject-no-download-progress.rst b/Help/release/dev/ExternalProject-no-download-progress.rst new file mode 100644 index 000000000..41db55dd2 --- /dev/null +++ b/Help/release/dev/ExternalProject-no-download-progress.rst @@ -0,0 +1,6 @@ +ExternalProject-no-download-progress +------------------------------------ + +* The :module:`ExternalProject` module ``ExternalProject_Add`` command + learned a new ``DOWNLOAD_NO_PROGRESS`` option to disable progress + output while downloading the source tarball. From 9292d3b8a016fb48f5b5b1518895b6d63e51bc2e Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 17 Mar 2014 19:38:57 +0100 Subject: [PATCH 219/278] Watcom: Detect compiler target architecture and platform In CMakePlatformId.h.in, fill ARCHITECTURE_ID and PLATFORM_ID for Open Watcom. --- Modules/CMakePlatformId.h.in | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 1e41fec6b..bc26c0773 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -74,6 +74,23 @@ #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) # define PLATFORM_ID "Xenix" +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID "" +# endif + #else /* unknown platform */ # define PLATFORM_ID "" @@ -107,6 +124,17 @@ # define ARCHITECTURE_ID "" # endif +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + #else # define ARCHITECTURE_ID "" #endif From 5d9aa66c91909b8d7eab16edb020c9a14205ba69 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 17 Mar 2014 19:41:02 +0100 Subject: [PATCH 220/278] Watcom: Introduce OpenWatcom compiler id and fix compiler version Distinguish "Open Watcom" from old "Watcom" by introducing a new "OpenWatcom" compiler id. The __WATCOMC__ format is "VVRP" for Watcom and "VVRP + 1100" for Open Watcom. --- Modules/CMakeCCompilerId.c.in | 17 ++++++++++---- Modules/CMakeCXXCompilerId.cpp.in | 17 ++++++++++---- Modules/InstallRequiredSystemLibraries.cmake | 4 ---- Modules/Platform/Windows-wcl386.cmake | 24 +++++++++++--------- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- 5 files changed, 40 insertions(+), 24 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 561ccf21b..16e19cdd8 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -68,10 +68,19 @@ # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) #elif defined(__WATCOMC__) -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) +# if __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRP */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# else +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# endif +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif #elif defined(__SUNPRO_C) # define COMPILER_ID "SunPro" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 6c602d46e..d81df77f1 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -73,10 +73,19 @@ # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) #elif defined(__WATCOMC__) -# define COMPILER_ID "Watcom" - /* __WATCOMC__ = VVRR */ -# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) -# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100) +# if __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRP */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# else +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# endif +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif #elif defined(__SUNPRO_CC) # define COMPILER_ID "SunPro" diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 7e68e8fda..4b551e6ff 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -374,10 +374,6 @@ if(WATCOM) string(REGEX MATCHALL "[0-9]+" _watcom_version_list "${_compiler_version}") list(GET _watcom_version_list 0 _watcom_major) list(GET _watcom_version_list 1 _watcom_minor) - if(${_watcom_major} GREATER 11) - math(EXPR _watcom_major "${_watcom_major} - 11") - endif() - math(EXPR _watcom_minor "${_watcom_minor} / 10") set( __install__libs ${CompilerPath}/clbr${_watcom_major}${_watcom_minor}.dll ${CompilerPath}/mt7r${_watcom_major}${_watcom_minor}.dll diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index d40d718e6..6b1cfd113 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -93,16 +93,18 @@ if(NOT _CMAKE_WATCOM_VERSION) set(WATCOM17) set(WATCOM18) set(WATCOM19) - if("${_compiler_version}" LESS 12.70) - set(WATCOM16 1) - endif() - if("${_compiler_version}" EQUAL 12.70) - set(WATCOM17 1) - endif() - if("${_compiler_version}" EQUAL 12.80) - set(WATCOM18 1) - endif() - if("${_compiler_version}" EQUAL 12.90) - set(WATCOM19 1) + if("${_compiler_id}" STREQUAL "OpenWatcom") + if("${_compiler_version}" VERSION_LESS 1.7) + set(WATCOM16 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.7) + set(WATCOM17 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.8) + set(WATCOM18 1) + endif() + if("${_compiler_version}" VERSION_EQUAL 1.9) + set(WATCOM19 1) + endif() endif() endif() diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index dba240651..e99bf0461 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -715,7 +715,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) { compiler = "icc"; } - else if (compilerId == "Watcom") + else if (compilerId == "Watcom" || compilerId == "OpenWatcom") { compiler = "ow"; } From 64c2342a8d0f3e655349d3897d2dee46a89aaedc Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 17 Mar 2014 19:30:38 +0100 Subject: [PATCH 221/278] Watcom: Enable 'WMake Makefiles' generator on Linux --- Source/CMakeLists.txt | 10 +++++++++- Source/cmGlobalWatcomWMakeGenerator.cxx | 4 ++++ Source/cmake.cxx | 10 +++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 9fb8d9a4c..762470fc2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -404,7 +404,6 @@ if (WIN32) cmGlobalVisualStudio12Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h - cmGlobalWatcomWMakeGenerator.cxx cmIDEFlagTable.h cmIDEOptions.cxx cmIDEOptions.h @@ -424,6 +423,15 @@ if (WIN32) endif() endif () +# Watcom support +if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE) + list(APPEND SRCS + cmGlobalWatcomWMakeGenerator.cxx + cmGlobalWatcomWMakeGenerator.h + ) +endif() + # Ninja support set(SRCS ${SRCS} cmGlobalNinjaGenerator.cxx diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 671166e51..0ae1b3437 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -16,7 +16,9 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() { this->FindMakeProgramFile = "CMakeFindWMake.cmake"; +#ifdef _WIN32 this->ForceUnixPaths = false; +#endif this->ToolSupportsColor = true; this->NeedSymbolicMark = true; this->EmptyRuleHackCommand = "@cd ."; @@ -44,7 +46,9 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() { cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; lg->SetDefineWindowsNULL(true); +#ifdef _WIN32 lg->SetWindowsShell(true); +#endif lg->SetWatcomWMake(true); lg->SetMakeSilentFlag("-h"); lg->SetGlobalGenerator(this); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4ce1d7065..ede6842d4 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -60,13 +60,15 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" -# include "cmGlobalWatcomWMakeGenerator.h" # define CMAKE_HAVE_VS_GENERATORS # endif # include "cmGlobalMSYSMakefileGenerator.h" # include "cmGlobalMinGWMakefileGenerator.h" #else #endif +#if defined(CMAKE_USE_WMAKE) +# include "cmGlobalWatcomWMakeGenerator.h" +#endif #include "cmGlobalUnixMakefileGenerator3.h" #include "cmGlobalNinjaGenerator.h" #include "cmExtraCodeLiteGenerator.h" @@ -1781,8 +1783,6 @@ void cmake::AddDefaultGenerators() cmGlobalNMakeMakefileGenerator::NewFactory()); this->Generators.push_back( cmGlobalJOMMakefileGenerator::NewFactory()); - this->Generators.push_back( - cmGlobalWatcomWMakeGenerator::NewFactory()); # endif this->Generators.push_back( cmGlobalMSYSMakefileGenerator::NewFactory()); @@ -1793,6 +1793,10 @@ void cmake::AddDefaultGenerators() cmGlobalUnixMakefileGenerator3::NewFactory()); this->Generators.push_back( cmGlobalNinjaGenerator::NewFactory()); +#if defined(CMAKE_USE_WMAKE) + this->Generators.push_back( + cmGlobalWatcomWMakeGenerator::NewFactory()); +#endif #ifdef CMAKE_USE_XCODE this->Generators.push_back( cmGlobalXCodeGenerator::NewFactory()); From 98383f802aadcd2d469c4d7543e0a2abe8c3cdb9 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Thu, 6 Mar 2014 22:55:07 -0700 Subject: [PATCH 222/278] Unicode: check encoding of files given to configure_file. UTF-16 and UTF-32 files are rejected. --- Source/cmMakefile.cxx | 14 ++++++++++++++ Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/configure_file/CMakeLists.txt | 3 +++ Tests/RunCMake/configure_file/NO-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/NO-BOM.txt.in | 1 + Tests/RunCMake/configure_file/RunCMakeTest.cmake | 8 ++++++++ .../configure_file/UTF16BE-BOM-result.txt | 1 + .../configure_file/UTF16BE-BOM-stderr.txt | 6 ++++++ Tests/RunCMake/configure_file/UTF16BE-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in | Bin 0 -> 26 bytes .../configure_file/UTF16LE-BOM-result.txt | 1 + .../configure_file/UTF16LE-BOM-stderr.txt | 6 ++++++ Tests/RunCMake/configure_file/UTF16LE-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in | Bin 0 -> 26 bytes .../configure_file/UTF32BE-BOM-result.txt | 1 + .../configure_file/UTF32BE-BOM-stderr.txt | 6 ++++++ Tests/RunCMake/configure_file/UTF32BE-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in | Bin 0 -> 52 bytes .../configure_file/UTF32LE-BOM-result.txt | 1 + .../configure_file/UTF32LE-BOM-stderr.txt | 6 ++++++ Tests/RunCMake/configure_file/UTF32LE-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in | Bin 0 -> 52 bytes Tests/RunCMake/configure_file/UTF8-BOM.cmake | 2 ++ Tests/RunCMake/configure_file/UTF8-BOM.txt.in | 1 + bootstrap | 1 + 25 files changed, 69 insertions(+) create mode 100644 Tests/RunCMake/configure_file/CMakeLists.txt create mode 100644 Tests/RunCMake/configure_file/NO-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/NO-BOM.txt.in create mode 100644 Tests/RunCMake/configure_file/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt create mode 100644 Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt create mode 100644 Tests/RunCMake/configure_file/UTF16BE-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in create mode 100644 Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt create mode 100644 Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt create mode 100644 Tests/RunCMake/configure_file/UTF16LE-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in create mode 100644 Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt create mode 100644 Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt create mode 100644 Tests/RunCMake/configure_file/UTF32BE-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in create mode 100644 Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt create mode 100644 Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt create mode 100644 Tests/RunCMake/configure_file/UTF32LE-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in create mode 100644 Tests/RunCMake/configure_file/UTF8-BOM.cmake create mode 100644 Tests/RunCMake/configure_file/UTF8-BOM.txt.in diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 92177c897..d0e6c30b8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3518,6 +3518,20 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, return 0; } + cmsys::FStream::BOM bom = cmsys::FStream::ReadBOM(fin); + if(bom != cmsys::FStream::BOM_None && + bom != cmsys::FStream::BOM_UTF8) + { + cmOStringStream e; + e << "File starts with a Byte-Order-Mark that is not UTF-8:\n " + << sinfile; + this->IssueMessage(cmake::FATAL_ERROR, e.str()); + return 0; + } + // rewind to copy BOM to output file + fin.seekg(0); + + // now copy input to output and expand variables in the // input file at the same time std::string inLine; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d401a932d..a8726f48c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -95,6 +95,7 @@ add_RunCMake_test(TargetPolicies) add_RunCMake_test(alias_targets) add_RunCMake_test(interface_library) add_RunCMake_test(no_install_prefix) +add_RunCMake_test(configure_file) find_package(Qt4 QUIET) find_package(Qt5Core QUIET) diff --git a/Tests/RunCMake/configure_file/CMakeLists.txt b/Tests/RunCMake/configure_file/CMakeLists.txt new file mode 100644 index 000000000..289710955 --- /dev/null +++ b/Tests/RunCMake/configure_file/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/configure_file/NO-BOM.cmake b/Tests/RunCMake/configure_file/NO-BOM.cmake new file mode 100644 index 000000000..003d52663 --- /dev/null +++ b/Tests/RunCMake/configure_file/NO-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(NO-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/NO-BOM.txt) diff --git a/Tests/RunCMake/configure_file/NO-BOM.txt.in b/Tests/RunCMake/configure_file/NO-BOM.txt.in new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/Tests/RunCMake/configure_file/NO-BOM.txt.in @@ -0,0 +1 @@ +Hello World diff --git a/Tests/RunCMake/configure_file/RunCMakeTest.cmake b/Tests/RunCMake/configure_file/RunCMakeTest.cmake new file mode 100644 index 000000000..c8bfa570d --- /dev/null +++ b/Tests/RunCMake/configure_file/RunCMakeTest.cmake @@ -0,0 +1,8 @@ +include(RunCMake) + +run_cmake(NO-BOM) +run_cmake(UTF8-BOM) +run_cmake(UTF16LE-BOM) +run_cmake(UTF16BE-BOM) +run_cmake(UTF32LE-BOM) +run_cmake(UTF32BE-BOM) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt new file mode 100644 index 000000000..5132c4ddb --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF16BE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake b/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake new file mode 100644 index 000000000..c5707425a --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16BE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF16BE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF16BE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF16BE-BOM.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..70fd9cbf7d6e490d148fb44aa9bee4deed65e418 GIT binary patch literal 26 dcmezOpTUD6l_3WR^BEKv!hvKFke$N71psFA1|$Fg literal 0 HcmV?d00001 diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt new file mode 100644 index 000000000..8f997bc71 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF16LE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake b/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake new file mode 100644 index 000000000..05c9cd757 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF16LE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF16LE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF16LE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF16LE-BOM.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..036f8c536013a31a964862fc12e7fae84d4ed7e2 GIT binary patch literal 26 dcmezW&x0YAAqNQa859`8fn*Voox;Gy003(m1|$Fg literal 0 HcmV?d00001 diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt new file mode 100644 index 000000000..12811aaa2 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF32BE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake b/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake new file mode 100644 index 000000000..0c6ea8753 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32BE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF32BE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF32BE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF32BE-BOM.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..c87cfd5ca6947c413ddc47c01371c29c0df0dce9 GIT binary patch literal 52 ncmZQz`1hZIfx!caQ-L@Kit~ZA0uYA-F^F9R#2~p8Am#!9#>ECC literal 0 HcmV?d00001 diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt b/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt b/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt new file mode 100644 index 000000000..fa9e01a2b --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at UTF32LE-BOM.cmake:2 \(configure_file\): + File starts with a Byte-Order-Mark that is not UTF-8: + + .*/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake b/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake new file mode 100644 index 000000000..b6351b007 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF32LE-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF32LE-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF32LE-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in b/Tests/RunCMake/configure_file/UTF32LE-BOM.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..27c8183bd71c44add30a8b6758bef56de8c5ceb7 GIT binary patch literal 52 ncmezWkAcC1fq@|vh;yJgA4n?zaX1iz*hN4Ll1l+%E+7T~*D?kq literal 0 HcmV?d00001 diff --git a/Tests/RunCMake/configure_file/UTF8-BOM.cmake b/Tests/RunCMake/configure_file/UTF8-BOM.cmake new file mode 100644 index 000000000..af2adae4a --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF8-BOM.cmake @@ -0,0 +1,2 @@ + +configure_file(UTF8-BOM.txt.in ${CMAKE_CURRENT_BINARY_DIR}/UTF8-BOM.txt) diff --git a/Tests/RunCMake/configure_file/UTF8-BOM.txt.in b/Tests/RunCMake/configure_file/UTF8-BOM.txt.in new file mode 100644 index 000000000..abc0acab2 --- /dev/null +++ b/Tests/RunCMake/configure_file/UTF8-BOM.txt.in @@ -0,0 +1 @@ +Hello World diff --git a/bootstrap b/bootstrap index 69dcbce84..4e61f3e6c 100755 --- a/bootstrap +++ b/bootstrap @@ -329,6 +329,7 @@ fi KWSYS_CXX_SOURCES="\ Directory \ EncodingCXX \ + FStream \ Glob \ RegularExpression \ SystemTools" From 2c5e78fa5d54e5e10c586725ca9e068ac26f352e Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 18 Mar 2014 00:01:09 -0400 Subject: [PATCH 223/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 562040a72..cac80a225 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140317) +set(CMake_VERSION_PATCH 20140318) #set(CMake_VERSION_RC 1) From 8b8691adcad725e365407118d6d282994efad152 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 19 Mar 2014 00:01:09 -0400 Subject: [PATCH 224/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cac80a225..9dffee3b2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140318) +set(CMake_VERSION_PATCH 20140319) #set(CMake_VERSION_RC 1) From cf3e87e195448af50a9b2f0ca02732756e82ff2f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 19 Mar 2014 13:33:00 -0400 Subject: [PATCH 225/278] Tests: Teach CMakeOnly.AllFindModules to tolerate a system KDE4 The FindKDE4 module (incorrectly) modifies CMAKE_MODULE_PATH on the caller's behalf. This causes KDE4-installed find modules to be used by the test instead of those in CMake. Teach the test to restore the CMAKE_MODULE_PATH to its original value after each find_package call. This ensures that the next find_package actually tests our module. --- Tests/CMakeOnly/AllFindModules/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 691728aa9..15493be41 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -8,11 +8,14 @@ endif () # Avoid ctest truncation of output message(STATUS "CTEST_FULL_OUTPUT") +set(ORIGINAL_MODULE_PATH "${CMAKE_MODULE_PATH}") + file(GLOB FIND_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../Modules/Find*.cmake" ) macro(do_find MODULE_NAME) message(STATUS " Checking Find${MODULE_NAME}") find_package(${MODULE_NAME}) + set(CMAKE_MODULE_PATH "${ORIGINAL_MODULE_PATH}") endmacro() # It is only possible to use either Qt3 or Qt4 in one project. From f039a3a78e58f5ab2724704294513d7c25f0510c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 20 Mar 2014 00:01:05 -0400 Subject: [PATCH 226/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9dffee3b2..074406184 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140319) +set(CMake_VERSION_PATCH 20140320) #set(CMake_VERSION_RC 1) From d97606477118ba186f49753b5630e4ddb24a6cd2 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Thu, 20 Mar 2014 10:03:56 +0100 Subject: [PATCH 227/278] Revert "UseSWIG: Name extra generated files after module name (#10080)" This reverts commit f0111deb1ea21f667b2fbf57f55d5ee2a80f5ccc. --- Modules/UseSWIG.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 4ae6f813a..11ca205e1 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -85,6 +85,9 @@ macro(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile) set(${outfiles} "") get_source_file_property(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename ${infile} SWIG_MODULE_NAME) + if(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename STREQUAL "NOTFOUND") + get_filename_component(SWIG_GET_EXTRA_OUTPUT_FILES_module_basename "${infile}" NAME_WE) + endif() foreach(it ${SWIG_${language}_EXTRA_FILE_EXTENSION}) set(${outfiles} ${${outfiles}} "${generatedpath}/${SWIG_GET_EXTRA_OUTPUT_FILES_module_basename}.${it}") @@ -100,10 +103,6 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) get_source_file_property(swig_source_file_generated ${infile} GENERATED) get_source_file_property(swig_source_file_cplusplus ${infile} CPLUSPLUS) get_source_file_property(swig_source_file_flags ${infile} SWIG_FLAGS) - get_source_file_property(_SWIG_MODULE_NAME ${infile} SWIG_MODULE_NAME) - if ( NOT _SWIG_MODULE_NAME ) - set_source_files_properties(${infile} PROPERTIES SWIG_MODULE_NAME ${name}) - endif () if("${swig_source_file_flags}" STREQUAL "NOTFOUND") set(swig_source_file_flags "") endif() From 84a423040686fb5855cbe65d4aa4e209dc4ca870 Mon Sep 17 00:00:00 2001 From: David Cole Date: Mon, 17 Mar 2014 07:32:35 -0400 Subject: [PATCH 228/278] Tests: Prevent unnecessary rebuilds in CTestTestMemcheck Repeated "cmake . && ninja" calls were resulting in rebuilds every time. Change the test so that it uses "file(WRITE" to generate a ".in" file and then configure_file to "copy if different" that ".in" file to the final generated source file. Now, rebuilds will only occur if there are changes to the generated source file on "cmake ." runs after the first one. --- Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt index c5aa2cdbd..47d6a2488 100644 --- a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt @@ -1,7 +1,12 @@ # A dummy checker implementation that does not write the requested output file # so it triggers an error for every checker. -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" "int main(){return 0;}\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" "int main(){return 0;}\n") + +configure_file( + "${CMAKE_CURRENT_BINARY_DIR}/ret0.c.in" + "${CMAKE_CURRENT_BINARY_DIR}/ret0.c" + ) foreach(_pseudo IN ITEMS valgrind purify BC) add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") From 77f06b145d57c4665ff5d71b89a70c54a009ad14 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 5 Mar 2014 09:52:45 +0100 Subject: [PATCH 229/278] Modules: Add an Andriod platform file It is much like Linux but has no SONAME or RPATH. --- Modules/Platform/Android.cmake | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Modules/Platform/Android.cmake diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake new file mode 100644 index 000000000..a4c122ddf --- /dev/null +++ b/Modules/Platform/Android.cmake @@ -0,0 +1,5 @@ +include(Platform/Linux) +set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "") +# RPath is useless on Android, because we can't determine the installation +# location ahead of time. +set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") From bbffccca42d4f209220e833e1a86e735a5c83339 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 7 Mar 2014 17:20:10 +0100 Subject: [PATCH 230/278] add_custom_command: Evaluate generator expressions in DEPENDS Rely on evaluation in cmCustomCommandGenerator for the generators. When tracing target dependencies, depend on the union of dependencies for all configurations. --- Help/command/add_custom_command.rst | 4 ++ .../dev/add_custom_command-DEPENDS-genex.rst | 5 +++ Source/cmCustomCommandGenerator.cxx | 18 ++++++++- Source/cmCustomCommandGenerator.h | 2 + Source/cmGeneratorTarget.cxx | 39 ++++++++++++++++--- Tests/CustomCommand/CMakeLists.txt | 7 +++- 6 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 Help/release/dev/add_custom_command-DEPENDS-genex.rst diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index b0c54460c..028ca5ae5 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -156,3 +156,7 @@ target is built before any target using this custom command. Additionally, if the target is an executable or library a file-level dependency is created to cause the custom command to re-run whenever the target is recompiled. + +Arguments to ``DEPENDS`` may use "generator expressions" with the syntax +``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for +available expressions. diff --git a/Help/release/dev/add_custom_command-DEPENDS-genex.rst b/Help/release/dev/add_custom_command-DEPENDS-genex.rst new file mode 100644 index 000000000..1e528e680 --- /dev/null +++ b/Help/release/dev/add_custom_command-DEPENDS-genex.rst @@ -0,0 +1,5 @@ +add_custom_command-DEPENDS-genex +-------------------------------- + +* The :command:`add_custom_command` command learned to interpret + :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``. diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index a091cff46..cebd9f5d3 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const std::string& config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(cc.GetBacktrace())) + GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false) { } @@ -93,5 +93,19 @@ std::vector const& cmCustomCommandGenerator::GetOutputs() const //---------------------------------------------------------------------------- std::vector const& cmCustomCommandGenerator::GetDepends() const { - return this->CC.GetDepends(); + if (!this->DependsDone) + { + this->DependsDone = true; + std::vector depends = this->CC.GetDepends(); + for(std::vector::const_iterator + i = depends.begin(); + i != depends.end(); ++i) + { + cmsys::auto_ptr cge + = this->GE->Parse(*i); + cmSystemTools::ExpandListArgument( + cge->Evaluate(this->Makefile, this->Config), this->Depends); + } + } + return this->Depends; } diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h index cbcdb413f..0d8a0a4ed 100644 --- a/Source/cmCustomCommandGenerator.h +++ b/Source/cmCustomCommandGenerator.h @@ -28,6 +28,8 @@ class cmCustomCommandGenerator bool OldStyle; bool MakeVars; cmGeneratorExpression* GE; + mutable bool DependsDone; + mutable std::vector Depends; public: cmCustomCommandGenerator(cmCustomCommand const& cc, const std::string& config, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2a144c6b2..b35e859e6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -19,6 +19,7 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmComputeLinkInformation.h" +#include "cmCustomCommandGenerator.h" #include @@ -610,6 +611,9 @@ private: bool IsUtility(std::string const& dep); void CheckCustomCommand(cmCustomCommand const& cc); void CheckCustomCommands(const std::vector& commands); + void FollowCommandDepends(cmCustomCommand const& cc, + const std::string& config, + std::set& emitted); }; //---------------------------------------------------------------------------- @@ -826,16 +830,41 @@ cmTargetTraceDependencies } // Queue the custom command dependencies. - std::vector const& depends = cc.GetDepends(); + std::vector configs; + std::set emitted; + this->Makefile->GetConfigurations(configs); + if (configs.empty()) + { + configs.push_back(""); + } + for(std::vector::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + this->FollowCommandDepends(cc, *ci, emitted); + } +} + +//---------------------------------------------------------------------------- +void cmTargetTraceDependencies::FollowCommandDepends(cmCustomCommand const& cc, + const std::string& config, + std::set& emitted) +{ + cmCustomCommandGenerator ccg(cc, config, this->Makefile); + + const std::vector& depends = ccg.GetDepends(); + for(std::vector::const_iterator di = depends.begin(); di != depends.end(); ++di) { std::string const& dep = *di; - if(!this->IsUtility(dep)) + if(emitted.insert(dep).second) { - // The dependency does not name a target and may be a file we - // know how to generate. Queue it. - this->FollowName(dep); + if(!this->IsUtility(dep)) + { + // The dependency does not name a target and may be a file we + // know how to generate. Queue it. + this->FollowName(dep); + } } } } diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index bbae38719..a194a5f5d 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -185,7 +185,7 @@ add_executable(CustomCommand # here to test adding the generation rule after referencing the # generated source in a target. add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/generated.c - DEPENDS generator + DEPENDS $<1:generator> $<0:does_not_exist> COMMAND generator ARGS ${PROJECT_BINARY_DIR}/generated.c ) @@ -221,8 +221,11 @@ add_subdirectory(GeneratorInExtraDir) add_executable(tcat tcat.cxx) +# Test that list expansion from a generator expression works. +set_property(TARGET tcat PROPERTY DEPSLIST tcat gen_redirect_in.c) + add_custom_command(OUTPUT gen_redirect.c - DEPENDS tcat gen_redirect_in.c + DEPENDS $ COMMAND tcat < ${CMAKE_CURRENT_SOURCE_DIR}/gen_redirect_in.c > gen_redirect.c COMMAND ${CMAKE_COMMAND} -E echo "#endif" >> gen_redirect.c VERBATIM From 95cdf132489c79e88a10fdf7a7566fa002c7680b Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Wed, 19 Mar 2014 17:31:01 +0100 Subject: [PATCH 231/278] Treat .m files consistently as C across all generators Objective C sources should be compiled with the C compiler, not C++. The Xcode generator correctly classifies ".m" sources already. The cmSystemTools::GetFileFormat method was fixed by commit v2.8.0~1782 (fix for 7045, use gcc for .m, 2008-08-19) but it is not used by any of the generator since commit v2.4.0~2819 (major changes to support addition of languages, 2004-09-22). Fix the CMAKE__SOURCE_FILE_EXTENSIONS table entries so that cmGlobalGenerator::GetLanguageFromExtension tells the Makefile, Ninja, and VS IDE generators to compile ".m" sources as C. This makes behavior consistent on all generators. Signed-off-by: Tim Blechmann --- Modules/CMakeCCompiler.cmake.in | 2 +- Modules/CMakeCXXCompiler.cmake.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 804cce24c..694f8b879 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -26,7 +26,7 @@ if(CMAKE_COMPILER_IS_MINGW) set(MINGW 1) endif() set(CMAKE_C_COMPILER_ID_RUN 1) -set(CMAKE_C_SOURCE_FILE_EXTENSIONS c) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) set(CMAKE_C_LINKER_PREFERENCE 10) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 35aa6c455..c75611acf 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -27,7 +27,7 @@ if(CMAKE_COMPILER_IS_MINGW) endif() set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP) set(CMAKE_CXX_LINKER_PREFERENCE 30) set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) From 12faf00d71e9a9d9f48ee13ef9dd0011fa95c385 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Wed, 19 Mar 2014 15:21:09 -0400 Subject: [PATCH 232/278] KWSys 2014-03-19 (a8aa1014) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ a8aa1014 | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' dd873734..a8aa1014 Gerhard Grimm (1): fa86f1ba SystemInformation: Fix HP-UX PA-RISC processor detection Rolf Eike Beer (1): a8aa1014 SystemInformation: Fix HP-UX Intel processor detection Change-Id: I5891a6898cc73caf1b2be98859d5d4b11a24c5df --- SystemInformation.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 9c2638028..720a7c3b0 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -5023,21 +5023,26 @@ bool SystemInformationImplementation::QueryHPUXProcessor() case CPU_PA_RISC1_0: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x100; + break; case CPU_PA_RISC1_1: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x110; + break; case CPU_PA_RISC2_0: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x200; -# ifdef CPU_HP_INTEL_EM_1_0 + break; +# if defined(CPU_HP_INTEL_EM_1_0) || defined(CPU_IA64_ARCHREV_0) +# ifdef CPU_HP_INTEL_EM_1_0 case CPU_HP_INTEL_EM_1_0: -# endif -# ifdef CPU_IA64_ARCHREV_0 +# endif +# ifdef CPU_IA64_ARCHREV_0 case CPU_IA64_ARCHREV_0: -# endif +# endif this->ChipID.Vendor = "GenuineIntel"; this->Features.HasIA64 = true; break; +# endif default: return false; } From 2abd8efecbc6be237190f8fa2f10d6e0b53e08b9 Mon Sep 17 00:00:00 2001 From: Bruno Nova Date: Wed, 19 Mar 2014 19:44:46 +0000 Subject: [PATCH 233/278] UseJava: Copy resource files before compiling the jar (#13360) Co-Author: Mary Ellen Foster --- Modules/UseJava.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 654b4d0f7..127012fda 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -426,6 +426,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_DEPENDS) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) + set(_JAVA_RESOURCE_FILES_RELATIVE) foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) @@ -462,7 +463,8 @@ function(add_jar _TARGET_NAME) __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} "Copying ${_JAVA_SOURCE_FILE} to the build directory") - list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) endif () endforeach() @@ -529,7 +531,7 @@ function(add_jar _TARGET_NAME) OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} @@ -549,7 +551,7 @@ function(add_jar _TARGET_NAME) OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} From f1fd3714a40327c461633b64d82f6815ed3e7817 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Mar 2014 00:09:40 +0100 Subject: [PATCH 234/278] cmMakefile: Report type of INTERFACE library in conflict. --- Source/cmMakefile.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f82acc87f..dce71de50 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4200,6 +4200,9 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, case cmTarget::UTILITY: e << "a custom target "; break; + case cmTarget::INTERFACE_LIBRARY: + e << "an interface library "; + break; default: break; } e << "created in source directory \"" From 6373e08d439195557f77e8de7081252a5326f463 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 21 Mar 2014 00:01:16 -0400 Subject: [PATCH 235/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 074406184..62932b46e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140320) +set(CMake_VERSION_PATCH 20140321) #set(CMake_VERSION_RC 1) From 734df96f5ad3d47b3c7825715f0b524292aa6ede Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 4 Mar 2014 11:03:37 +0100 Subject: [PATCH 236/278] Qt4: Fix moc command dependencies for incremental build. Since commit v2.8.12~327^2 (Qt4Macros: Allow specifying a TARGET in invokations of macros., 2013-02-26), a parameters file is populated with moc arguments at generate-time. When the compile definitions or include directories change, the parameters file is updated but moc is not re-run in response. Fix that by making the moc invocation depend on the parameters file. Reported-At: https://bugreports.qt-project.org/browse/QTBUG-36970 --- Modules/Qt4Macros.cmake | 2 +- Tests/Qt4Targets/CMakeLists.txt | 27 +++++++++++++++++++ .../Qt4Targets/IncrementalMoc/CMakeLists.txt | 13 +++++++++ Tests/Qt4Targets/IncrementalMoc/foo.cpp | 8 ++++++ Tests/Qt4Targets/IncrementalMoc/foo.h | 9 +++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt create mode 100644 Tests/Qt4Targets/IncrementalMoc/foo.cpp create mode 100644 Tests/Qt4Targets/IncrementalMoc/foo.h diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 8baf89627..aca899660 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -141,7 +141,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) set(_moc_extra_parameters_file @${_moc_parameters_file}) add_custom_command(OUTPUT ${outfile} COMMAND Qt4::moc ${_moc_extra_parameters_file} - DEPENDS ${infile} + DEPENDS ${infile} ${_moc_parameters_file} ${_moc_working_dir} VERBATIM) endmacro () diff --git a/Tests/Qt4Targets/CMakeLists.txt b/Tests/Qt4Targets/CMakeLists.txt index af9fc3fe7..74300845a 100644 --- a/Tests/Qt4Targets/CMakeLists.txt +++ b/Tests/Qt4Targets/CMakeLists.txt @@ -36,3 +36,30 @@ add_executable(Qt4WrapMacroTest WIN32 main_wrap_test.cpp ${moc_file}) set_property(TARGET Qt4WrapMacroTest PROPERTY AUTOMOC OFF) target_include_directories(Qt4WrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface") target_link_libraries(Qt4WrapMacroTest Qt4::QtGui) + +set(timeformat "%Y%j%H%M%S") +try_compile(RESULT + "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild" + "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" + IncrementalMoc + CMAKE_FLAGS -DADD_DEF=0 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}") +file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_before "${timeformat}") +if (NOT tsvar_before) + message(SEND_ERROR "Unable to read timestamp from moc file from first build!") +endif() + +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 2) # Ensure that the timestamp will change. + +try_compile(RESULT + "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild" + "${CMAKE_CURRENT_SOURCE_DIR}/IncrementalMoc" + IncrementalMoc + CMAKE_FLAGS -DADD_DEF=1 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}") +file(TIMESTAMP "${CMAKE_CURRENT_BINARY_DIR}/IncrementalMocBuild/moc_foo.cpp" tsvar_after "${timeformat}") +if (NOT tsvar_after) + message(SEND_ERROR "Unable to read timestamp from moc file from second build!") +endif() + +if (NOT tsvar_after GREATER tsvar_before) + message(SEND_ERROR "Rebuild did not re-create moc file. Before: ${tsvar_before}. After: ${tsvar_after}") +endif() diff --git a/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt new file mode 100644 index 000000000..4ba0ceddf --- /dev/null +++ b/Tests/Qt4Targets/IncrementalMoc/CMakeLists.txt @@ -0,0 +1,13 @@ + +cmake_minimum_required(VERSION 2.8.12) +project(IncrementalMoc) + +find_package(Qt4 REQUIRED) + +qt4_generate_moc(foo.h moc_foo.cpp) + +add_library(testlib foo.cpp moc_foo.cpp) +target_link_libraries(testlib Qt4::QtCore) +if (ADD_DEF) + target_compile_definitions(testlib PRIVATE NEW_DEF) +endif() diff --git a/Tests/Qt4Targets/IncrementalMoc/foo.cpp b/Tests/Qt4Targets/IncrementalMoc/foo.cpp new file mode 100644 index 000000000..e924f7e26 --- /dev/null +++ b/Tests/Qt4Targets/IncrementalMoc/foo.cpp @@ -0,0 +1,8 @@ + +#include "foo.h" + +Foo::Foo() + : QObject(0) +{ + +} diff --git a/Tests/Qt4Targets/IncrementalMoc/foo.h b/Tests/Qt4Targets/IncrementalMoc/foo.h new file mode 100644 index 000000000..38d899f0a --- /dev/null +++ b/Tests/Qt4Targets/IncrementalMoc/foo.h @@ -0,0 +1,9 @@ + +#include + +class Foo : QObject +{ + Q_OBJECT +public: + Foo(); +}; From 84603d804c285c75f4bf81f9d79f0ebd0ca68fea Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 3 Mar 2014 15:47:08 +0100 Subject: [PATCH 237/278] Haiku: Enable CMake builtin ELF editor Co-Author: Brad King --- Source/CMakeLists.txt | 18 ++++++++++++++++++ Source/cmELF.cxx | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 762470fc2..27d099d40 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -18,6 +18,23 @@ else() endif() if(HAVE_ELF_H) set(CMAKE_USE_ELF_PARSER 1) +elseif(HAIKU) + # On Haiku, we need to include elf32.h from the private headers + set(CMake_HAIKU_INCLUDE_DIRS + /boot/system/develop/headers/private/system + /boot/system/develop/headers/private/system/arch/x86 + ) + + set(CMAKE_REQUIRED_INCLUDES ${CMake_HAIKU_INCLUDE_DIRS}) + CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H) + unset(CMAKE_REQUIRED_INCLUDES) + + if(HAVE_ELF32_H) + set(CMAKE_USE_ELF_PARSER 1) + else() + unset(CMake_HAIKU_INCLUDE_DIRS) + set(CMAKE_USE_ELF_PARSER) + endif() else() set(CMAKE_USE_ELF_PARSER) endif() @@ -57,6 +74,7 @@ include_directories( ${CMAKE_EXPAT_INCLUDES} ${CMAKE_TAR_INCLUDES} ${CMAKE_COMPRESS_INCLUDES} + ${CMake_HAIKU_INCLUDE_DIRS} ) # let cmake know it is supposed to use it diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index bc1c25ba1..dc6772c1b 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -23,6 +23,26 @@ #if defined(__OpenBSD__) # include # include +#elif defined(__HAIKU__) +# include +# include + typedef struct Elf32_Ehdr Elf32_Ehdr; + typedef struct Elf32_Shdr Elf32_Shdr; + typedef struct Elf32_Sym Elf32_Sym; + typedef struct Elf32_Rel Elf32_Rel; + typedef struct Elf32_Rela Elf32_Rela; +# define ELFMAG0 0x7F +# define ELFMAG1 'E' +# define ELFMAG2 'L' +# define ELFMAG3 'F' +# define ET_NONE 0 +# define ET_REL 1 +# define ET_EXEC 2 +# define ET_DYN 3 +# define ET_CORE 4 +# define EM_386 3 +# define EM_SPARC 2 +# define EM_PPC 20 #else # include #endif From 0cc42b871ab9c9153d839ab8fc55a6a887d55092 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 3 Mar 2014 15:57:05 +0100 Subject: [PATCH 238/278] Haiku: Fix compiler detection when using distcc Also remove outdated include directories. --- Modules/Platform/Haiku.cmake | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 825f85164..dfc2664d3 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -21,18 +21,26 @@ set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") # "/boot/system/develop/lib//", which we assume to be the secondary # architecture specific subdirectory and extract the name of the architecture # accordingly. -set(__HAIKU_COMPILER ${CMAKE_C_COMPILER}) -if(NOT __HAIKU_COMPILER) +# First of all, find a C or C++ compiler we can run. The "arg1" is necessary +# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86" +# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do. +if(CMAKE_C_COMPILER) + set(__HAIKU_COMPILER ${CMAKE_C_COMPILER}) + string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) +else() set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER}) + string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) endif() + execute_process( - COMMAND ${__HAIKU_COMPILER} -print-search-dirs + COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS + RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND OUTPUT_STRIP_TRAILING_WHITESPACE) -string(REGEX MATCH ".*\nlibraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/(:[^\n]*)?\n.*" _dummy "\n${_HAIKU_SEARCH_DIRS}\n") +string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n") set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}") if(NOT CMAKE_HAIKU_SECONDARY_ARCH) @@ -53,14 +61,12 @@ else() endif() list(APPEND CMAKE_SYSTEM_PREFIX_PATH - /boot/common/non-packaged - /boot/common + /boot/system/non-packaged /boot/system ) LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES - /boot/common/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} - /boot/common/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} /boot/system/develop/headers/os /boot/system/develop/headers/os/app /boot/system/develop/headers/os/device @@ -108,8 +114,7 @@ LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES}) LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES - /boot/common/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} - /boot/common/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} + /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} ) @@ -120,6 +125,6 @@ LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "/boot/common" CACHE PATH + set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) endif() From bccc056ba86ede84b9f0acb066de97103a74268a Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 21 Mar 2014 08:28:37 -0400 Subject: [PATCH 239/278] cmake: Advise user to remove CMakeFiles with CMakeCache.txt (#14820) --- Source/cmake.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ede6842d4..2cf636c3d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1413,8 +1413,8 @@ int cmake::ActualConfigure() message += "\nDoes not match the generator used previously: "; message += genName; message += - "\nEither remove the CMakeCache.txt file or choose a different" - " binary directory."; + "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; cmSystemTools::Error(message.c_str()); return -2; } @@ -1445,8 +1445,8 @@ int cmake::ActualConfigure() message += "\nDoes not match the toolset used previously: "; message += tsName; message += - "\nEither remove the CMakeCache.txt file or choose a different" - " binary directory."; + "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; cmSystemTools::Error(message.c_str()); return -2; } From d514e41118c8404171cbc6a9520407499af6064a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 22 Mar 2014 00:01:05 -0400 Subject: [PATCH 240/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62932b46e..b1079697c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140321) +set(CMake_VERSION_PATCH 20140322) #set(CMake_VERSION_RC 1) From 6f39a6ff321ca1682af684713c8ff93a21fe32ae Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 23 Mar 2014 00:01:06 -0400 Subject: [PATCH 241/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b1079697c..87a4165bb 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140322) +set(CMake_VERSION_PATCH 20140323) #set(CMake_VERSION_RC 1) From 9523d2a55c99fb0910531ae7160b099faeab6638 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 23 Mar 2014 23:47:56 -0400 Subject: [PATCH 242/278] ninja: Add support for custom depfile formats Not everything that isn't MSVC is GCC. I have support for LDC's depfile format on its way upstream[1], but its future is uncertain. CMake should at least support this for future depfile formats. [1]https://github.com/martine/ninja/pull/721 --- Help/release/dev/custom-ninja-deptypes.rst | 5 +++++ Source/cmNinjaTargetGenerator.cxx | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 Help/release/dev/custom-ninja-deptypes.rst diff --git a/Help/release/dev/custom-ninja-deptypes.rst b/Help/release/dev/custom-ninja-deptypes.rst new file mode 100644 index 000000000..7750da8c3 --- /dev/null +++ b/Help/release/dev/custom-ninja-deptypes.rst @@ -0,0 +1,5 @@ +custom-ninja-deptypes +--------------------- + +* Add a `CMAKE_NINJA_DEPTYPE_` variable so that compilers may set the + deptype for use in Ninja other than those CMake itself knows about. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4319f3cb3..8865b3d2d 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -418,6 +418,11 @@ cmNinjaTargetGenerator else { deptype = "gcc"; + const char* langdeptype = mf->GetDefinition("CMAKE_NINJA_DEPTYPE_" + lang); + if (langdeptype) + { + deptype = langdeptype; + } depfile = "$DEP_FILE"; const std::string flagsName = "CMAKE_DEPFILE_FLAGS_" + lang; std::string depfileFlags = mf->GetSafeDefinition(flagsName); From 8a306d68e02595a8fc119cf7e2fa267a6ea64498 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 24 Mar 2014 00:01:06 -0400 Subject: [PATCH 243/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 87a4165bb..32ea2fab1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140323) +set(CMake_VERSION_PATCH 20140324) #set(CMake_VERSION_RC 1) From 63a4c0af31fd067a189aaa44cd4b8d17e9efd5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Sat, 22 Mar 2014 08:54:34 +0100 Subject: [PATCH 244/278] FindPkgConfig: Stop processing when REQUIRED package not found (#14381) Make the behavior similar to find_package. --- Modules/FindPkgConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 286cc2366..83271437c 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -337,7 +337,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma if(_pkg_check_modules_failed) # fail when requested if (${_is_required}) - message(SEND_ERROR "A required package was not found") + message(FATAL_ERROR "A required package was not found") endif () else() # when we are here, we checked whether requested modules From 1b18f442f48ebd8f88c1f64ef016784613cc2f2d Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 24 Mar 2014 12:33:11 +0100 Subject: [PATCH 245/278] Avoid trailing space in CMAKE_*_LINKER_FLAGS when LDFLAGS is empty --- Modules/CMakeCommonLanguageInclude.cmake | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index 38a6d35ea..fa025a892 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -16,9 +16,11 @@ # cache values that can be initialized in the platform-compiler.cmake file # it may be included by more than one language. -set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" - CACHE STRING "Flags used by the linker.") - +if(NOT "x$ENV{LDFLAGS}" STREQUAL "x") + set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") + set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") + set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") +endif() if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) # default build type is none @@ -82,12 +84,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS) ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING "Flags used by the linker during Release with Debug Info builds.") endif() + +# executable linker flags +set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}" + CACHE STRING "Flags used by the linker.") + # shared linker flags -set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" +set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}" CACHE STRING "Flags used by the linker during the creation of dll's.") # module linker flags -set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}" +set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}" CACHE STRING "Flags used by the linker during the creation of modules.") # static linker flags @@ -124,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL CMAKE_STATIC_LINKER_FLAGS_RELEASE CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO ) - From 261acd91093ba5f2bf79f38a9632887ab2dd5f1c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 25 Mar 2014 01:16:49 +0100 Subject: [PATCH 246/278] QtAutogen: Use the basename for resource files. The rcc tool generates a cpp file with a symbol called qInitResources or called qInitResources_${name}, if the name is passed. The qInitResources symbol clashes if multiple qrc files are used in one target. Always pass the name to ensure that the symbol is unique. This is also the behavior of the qtx_add_resource macros. --- Source/cmQtAutoGenerators.cxx | 2 ++ Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/resourcetester.cpp | 2 ++ Tests/QtAutogen/second_resource.qrc | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 Tests/QtAutogen/second_resource.qrc diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 2c5dd450d..fcc898a14 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -2074,6 +2074,8 @@ bool cmQtAutoGenerators::GenerateQrc() } } + command.push_back("-name"); + command.push_back(basename); command.push_back("-o"); command.push_back(rcc_output_file); command.push_back(*si); diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 0821b454d..cf80f411c 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -66,7 +66,7 @@ add_custom_command( add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp gadget.cpp $ - test.qrc resourcetester.cpp generated.cpp + test.qrc second_resource.qrc resourcetester.cpp generated.cpp ) set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp index 43314e1f8..0c64d80af 100644 --- a/Tests/QtAutogen/resourcetester.cpp +++ b/Tests/QtAutogen/resourcetester.cpp @@ -16,6 +16,8 @@ void ResourceTester::doTest() { if (!QFile::exists(":/CMakeLists.txt")) qApp->exit(EXIT_FAILURE); + if (!QFile::exists(":/main.cpp")) + qApp->exit(EXIT_FAILURE); QTimer::singleShot(0, qApp, SLOT(quit())); } diff --git a/Tests/QtAutogen/second_resource.qrc b/Tests/QtAutogen/second_resource.qrc new file mode 100644 index 000000000..27bfb143b --- /dev/null +++ b/Tests/QtAutogen/second_resource.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + From 71a11252e95797113ecb1a969386f496b7d4861b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 25 Mar 2014 01:26:27 +0100 Subject: [PATCH 247/278] QtAutogen: Fix use of multiple ui files in a single target. Don't store a mapping of the directory to the ui file. The directory will be a unique key, allowing only one ui file to be specified. Use the source file name instead as the mapping key. --- Source/cmQtAutoGenerators.cxx | 11 +++++++---- Source/cmQtAutoGenerators.h | 2 +- Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/second_widget.cpp | 14 ++++++++++++++ Tests/QtAutogen/second_widget.h | 19 ++++++++++++++++++ Tests/QtAutogen/second_widget.ui | 32 +++++++++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 Tests/QtAutogen/second_widget.cpp create mode 100644 Tests/QtAutogen/second_widget.h create mode 100644 Tests/QtAutogen/second_widget.ui diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index fcc898a14..a8bb317d3 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1786,8 +1786,8 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, std::string::size_type matchOffset = 0; - const std::string absPath = cmsys::SystemTools::GetFilenamePath( - cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; + const std::string realName = + cmsys::SystemTools::GetRealPath(absFilename.c_str()); matchOffset = 0; if ((strstr(contentsString.c_str(), "ui_") != NULL) @@ -1804,7 +1804,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, // finding the correct header, so we need to remove the ui_ part basename = basename.substr(3); - includedUis[absPath] = basename; + includedUis[realName] = basename; matchOffset += uiIncludeRegExp.end(); } while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset)); @@ -1960,7 +1960,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, return false; } -bool cmQtAutoGenerators::GenerateUi(const std::string& path, +bool cmQtAutoGenerators::GenerateUi(const std::string& realName, const std::string& uiFileName) { if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false)) @@ -1968,6 +1968,9 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path, cmsys::SystemTools::MakeDirectory(this->Builddir.c_str()); } + const std::string path = cmsys::SystemTools::GetFilenamePath( + realName.c_str()) + '/'; + std::string ui_output_file = "ui_" + uiFileName + ".h"; std::string ui_input_file = path + uiFileName + ".ui"; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 2840fbf4b..9ddf64f1f 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -48,7 +48,7 @@ private: bool RunAutogen(cmMakefile* makefile); bool GenerateMoc(const std::string& sourceFile, const std::string& mocFileName); - bool GenerateUi(const std::string& path, const std::string& uiFileName); + bool GenerateUi(const std::string& realName, const std::string& uiFileName); bool GenerateQrc(); void ParseCppFile(const std::string& absFilename, const std::vector& headerExtensions, diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index cf80f411c..d2116aa92 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -64,7 +64,7 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" ) -add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp +add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp xyz.cpp yaf.cpp gadget.cpp $ test.qrc second_resource.qrc resourcetester.cpp generated.cpp ) diff --git a/Tests/QtAutogen/second_widget.cpp b/Tests/QtAutogen/second_widget.cpp new file mode 100644 index 000000000..65ba9627c --- /dev/null +++ b/Tests/QtAutogen/second_widget.cpp @@ -0,0 +1,14 @@ + +#include "second_widget.h" +#include "ui_second_widget.h" + +SecondWidget::SecondWidget(QWidget *parent) + : QWidget(parent), ui(new Ui::SecondWidget) +{ + ui->setupUi(this); +} + +SecondWidget::~SecondWidget() +{ + delete ui; +} diff --git a/Tests/QtAutogen/second_widget.h b/Tests/QtAutogen/second_widget.h new file mode 100644 index 000000000..fe4d175f7 --- /dev/null +++ b/Tests/QtAutogen/second_widget.h @@ -0,0 +1,19 @@ + +#include + +namespace Ui +{ +class SecondWidget; +} + +class SecondWidget : public QWidget +{ + Q_OBJECT +public: + explicit SecondWidget(QWidget *parent = 0); + + ~SecondWidget(); + +private: + Ui::SecondWidget* ui; +}; diff --git a/Tests/QtAutogen/second_widget.ui b/Tests/QtAutogen/second_widget.ui new file mode 100644 index 000000000..4effa589c --- /dev/null +++ b/Tests/QtAutogen/second_widget.ui @@ -0,0 +1,32 @@ + + + SecondWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 80 + 20 + 94 + 24 + + + + PushButton + + + + + + From a56a8f95364e6ec1fc50cb6a792325d914c16235 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 25 Mar 2014 00:01:06 -0400 Subject: [PATCH 248/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 32ea2fab1..66ba566bc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140324) +set(CMake_VERSION_PATCH 20140325) #set(CMake_VERSION_RC 1) From f284b003d7eee7345f3daa2893a21ff605ba09a7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 Mar 2014 16:22:44 -0400 Subject: [PATCH 249/278] FindBoost: Search next to MPI libs for graph_parallel (#14832) In addition to the MPI libraries, graph_parallel lives in the MPI libdir as well. --- Modules/FindBoost.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index a57e12cd2..d4026afc8 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -954,7 +954,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) # Compute component-specific hints. set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") - if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python") + if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR + ${COMPONENT} STREQUAL "graph_parallel") foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) if(IS_ABSOLUTE "${lib}") get_filename_component(libdir "${lib}" PATH) From fdf7bd27a30fa53ae6f4239088444baba1d7f84e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 22:46:11 +0100 Subject: [PATCH 250/278] FindThreads: replace MATCHES with STREQUAL --- Modules/FindThreads.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index ec671bfc5..d7473a7dd 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -96,7 +96,7 @@ else() if(NOT CMAKE_HAVE_THREADS_LIBRARY) # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread - if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") + if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x") message(STATUS "Check if compiler accepts -pthread") try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG ${CMAKE_BINARY_DIR} From 858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 23:47:49 +0100 Subject: [PATCH 251/278] FindThreads: avoid useless checks if a thread library is already found --- Modules/FindThreads.cmake | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index d7473a7dd..ff8aa29ed 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -63,32 +63,31 @@ else() set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) - endif() + else() - if(NOT CMAKE_HAVE_THREADS_LIBRARY) # Do we have -lpthreads CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) if(CMAKE_HAVE_PTHREADS_CREATE) set(CMAKE_THREAD_LIBS_INIT "-lpthreads") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) - endif() + else() - # Ok, how about -lpthread - CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) - if(CMAKE_HAVE_PTHREAD_CREATE) - set(CMAKE_THREAD_LIBS_INIT "-lpthread") - set(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) - endif() - - if(CMAKE_SYSTEM MATCHES "SunOS.*") - # On sun also check for -lthread - CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) - if(CMAKE_HAVE_THR_CREATE) - set(CMAKE_THREAD_LIBS_INIT "-lthread") + # Ok, how about -lpthread + CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) + if(CMAKE_HAVE_PTHREAD_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lpthread") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) + + elseif(CMAKE_SYSTEM MATCHES "SunOS.*") + # On sun also check for -lthread + CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) + if(CMAKE_HAVE_THR_CREATE) + set(CMAKE_THREAD_LIBS_INIT "-lthread") + set(CMAKE_HAVE_THREADS_LIBRARY 1) + set(Threads_FOUND TRUE) + endif() endif() endif() endif() From 693f8bf34df5aaf22ed30039eff181352ed6574a Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 23:49:54 +0100 Subject: [PATCH 252/278] FindThreads: simplify checking for SunOS --- Modules/FindThreads.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index ff8aa29ed..7f8452228 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -80,7 +80,7 @@ else() set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) - elseif(CMAKE_SYSTEM MATCHES "SunOS.*") + elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS") # On sun also check for -lthread CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) if(CMAKE_HAVE_THR_CREATE) From a29ea834de49cfcbf9b28e4403fd45f0c559bb06 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 26 Mar 2014 00:01:05 -0400 Subject: [PATCH 253/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 66ba566bc..9e471b345 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140325) +set(CMake_VERSION_PATCH 20140326) #set(CMake_VERSION_RC 1) From 90e22f8f713cb90f2020942cc168badedd6176e1 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 25 Mar 2014 16:16:51 +0100 Subject: [PATCH 254/278] OS X: Fix Info.plist placement in a CFBundle Fix cmOSXBundleGenerator::CreateCFBundle to place Info.plist under the same root directory as the rest of the bundle. Without this, Info.plist was placed into CMAKE_BINARY_DIR, not CMAKE_CURRENT_BINARY_DIR because the target path was not generated correctly. --- Source/cmOSXBundleGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 6f16913d6..786e6e2b6 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -178,7 +178,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, // Configure the Info.plist file. Note that it needs the executable name // to be set. - std::string plist = + std::string plist = root + "/" + this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, From dcfbbe87eb1d1fc748b794f105285523d3b12b1b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 26 Mar 2014 17:50:08 +0100 Subject: [PATCH 255/278] Help: Fix typo in cmake-qt manual. Do -> To. --- Help/manual/cmake-qt.7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/manual/cmake-qt.7.rst b/Help/manual/cmake-qt.7.rst index e4c3246ea..cad495115 100644 --- a/Help/manual/cmake-qt.7.rst +++ b/Help/manual/cmake-qt.7.rst @@ -173,7 +173,7 @@ The Qt 4 and 5 :prop_tgt:`IMPORTED` targets for the QtGui libraries specify that the qtmain.lib static library shipped with Qt will be linked by all dependent executables which have the :prop_tgt:`WIN32_EXECUTABLE` enabled. -Do disable this behavior, enable the ``Qt5_NO_LINK_QTMAIN`` target property for +To disable this behavior, enable the ``Qt5_NO_LINK_QTMAIN`` target property for Qt 5 based targets or ``QT4_NO_LINK_QTMAIN`` target property for Qt 4 based targets. From 536747552fa62a0faf2b529991dae8109703890f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 26 Mar 2014 14:00:16 -0400 Subject: [PATCH 256/278] CTestCustom: Suppress "note: in expansion of macro" diagnostic context Such notes only appear with other diagnostics and should not be considered a warning on their own. --- CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index b0f86ec46..6010b6441 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -54,6 +54,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION "ld: warning: directory not found for option .-(F|L)" "warning.*This version of Mac OS X is unsupported" "clang.*: warning: argument unused during compilation: .-g" + "note: in expansion of macro" # diagnostic context note # Ignore clang's summary warning, assuming prior text has matched some # other warning expression: From 27b812132c4c47c810b96bd2a1a28e7fb502a62e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 26 Mar 2014 15:07:32 -0400 Subject: [PATCH 257/278] Tests/CTestTestMemcheck: Help Xcode 2.x create output dirs Add the PRE_BUILD step to all targets that need it so the output directories get created no matter which target is built first. --- Tests/CTestTestMemcheck/CMakeLists.txt | 23 ++++++++++++------- .../NoLogDummyChecker/CMakeLists.txt | 12 +++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 9bd72491d..89844637e 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -19,14 +19,6 @@ add_executable(pseudo_valgrind "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") set_target_properties(pseudo_valgrind PROPERTIES OUTPUT_NAME valgrind) target_link_libraries(pseudo_valgrind CMakeLib) -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command(TARGET pseudo_valgrind - PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" - ) -endif() - add_executable(pseudo_purify "${CMAKE_CURRENT_BINARY_DIR}/ret0.cxx") set_target_properties(pseudo_purify PROPERTIES OUTPUT_NAME purify) target_link_libraries(pseudo_purify CMakeLib) @@ -196,3 +188,18 @@ set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES PASS_REGULAR_EXPRESSION "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + foreach(t + memcheck_fail + pseudo_BC + pseudo_purify + pseudo_valgrind + ) + add_custom_command(TARGET ${t} + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) + endforeach() +endif() diff --git a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt index 47d6a2488..3a45bfecc 100644 --- a/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/NoLogDummyChecker/CMakeLists.txt @@ -11,12 +11,12 @@ configure_file( foreach(_pseudo IN ITEMS valgrind purify BC) add_executable(pseudonl_${_pseudo} "${CMAKE_CURRENT_BINARY_DIR}/ret0.c") set_target_properties(pseudonl_${_pseudo} PROPERTIES OUTPUT_NAME ${_pseudo}) -endforeach() -# Xcode 2.x forgets to create the output directory before linking -# the individual architectures. -if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") - add_custom_command(TARGET pseudonl_valgrind + # Xcode 2.x forgets to create the output directory before linking + # the individual architectures. + if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command(TARGET pseudonl_${_pseudo} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" ) -endif() + endif() +endforeach() From e03ac807cf177b351b4b1720e16480a792bc1833 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 27 Mar 2014 00:01:18 -0400 Subject: [PATCH 258/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9e471b345..03391c02e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140326) +set(CMake_VERSION_PATCH 20140327) #set(CMake_VERSION_RC 1) From a863a8fecd368f3b17930dd7832fb2e0ba042616 Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Tue, 25 Mar 2014 07:17:45 +0100 Subject: [PATCH 259/278] cmLocalUnixMakefileGenerator3: Re-organize ConvertToQuotedOutputPath Use one code path whether the components list is empty or not. Fix indentation accordingly. --- Source/cmLocalUnixMakefileGenerator3.cxx | 67 ++++++++++++------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index cc872d525..8fa14d2de 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2183,52 +2183,51 @@ cmLocalUnixMakefileGenerator3 std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) { - // Split the path into its components. std::vector components; cmSystemTools::SplitPath(p, components); - // Return an empty path if there are no components. - if(components.empty()) - { - return "\"\""; - } + // Open the quoted result. + std::string result = "\""; - // Choose a slash direction and fix root component. - const char* slash = "/"; + // Return an empty path if there are no components. + if(!components.empty()) + { + // Choose a slash direction and fix root component. + const char* slash = "/"; #if defined(_WIN32) && !defined(__CYGWIN__) - if(!cmSystemTools::GetForceUnixPaths()) - { - slash = "\\"; - for(std::string::iterator i = components[0].begin(); - i != components[0].end(); ++i) - { - if(*i == '/') - { - *i = '\\'; - } - } - } + if(!cmSystemTools::GetForceUnixPaths()) + { + slash = "\\"; + for(std::string::iterator i = components[0].begin(); + i != components[0].end(); ++i) + { + if(*i == '/') + { + *i = '\\'; + } + } + } #endif - // Begin the quoted result with the root component. - std::string result = "\""; - result += components[0]; + // Begin the quoted result with the root component. + result += components[0]; - // Now add the rest of the components separated by the proper slash - // direction for this platform. - bool first = true; - for(unsigned int i=1; i < components.size(); ++i) - { - // Only the last component can be empty to avoid double slashes. - if(components[i].length() > 0 || (i == (components.size()-1))) + // Now add the rest of the components separated by the proper slash + // direction for this platform. + bool first = true; + for(unsigned int i=1; i < components.size(); ++i) { - if(!first) + // Only the last component can be empty to avoid double slashes. + if(components[i].length() > 0 || (i == (components.size()-1))) { - result += slash; + if(!first) + { + result += slash; + } + result += components[i]; + first = false; } - result += components[i]; - first = false; } } From 423009c17f50f837bca178a2cc5edfd62963f1ea Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Tue, 25 Mar 2014 07:17:45 +0100 Subject: [PATCH 260/278] Makefile: Generate single-quoted object lists for Watcom Drop the CMAKE_NO_QUOTED_OBJECTS internal variable from the Makefile generators. The underlying problem is with the Watcom linker, not with WMake. The Watcom linker wants object files to be single-quoted. Add _USE_WATCOM_QUOTE platform information variables to tell the generators to use Watcom-style single quotes for object files on link lines. On Windows, Watcom uses the GetCommandLine API to get the original command-line string and do custom parsing that expects single quotes. On POSIX systems, Watcom approximates the original command line by joining all argv[] entries separated by a single space. Therefore we need to double-quote the single-quoted arguments so that the shell does not consume them and they are available for the parser to see. --- Modules/Platform/Windows-wcl386.cmake | 5 +++ Source/cmGlobalWatcomWMakeGenerator.cxx | 1 - Source/cmLocalUnixMakefileGenerator3.cxx | 30 ++++++++++++-- Source/cmLocalUnixMakefileGenerator3.h | 3 +- .../cmMakefileExecutableTargetGenerator.cxx | 4 +- Source/cmMakefileLibraryTargetGenerator.cxx | 5 ++- Source/cmMakefileTargetGenerator.cxx | 39 ++++++------------- Source/cmMakefileTargetGenerator.h | 6 ++- 8 files changed, 57 insertions(+), 36 deletions(-) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 6b1cfd113..617761b20 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -39,6 +39,11 @@ set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") +foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) + set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) + set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1) +endforeach() + set(CMAKE_C_CREATE_IMPORT_LIBRARY "wlib -c -q -n -b +") set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 0ae1b3437..e44ed7934 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -35,7 +35,6 @@ void cmGlobalWatcomWMakeGenerator mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1"); mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&"); mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC"); - mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1"); mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386"); this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 8fa14d2de..ff173f5ba 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2181,14 +2181,27 @@ cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- std::string -cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) +cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, + bool useWatcomQuote) { // Split the path into its components. std::vector components; cmSystemTools::SplitPath(p, components); // Open the quoted result. - std::string result = "\""; + std::string result; + if(useWatcomQuote) + { +#if defined(_WIN32) && !defined(__CYGWIN__) + result = "'"; +#else + result = "\"'"; +#endif + } + else + { + result = "\""; + } // Return an empty path if there are no components. if(!components.empty()) @@ -2232,7 +2245,18 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) } // Close the quoted result. - result += "\""; + if(useWatcomQuote) + { +#if defined(_WIN32) && !defined(__CYGWIN__) + result += "'"; +#else + result += "'\""; +#endif + } + else + { + result += "\""; + } return result; } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 14543fbaa..99974eef7 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -186,7 +186,8 @@ public: const char *targetDir, cmLocalGenerator::RelativeRoot returnDir); - static std::string ConvertToQuotedOutputPath(const char* p); + static std::string ConvertToQuotedOutputPath(const char* p, + bool useWatcomQuote); std::string CreateMakeVariable(const std::string& sin, const std::string& s2in); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a61005b43..701d5a069 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -290,6 +290,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) linkRuleVar += linkLanguage; linkRuleVar += "_LINK_EXECUTABLE"; std::string linkRule = this->GetLinkRule(linkRuleVar); + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); std::vector commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -343,7 +344,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // rule. std::string buildObjs; this->CreateObjectLists(useLinkScript, false, - useResponseFileForObjects, buildObjs, depends); + useResponseFileForObjects, buildObjs, depends, + useWatcomQuote); cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_LINK"; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 02469d1c3..754f62f3f 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -458,6 +458,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->Target); } + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Determine whether a link script will be used. bool useLinkScript = this->GlobalGenerator->GetUseLinkScript(); @@ -553,7 +555,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // rule. std::string buildObjs; this->CreateObjectLists(useLinkScript, useArchiveRules, - useResponseFileForObjects, buildObjs, depends); + useResponseFileForObjects, buildObjs, depends, + useWatcomQuote); cmLocalGenerator::RuleVariables vars; vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6759d050e..b3d3f7152 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1349,7 +1349,8 @@ cmMakefileTargetGenerator::AppendProgress(std::vector& commands) void cmMakefileTargetGenerator ::WriteObjectsVariable(std::string& variableName, - std::string& variableNameExternal) + std::string& variableNameExternal, + bool useWatcomQuote) { // Write a make variable assignment that lists all objects for the // target. @@ -1360,8 +1361,6 @@ cmMakefileTargetGenerator << "# Object files for target " << this->Target->GetName() << "\n" << variableName << " ="; std::string object; - const char* objName = - this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS"); const char* lineContinue = this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE"); if(!lineContinue) @@ -1372,17 +1371,9 @@ cmMakefileTargetGenerator i != this->Objects.end(); ++i) { *this->BuildFileStream << " " << lineContinue << "\n"; - if(objName) - { - *this->BuildFileStream << - this->Convert(*i, cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::MAKEFILE); - } - else - { - *this->BuildFileStream << - this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str()); - } + *this->BuildFileStream << + this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), + useWatcomQuote); } *this->BuildFileStream << "\n"; @@ -1404,17 +1395,9 @@ cmMakefileTargetGenerator *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); - if(objName) - { - *this->BuildFileStream << - this->Convert(*i, cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::MAKEFILE); - } - else - { - *this->BuildFileStream << - this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str()); - } + *this->BuildFileStream << + this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), + useWatcomQuote); } *this->BuildFileStream << "\n" << "\n"; } @@ -1882,11 +1865,13 @@ void cmMakefileTargetGenerator ::CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, - std::vector& makefile_depends) + std::vector& makefile_depends, + bool useWatcomQuote) { std::string variableName; std::string variableNameExternal; - this->WriteObjectsVariable(variableName, variableNameExternal); + this->WriteObjectsVariable(variableName, variableNameExternal, + useWatcomQuote); if(useResponseFile) { // MSVC response files cannot exceed 128K. diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 7ff6da9c1..ff946605d 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -113,7 +113,8 @@ protected: // write out the variable that lists the objects for this target void WriteObjectsVariable(std::string& variableName, - std::string& variableNameExternal); + std::string& variableNameExternal, + bool useWatcomQuote); void WriteObjectsString(std::string& buildObjs); void WriteObjectsStrings(std::vector& objStrings, std::string::size_type limit = std::string::npos); @@ -172,7 +173,8 @@ protected: /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, bool useResponseFile, std::string& buildObjs, - std::vector& makefile_depends); + std::vector& makefile_depends, + bool useWatcomQuote); void AddIncludeFlags(std::string& flags, const std::string& lang); From cab2e31443a38b1023ec46eb99759a4be941fea0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 28 Mar 2014 00:01:05 -0400 Subject: [PATCH 261/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 03391c02e..00ab3fe68 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140327) +set(CMake_VERSION_PATCH 20140328) #set(CMake_VERSION_RC 1) From c3e238dd538322268a4475ac4454b35fe39a134e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 28 Mar 2014 17:59:31 +0100 Subject: [PATCH 262/278] ProcessorCount: use mpsched on HPUX if machinfo is not present Co-Author: Gerhard Grimm --- Modules/ProcessorCount.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index 0fe0b3207..e034a28a3 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -104,6 +104,18 @@ function(ProcessorCount var) string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}") set(count "${CMAKE_MATCH_1}") #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'") + else() + find_program(ProcessorCount_cmd_mpsched mpsched) + mark_as_advanced(ProcessorCount_cmd_mpsched) + if(ProcessorCount_cmd_mpsched) + execute_process(COMMAND ${ProcessorCount_cmd_mpsched} -s + OUTPUT_QUIET + ERROR_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE mpsched_output) + string(REGEX MATCHALL "Processor Count *: *([0-9]+)" procs "${mpsched_output}") + set(count "${CMAKE_MATCH_1}") + #message("ProcessorCount: trying mpsched -s '${ProcessorCount_cmd_mpsched}'") + endif() endif() endif() From 5bad8ae342a7f1134fe3bb1ad3f2cc9852679124 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 29 Mar 2014 00:01:05 -0400 Subject: [PATCH 263/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 00ab3fe68..62b1bae32 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140328) +set(CMake_VERSION_PATCH 20140329) #set(CMake_VERSION_RC 1) From 4c0cc9ab9195d348ea5f1b004789ec334531bbb1 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 29 Mar 2014 20:12:27 -0600 Subject: [PATCH 264/278] Check*.cmake : Add CMAKE_REQUIRED_QUIET flag. Setting this flag can silence messages from the Check*.cmake modules. This can be used by Find*.cmake modules when they are in silent mode. --- Modules/CMakePushCheckState.cmake | 3 +++ Modules/CheckCSourceCompiles.cmake | 13 ++++++++++--- Modules/CheckCSourceRuns.cmake | 13 ++++++++++--- Modules/CheckCXXSourceCompiles.cmake | 13 ++++++++++--- Modules/CheckCXXSourceRuns.cmake | 13 ++++++++++--- Modules/CheckCXXSymbolExists.cmake | 1 + Modules/CheckFunctionExists.cmake | 13 ++++++++++--- Modules/CheckIncludeFile.cmake | 13 ++++++++++--- Modules/CheckIncludeFileCXX.cmake | 13 ++++++++++--- Modules/CheckIncludeFiles.cmake | 13 ++++++++++--- Modules/CheckLibraryExists.cmake | 13 ++++++++++--- Modules/CheckPrototypeDefinition.cmake | 9 +++++++-- Modules/CheckStructHasMember.cmake | 1 + Modules/CheckSymbolExists.cmake | 13 ++++++++++--- Modules/CheckTypeSize.cmake | 13 ++++++++++--- Modules/CheckVariableExists.cmake | 13 ++++++++++--- 16 files changed, 132 insertions(+), 38 deletions(-) diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index 39f002379..bf4ec0e9c 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE) set(CMAKE_REQUIRED_DEFINITIONS) set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) endmacro() @@ -68,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE) set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) + set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") cmake_reset_check_state() @@ -84,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE) set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) + set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") endif() diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index c2f6915e3..8721d5590 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -67,7 +68,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c @@ -85,13 +88,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) if(${VAR}) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() set(${VAR} "" CACHE INTERNAL "Test ${VAR}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 2e68454c4..a4fa57efb 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -56,7 +57,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c @@ -73,7 +76,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) # if the return value was 0 then it worked if("${${VAR}_EXITCODE}" EQUAL 0) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -86,7 +91,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") endif() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index c7ef5ecac..6ce64a1b0 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -68,7 +69,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx @@ -86,13 +89,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) if(${VAR}) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") else() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() set(${VAR} "" CACHE INTERNAL "Test ${VAR}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 4e3ff6c2c..c65586385 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -56,7 +57,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx @@ -74,7 +77,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) # if the return value was 0 then it worked if("${${VAR}_EXITCODE}" EQUAL 0) set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Success") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -87,7 +92,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") endif() - message(STATUS "Performing Test ${VAR} - Failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR} - Failed") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index aa62fbf5a..084fbb422 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index e232bd7b6..bfd183691 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -20,6 +20,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2011 Kitware, Inc. @@ -40,7 +41,9 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${FUNCTION}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION}") + endif() if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,12 +66,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") - message(STATUS "Looking for ${FUNCTION} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${FUNCTION} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 9dc1648dd..ea7326763 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -24,6 +24,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -49,7 +50,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c) - message(STATUS "Looking for ${INCLUDE}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE}") + endif() if(${ARGC} EQUAL 3) set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") @@ -69,14 +72,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) endif() if(${VARIABLE}) - message(STATUS "Looking for ${INCLUDE} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${INCLUDE} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${INCLUDE} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index fa36a3fd4..39abeff5b 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -53,7 +54,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) - message(STATUS "Looking for C++ include ${INCLUDE}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE}") + endif() if(${ARGC} EQUAL 3) set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") @@ -73,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) endif() if(${VARIABLE}) - message(STATUS "Looking for C++ include ${INCLUDE} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for C++ include ${INCLUDE} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for C++ include ${INCLUDE} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 182067f57..6aa0f2b68 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2012 Kitware, Inc. @@ -66,7 +67,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) set(_description "include file ${_INCLUDE}") endif() - message(STATUS "Looking for ${_description}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c @@ -76,14 +79,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${_description} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if files ${INCLUDE} " "exist passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${_description} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if files ${INCLUDE} " diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index f5c563c20..2b4137956 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -43,7 +44,9 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + endif() set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_LIBRARY_EXISTS_LIBRARIES @@ -60,14 +63,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") else() - message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 25ea7f499..fe000744c 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -33,6 +33,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -97,12 +98,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB if (${_VARIABLE}) set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") - message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" "${OUTPUT}\n\n") else () - message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") + endif() set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index a864e824c..880a688e2 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages # # # diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index e1ca41255..bf2e7973e 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. @@ -74,7 +75,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${SOURCEFILE}" @ONLY) - message(STATUS "Looking for ${SYMBOL}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} "${SOURCEFILE}" @@ -85,7 +88,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) - message(STATUS "Looking for ${SYMBOL} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - found") + endif() set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the ${SYMBOL} " @@ -93,7 +98,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") else() - message(STATUS "Looking for ${SYMBOL} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - not found") + endif() set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the ${SYMBOL} " diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 333b325f8..d4651b94c 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -59,6 +59,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages # CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include #============================================================================= @@ -85,7 +86,9 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) #----------------------------------------------------------------------------- # Helper function. DO NOT CALL DIRECTLY. function(__check_type_size_impl type var map builtin language) - message(STATUS "Check size of ${type}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type}") + endif() # Include header files. set(headers) @@ -169,13 +172,17 @@ function(__check_type_size_impl type var map builtin language) message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") endif() - message(STATUS "Check size of ${type} - done") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type} - done") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining size of ${type} passed with the following output:\n${output}\n\n") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") else() # The check failed to compile. - message(STATUS "Check size of ${type} - failed") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Check size of ${type} - failed") + endif() file(READ ${src} content) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 4861ff07a..3a7ef13bd 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -47,7 +48,9 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_VARIABLE_DEFINITIONS "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") - message(STATUS "Looking for ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR}") + endif() if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") - message(STATUS "Looking for ${VAR} - found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR} - found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") else() set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") - message(STATUS "Looking for ${VAR} - not found") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${VAR} - not found") + endif() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") From 83934757c942672d8bea79f11e51a184b168a212 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 29 Mar 2014 20:22:54 -0600 Subject: [PATCH 265/278] Find*: Make find_package(.. QUIET) affect Check* modules. Fixes issues #14812 and #14813 where find_package(OpenMP QUIET) and find_package(Qt4 QUIET) would still print out messages when calling check*() functions. Also a partial fix for #14445 where building CMake (without cmake-gui) when Qt5 is installed and Qt4 is not installed and warnings come out of FindQt4.cmake. --- Modules/FindBLAS.cmake | 4 ++++ Modules/FindBZip2.cmake | 4 ++++ Modules/FindBacktrace.cmake | 1 + Modules/FindCups.cmake | 4 ++++ Modules/FindCurses.cmake | 4 ++++ Modules/FindGIF.cmake | 1 + Modules/FindLAPACK.cmake | 5 +++++ Modules/FindLibLZMA.cmake | 3 +++ Modules/FindOpenCL.cmake | 1 + Modules/FindOpenMP.cmake | 12 ++++++++++-- Modules/FindQt4.cmake | 20 +++++++++++--------- Modules/FindThreads.cmake | 3 +++ Modules/FindX11.cmake | 3 +++ 13 files changed, 54 insertions(+), 11 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 3b658ef38..1cf91248b 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -52,6 +52,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -687,4 +690,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 388387735..b4793327d 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -57,7 +57,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 if (BZIP2_FOUND) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + cmake_pop_check_state() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake index 83789cc7d..5620661fe 100644 --- a/Modules/FindBacktrace.cmake +++ b/Modules/FindBacktrace.cmake @@ -62,6 +62,7 @@ if (NOT DEFINED Backtrace_LIBRARY) # First, check if we already have backtrace(), e.g., in libc cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY}) check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND) cmake_pop_check_state() endif() diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 4b55d6a58..61353caf9 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -36,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups ) if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY}) # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint) CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE) + cmake_pop_check_state() endif () if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 971edb75f..fa420c1fd 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -67,6 +67,9 @@ endif() # default search paths. if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP) @@ -77,6 +80,7 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) set(CURSES_USE_NCURSES TRUE) endif() endif() + cmake_pop_check_state() endif() diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 117ded76d..7bbb8cfcd 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -66,6 +66,7 @@ if(GIF_INCLUDE_DIR) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake) CMAKE_PUSH_CHECK_STATE() + set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY}) set(GIF_VERSION 3) set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}") CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData ) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 69da4cd9c..33f4f0c73 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -54,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) else () include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) endif () +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -347,4 +351,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index be01594b4..742b851cd 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -55,9 +55,12 @@ endif() # Avoid using old codebase if (LIBLZMA_LIBRARY) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index eee06bf44..b5eed9a04 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -35,6 +35,7 @@ function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) + set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) CMAKE_PUSH_CHECK_STATE() foreach(VERSION "2_0" "1_2" "1_1" "1_0") diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index fead4a6da..30972ae0c 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -39,6 +39,8 @@ # License text for the above reference.) set(_OPENMP_REQUIRED_VARS) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY}) function(_OPENMP_FLAG_CANDIDATES LANG) set(OpenMP_FLAG_CANDIDATES @@ -116,7 +118,9 @@ if(CMAKE_C_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP C flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP C flag = [${FLAG}]") + endif() check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -150,7 +154,9 @@ if(CMAKE_CXX_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + endif() check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -167,6 +173,8 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_TEST_SOURCE) endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + if(_OPENMP_REQUIRED_VARS) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d0515c682..e44d1d9d8 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -335,6 +335,7 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) @@ -613,9 +614,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) set(QT_QTCORE_FOUND 1) else() - message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " - "but QtCore could not be found there. " - "Qt is NOT installed correctly for the target build environment.") + if(NOT Qt4_FIND_QUIETLY) + message(WARNING + "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as " + "\"${QT_LIBRARY_DIR_TMP}\" " + "but QtCore could not be found there. " + "Qt is NOT installed correctly for the target build environment.") + endif() set(Qt4_FOUND FALSE) if(Qt4_FIND_REQUIRED) message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") @@ -747,11 +752,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) # Find out what window system we're using # ############################################# - # Save required variable - set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + cmake_push_check_state() # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY}) # Check for Window system symbols (note: only one should end up being set) CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) @@ -771,9 +775,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endif () endif () - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + cmake_pop_check_state() # ############################################# diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 7f8452228..6d1c65d02 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -37,6 +37,8 @@ include (CheckIncludeFiles) include (CheckLibraryExists) include (CheckSymbolExists) set(Threads_FOUND FALSE) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY}) # Do we have sproc? if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) @@ -173,5 +175,6 @@ if(CMAKE_USE_PTHREADS_INIT) endif() endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 67cecc212..3a31cf05d 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -73,6 +73,8 @@ if (UNIX) # found in tcl on the mac set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY}) set(X11_INC_SEARCH_PATH /usr/pkg/xorg/include /usr/X11R6/include @@ -507,6 +509,7 @@ if (UNIX) X11_XSync_INCLUDE_PATH ) set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () # X11_FIND_REQUIRED_ could be checked too From 9298987a826dd8c71b02779145d5b9e3ebc30f4f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 30 Mar 2014 00:01:06 -0400 Subject: [PATCH 266/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 62b1bae32..94b8bafb8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140329) +set(CMake_VERSION_PATCH 20140330) #set(CMake_VERSION_RC 1) From 480be00bfac0af72d373b5ef190ebc770a1bc7c1 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 29 Mar 2014 22:39:43 -0600 Subject: [PATCH 267/278] cmake-gui: Don't resolve symlinks with using file dialog. This fixes bug #14274 where a clang++ symlink was resolved to a clang executable. --- Source/QtDialog/CMakeSetupDialog.cxx | 6 ++++-- Source/QtDialog/QCMakeWidgets.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index f62afd68d..1a98ceab5 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -578,7 +578,8 @@ void CMakeSetupDialog::doInterrupt() void CMakeSetupDialog::doSourceBrowse() { QString dir = QFileDialog::getExistingDirectory(this, - tr("Enter Path to Source"), this->SourceDirectory->text()); + tr("Enter Path to Source"), this->SourceDirectory->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(!dir.isEmpty()) { this->setSourceDirectory(dir); @@ -608,7 +609,8 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) void CMakeSetupDialog::doBinaryBrowse() { QString dir = QFileDialog::getExistingDirectory(this, - tr("Enter Path to Build"), this->BinaryDirectory->currentText()); + tr("Enter Path to Build"), this->BinaryDirectory->currentText(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(!dir.isEmpty() && dir != this->BinaryDirectory->currentText()) { this->setBinaryDirectory(dir); diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx index a0c5e17fe..41f98b5d2 100644 --- a/Source/QtDialog/QCMakeWidgets.cxx +++ b/Source/QtDialog/QCMakeWidgets.cxx @@ -67,7 +67,8 @@ void QCMakeFilePathEditor::chooseFile() title = title.arg(this->Variable); } this->fileDialogExists(true); - path = QFileDialog::getOpenFileName(this, title, info.absolutePath()); + path = QFileDialog::getOpenFileName(this, title, info.absolutePath(), + QString(), NULL, QFileDialog::DontResolveSymlinks); this->fileDialogExists(false); if(!path.isEmpty()) @@ -91,7 +92,8 @@ void QCMakePathEditor::chooseFile() title = title.arg(this->Variable); } this->fileDialogExists(true); - path = QFileDialog::getExistingDirectory(this, title, this->text()); + path = QFileDialog::getExistingDirectory(this, title, this->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); this->fileDialogExists(false); if(!path.isEmpty()) { From 521b930bf4e211735842e71f1eb0018c2184a05f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 31 Mar 2014 00:01:05 -0400 Subject: [PATCH 268/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 94b8bafb8..4b27c7222 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140330) +set(CMake_VERSION_PATCH 20140331) #set(CMake_VERSION_RC 1) From 50ca77f4a03b05c380c923f737e0b3aa00a4cf7d Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 28 Mar 2014 11:10:37 -0400 Subject: [PATCH 269/278] create_test_sourcelist: Initialize variable at declaration Clang -Wconditional-uninitialized warns otherwise. --- Templates/TestDriver.cxx.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in index 82537efea..0e0a87241 100644 --- a/Templates/TestDriver.cxx.in +++ b/Templates/TestDriver.cxx.in @@ -58,7 +58,7 @@ static char* lowercase(const char *string) int main(int ac, char *av[]) { - int i, NumTests, testNum, partial_match; + int i, NumTests, testNum = 0, partial_match; char *arg, *test_name; int count; int testToRun = -1; @@ -81,7 +81,6 @@ int main(int ac, char *av[]) } printf("To run a test, enter the test number: "); fflush(stdout); - testNum = 0; if( scanf("%d", &testNum) != 1 ) { printf("Couldn't parse that input as a number\n"); From 8c9c4fe1a6d0c660c7e4e4c1af2cdf2e889fbfbd Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 28 Mar 2014 11:42:09 -0400 Subject: [PATCH 270/278] Remove 'return' statements that can never be reached Clang -Wunreachable-code-return warns otherwise. --- Source/CursesDialog/cmCursesOptionsWidget.cxx | 1 - Source/cmSystemTools.cxx | 1 - 2 files changed, 2 deletions(-) diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 652b2df7a..d97c737e6 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -59,7 +59,6 @@ bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) { return false; } - return false; } void cmCursesOptionsWidget::AddOption(std::string const & option ) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ff0597563..2f5f493eb 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1662,7 +1662,6 @@ long copy_data(struct archive *ar, struct archive *aw) return (r); } } - return r; } bool extract_tar(const char* outFileName, bool verbose, From 77b581c2f004a36b2b62cc7c678abf51f92c76b5 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Fri, 28 Mar 2014 21:38:10 +0100 Subject: [PATCH 271/278] Policies: omit warnings about unset policies when they are actually set to NEW --- Source/cmAddCustomTargetCommand.cxx | 6 +++--- Source/cmAddExecutableCommand.cxx | 6 +++--- Source/cmAddLibraryCommand.cxx | 11 +++++++---- Source/cmComputeTargetDepends.cxx | 7 ++++--- Source/cmIncludeCommand.cxx | 6 +++--- Source/cmMakefile.cxx | 6 +++--- Source/cmTarget.cxx | 6 +++--- Source/cmTargetLinkLibrariesCommand.cxx | 14 ++++++++------ .../CMP0026-CONFIG-LOCATION-NEW-stderr.txt | 4 ---- .../CMP0026-LOCATION-CONFIG-NEW-stderr.txt | 4 ---- Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt | 4 ---- .../RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt | 15 --------------- .../CMP0037/CMP0037-NEW-reserved-stderr.txt | 15 --------------- .../RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt | 15 --------------- Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt | 4 ---- .../CMP0040/CMP0040-NEW-missing-target-stderr.txt | 5 ----- .../CMP0046-NEW-missing-dependency-stderr.txt | 4 ---- Tests/RunCMake/include/CMP0024-NEW-stderr.txt | 4 ---- .../CMP0023-NEW-2-stderr.txt | 5 ----- .../target_link_libraries/CMP0023-NEW-stderr.txt | 5 ----- 20 files changed, 34 insertions(+), 112 deletions(-) diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ef6252327..e27d830c0 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -165,10 +165,13 @@ bool cmAddCustomTargetCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -180,9 +183,6 @@ bool cmAddCustomTargetCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << targetName << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 62b666766..3f9400e3e 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -79,10 +79,13 @@ bool cmAddExecutableCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -94,9 +97,6 @@ bool cmAddExecutableCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << exename << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 009b1caa4..e62a40e9d 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -214,11 +214,17 @@ bool cmAddLibraryCommand if (!nameOk) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; + cmOStringStream e; bool issueMessage = false; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - issueMessage = type != cmTarget::INTERFACE_LIBRARY; + if(type != cmTarget::INTERFACE_LIBRARY) + { + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; + issueMessage = true; + } case cmPolicies::OLD: break; case cmPolicies::NEW: @@ -229,9 +235,6 @@ bool cmAddLibraryCommand } if (issueMessage) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0037)) << "\n"; e << "The target name \"" << libName << "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 787056446..9136869df 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -349,9 +349,12 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmMakefile *makefile = depender->GetMakefile(); cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; + cmOStringStream e; switch(depender->GetPolicyStatusCMP0046()) { case cmPolicies::WARN: + e << (makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -364,9 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, if(issueMessage) { cmake* cm = this->GlobalGenerator->GetCMakeInstance(); - cmOStringStream e; - e << (makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0046)) << "\n"; + e << "The dependency target \"" << dependee_name << "\" of target \"" << depender->GetName() << "\" does not exist."; diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index e8ee33fd3..fbcbc75ba 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -98,11 +98,14 @@ bool cmIncludeCommand if (gg->IsExportedTargetsFile(fname_abs)) { const char *modal = 0; + cmOStringStream e; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0024)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -114,9 +117,6 @@ bool cmIncludeCommand } if (modal) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0024)) << "\n"; e << "The file\n " << fname_abs << "\nwas generated by the export() " "command. It " << modal << " not be used as the argument to the " "include() command. Use ALIAS targets instead to refer to targets " diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 10137ec8b..11559d9a3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -893,9 +893,12 @@ cmMakefile::AddCustomCommandToTarget(const char* target, { cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; + cmOStringStream e; switch(this->GetPolicyStatus(cmPolicies::CMP0040)) { case cmPolicies::WARN: + e << (this->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; issueMessage = true; case cmPolicies::OLD: break; @@ -908,9 +911,6 @@ cmMakefile::AddCustomCommandToTarget(const char* target, if(issueMessage) { - cmOStringStream e; - e << (this->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; e << "The target name \"" << target << "\" is unknown in this context."; IssueMessage(messageType, e.str().c_str()); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0c8965698..e2a568b3e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2636,11 +2636,14 @@ bool cmTarget::HandleLocationPropertyPolicy() const { return true; } + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: + e << (this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -2653,9 +2656,6 @@ bool cmTarget::HandleLocationPropertyPolicy() const if (modal) { - cmOStringStream e; - e << (this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n"; e << "The LOCATION property " << modal << " not be read from target \"" << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $, " diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 02da933ab..95a2cba26 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -103,11 +103,14 @@ bool cmTargetLinkLibrariesCommand if (this->Target->GetType() == cmTarget::UTILITY) { + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0039)) { case cmPolicies::WARN: + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0039) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -119,9 +122,7 @@ bool cmTargetLinkLibrariesCommand } if (modal) { - cmOStringStream e; - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0039) << "\n" + e << "Utility target \"" << this->Target->GetName() << "\" " << modal << " not be used as the target of a target_link_libraries call."; this->Makefile->IssueMessage(messageType, e.str().c_str()); @@ -373,11 +374,14 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, ? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature; if (!this->Target->PushTLLCommandTrace(sig)) { + cmOStringStream e; const char *modal = 0; cmake::MessageType messageType = cmake::AUTHOR_WARNING; switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023)) { case cmPolicies::WARN: + e << this->Makefile->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0023) << "\n"; modal = "should"; case cmPolicies::OLD: break; @@ -390,14 +394,12 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib, if(modal) { - cmOStringStream e; // If the sig is a keyword form and there is a conflict, the existing // form must be the plain form. const char *existingSig = (sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword"); - e << this->Makefile->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0023) << "\n" + e << "The " << existingSig << " signature for target_link_libraries " "has already been used with the target \"" << this->Target->GetName() << "\". All uses of " diff --git a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt index 07982bd1f..05b021746 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-CONFIG-LOCATION-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-CONFIG-LOCATION-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$, as appropriate. diff --git a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt index 0e90f968d..fec9dfb4d 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-LOCATION-CONFIG-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-LOCATION-CONFIG-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$, as appropriate. diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt index 2a05a4dd4..fa025129f 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0026-NEW.cmake:7 \(get_target_property\): - Policy CMP0026 is not set: Disallow use of the LOCATION target property. - Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - The LOCATION property may not be read from target "somelib". Use the target name directly with add_custom_command, or use the generator expression \$, as appropriate. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt index 9d2c35bdd..ec2315f18 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-colon-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0037-NEW-colon.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "lib:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -11,11 +6,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-colon.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "exe:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -23,11 +13,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-colon.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "custom:colon" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt index 13835af02..5789e383a 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-reserved-stderr.txt @@ -1,20 +1,10 @@ CMake Error at CMP0037-NEW-reserved.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "all" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-reserved.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "clean" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -22,11 +12,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-reserved.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "help" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt index 2525bcd41..e14cec000 100644 --- a/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt +++ b/Tests/RunCMake/CMP0037/CMP0037-NEW-space-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0037-NEW-space.cmake:4 \(add_library\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "lib with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -11,11 +6,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-space.cmake:5 \(add_executable\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "exe with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. @@ -23,11 +13,6 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at CMP0037-NEW-space.cmake:6 \(add_custom_target\): - Policy CMP0037 is not set: Target names should not be reserved and should - match a validity pattern. Run "cmake --help-policy CMP0037" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The target name "custom with spaces" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. diff --git a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt index 821c4f8b9..3d9d22537 100644 --- a/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0039/CMP0039-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0039-NEW.cmake:7 \(target_link_libraries\): - Policy CMP0039 is not set: Utility targets may not have link dependencies. - Run "cmake --help-policy CMP0039" for policy details. Use the cmake_policy - command to set the policy and suppress this warning. - Utility target "utility" must not be used as the target of a target_link_libraries call. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt index 03a0217f8..3f82d8c3d 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-NEW-missing-target-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0040-NEW-missing-target.cmake:3 \(add_custom_command\): - Policy CMP0040 is not set: The target in the TARGET signature of - add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for - policy details. Use the cmake_policy command to set the policy and - suppress this warning. -+ The target name "foobar" is unknown in this context. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt index 0c23c43e0..381647ff8 100644 --- a/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt +++ b/Tests/RunCMake/CMP0046/CMP0046-NEW-missing-dependency-stderr.txt @@ -1,8 +1,4 @@ CMake Error at CMP0046-NEW-missing-dependency.cmake:4 \(add_dependencies\): - Policy CMP0046 is not set: Error on non-existent dependency in - add_dependencies. Run "cmake --help-policy CMP0046" for policy details. - Use the cmake_policy command to set the policy and suppress this warning. -+ The dependency target "bar" of target "foo" does not exist. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt index 059d7e45a..0fdb3ca7f 100644 --- a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt +++ b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt @@ -1,8 +1,4 @@ CMake Error at subdir2/CMakeLists.txt:2 \(include\): - Policy CMP0024 is not set: Disallow include export result. Run "cmake - --help-policy CMP0024" for policy details. Use the cmake_policy command to - set the policy and suppress this warning. - The file .*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets.cmake diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt index d27686d4b..8e3f3153b 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-2-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0023-NEW-2.cmake:11 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. diff --git a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt index d7be0ff38..2ef229034 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0023-NEW-stderr.txt @@ -1,9 +1,4 @@ CMake Error at CMP0023-NEW.cmake:11 \(target_link_libraries\): - Policy CMP0023 is not set: Plain and keyword target_link_libraries - signatures cannot be mixed. Run "cmake --help-policy CMP0023" for policy - details. Use the cmake_policy command to set the policy and suppress this - warning. - The plain signature for target_link_libraries has already been used with the target "foo". All uses of target_link_libraries with a target must be either all-keyword or all-plain. From 85582d14fe19ba3d66c49ec95286bcaf7c675ca4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 31 Mar 2014 15:44:27 +0200 Subject: [PATCH 272/278] Help: Add option to create and install Qt .qch file. --- Utilities/Sphinx/CMakeLists.txt | 24 +++++++++++++++++++++++- Utilities/Sphinx/cmake.py | 18 ++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 23dc6ae1e..51c83ba6f 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -24,6 +24,7 @@ project(CMakeHelp NONE) option(SPHINX_MAN "Build man pages with Sphinx" OFF) option(SPHINX_HTML "Build html help with Sphinx" OFF) +option(SPHINX_QTHELP "Build Qt help with Sphinx" OFF) option(SPHINX_TEXT "Build text help with Sphinx (not installed)" OFF) find_program(SPHINX_EXECUTABLE NAMES sphinx-build @@ -32,7 +33,7 @@ find_program(SPHINX_EXECUTABLE mark_as_advanced(SPHINX_TEXT) -if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_TEXT) +if(NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT) return() elseif(NOT SPHINX_EXECUTABLE) message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!") @@ -63,6 +64,21 @@ endif() if(SPHINX_TEXT) list(APPEND doc_formats text) endif() +if(SPHINX_QTHELP) + find_program(QCOLLECTIONGENERATOR_EXECUTABLE + NAMES qcollectiongenerator + DOC "qcollectiongenerator tool" + ) + if (NOT QCOLLECTIONGENERATOR_EXECUTABLE) + message(FATAL_ERROR "QCOLLECTIONGENERATOR_EXECUTABLE (qcollectiongenerator) not found!") + endif() + list(APPEND doc_formats qthelp) + + set(qthelp_extra_commands + COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp + ) +endif() + set(doc_format_outputs "") set(doc_format_last "") @@ -78,6 +94,7 @@ foreach(format ${doc_formats}) ${CMake_SOURCE_DIR}/Help ${CMAKE_CURRENT_BINARY_DIR}/${format} > ${doc_format_log} # log stdout, pass stderr + ${${format}_extra_commands} DEPENDS ${doc_format_last} COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}" VERBATIM @@ -122,3 +139,8 @@ if(SPHINX_HTML) PATTERN objects.inv EXCLUDE ) endif() +if(SPHINX_QTHELP) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qch + DESTINATION ${CMAKE_DOC_DIR} + ) +endif() diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py index 336c74aa3..2d83376e7 100644 --- a/Utilities/Sphinx/cmake.py +++ b/Utilities/Sphinx/cmake.py @@ -21,6 +21,24 @@ from pygments.lexer import bygroups CMakeLexer.tokens["args"].append(('(\\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator))) +# Monkey patch for sphinx generating invalid content for qcollectiongenerator +# https://bitbucket.org/birkenfeld/sphinx/issue/1435/qthelp-builder-should-htmlescape-keywords +from sphinx.util.pycompat import htmlescape +from sphinx.builders.qthelp import QtHelpBuilder +old_build_keywords = QtHelpBuilder.build_keywords +def new_build_keywords(self, title, refs, subitems): + old_items = old_build_keywords(self, title, refs, subitems) + new_items = [] + for item in old_items: + before, rest = item.split("ref=\"", 1) + ref, after = rest.split("\"") + if ("<" in ref and ">" in ref): + new_items.append(before + "ref=\"" + htmlescape(ref) + "\"" + after) + else: + new_items.append(item) + return new_items +QtHelpBuilder.build_keywords = new_build_keywords + from docutils.parsers.rst import Directive, directives from docutils.transforms import Transform From e3e1ba3f781c621835dc5e46783fecb6ccaad127 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 1 Apr 2014 00:01:05 -0400 Subject: [PATCH 273/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4b27c7222..27f2e91b8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140331) +set(CMake_VERSION_PATCH 20140401) #set(CMake_VERSION_RC 1) From f26147b8716adfbc46d93df0b05c7cde0c9413f4 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Thu, 20 Mar 2014 09:57:38 +0100 Subject: [PATCH 274/278] UseSWIG: Enable NO_SONAME on swig modules (#14815) Swig modules are plugins and do not need the SONAME field set. --- Modules/UseSWIG.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 4ae6f813a..9347687b2 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -201,6 +201,7 @@ macro(SWIG_ADD_MODULE name language) MODULE ${swig_generated_sources} ${swig_other_sources}) + set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES NO_SONAME ON) string(TOLOWER "${language}" swig_lowercase_language) if ("${swig_lowercase_language}" STREQUAL "octave") set_target_properties(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") From ff2451dc2483df34a70c611836b0ea887bfa3c82 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 18 Nov 2013 12:03:58 +0100 Subject: [PATCH 275/278] ExternalProject: Strip trailing space from git hash --- Modules/ExternalProject.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 8235dda53..e56cc37d3 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -454,6 +454,7 @@ execute_process( WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code OUTPUT_VARIABLE head_sha + OUTPUT_STRIP_TRAILING_WHITESPACE ) if(error_code) message(FATAL_ERROR \"Failed to get the hash for HEAD\") @@ -479,6 +480,7 @@ execute_process( WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code OUTPUT_VARIABLE tag_sha + OUTPUT_STRIP_TRAILING_WHITESPACE ) # Is the hash checkout out that we want? From f2128d4c2886ed4ac2532834f53b9522e6586601 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 18 Nov 2013 11:36:18 +0100 Subject: [PATCH 276/278] ExternalProject: Improve handling of git remote branches ExternalProject handles git remote branches by commit hash. Due to this, the git repository ends in detached states, and local commits are discarded. Use "git rebase" for remote branches instead of "git checkout". If there are uncommitted changes, use "git stash save/pop" to save changes and restore them after the rebase. If any of these operations fails, try to restore the original status and exit with a fatal error, asking the user to resolve the conflicts manually. This also makes the behaviour of ExternalProject using git more similar to the svn version, and probably more likely to what the user expects by setting GIT_TAG to a branch. --- Modules/ExternalProject.cmake | 106 +++++++++++++++++++++++++++++++--- 1 file changed, 99 insertions(+), 7 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index e56cc37d3..e490e690a 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -473,6 +473,17 @@ else() set(is_remote_ref 0) endif() +# Tag is in the form / (i.e. origin/master) we must strip +# the remote from the tag. +if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\") + string(REGEX MATCH \"^([^/]+)/(.+)$\" _unused \"${git_tag}\") + set(git_remote \"\${CMAKE_MATCH_1}\") + set(git_tag \"\${CMAKE_MATCH_2}\") +else() + set(git_remote \"origin\") + set(git_tag \"${git_tag}\") +endif() + # This will fail if the tag does not exist (it probably has not been fetched # yet). execute_process( @@ -494,13 +505,94 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\" message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\") endif() - execute_process( - COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} - WORKING_DIRECTORY \"${work_dir}\" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") + if(is_remote_ref) + # Check if stash is needed + execute_process( + COMMAND \"${git_EXECUTABLE}\" status --porcelain + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + OUTPUT_VARIABLE repo_status + ) + if(error_code) + message(FATAL_ERROR \"Failed to get the status\") + endif() + string(LENGTH \"\${repo_status}\" need_stash) + + # If not in clean state, stash changes in order to be able to be able to + # perform git pull --rebase + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to stash changes\") + endif() + endif() + + # Pull changes from the remote branch + execute_process( + COMMAND \"${git_EXECUTABLE}\" rebase \${git_remote}/\${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Rebase failed: Restore previous state. + execute_process( + COMMAND \"${git_EXECUTABLE}\" rebase --abort + WORKING_DIRECTORY \"${work_dir}\" + ) + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + ) + endif() + message(FATAL_ERROR \"\\nFailed to rebase in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\") + endif() + + if(need_stash) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Stash pop --index failed: Try again dropping the index + execute_process( + COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --quiet + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + # Stash pop failed: Restore previous state. + execute_process( + COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet \${head_sha} + WORKING_DIRECTORY \"${work_dir}\" + ) + execute_process( + COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet + WORKING_DIRECTORY \"${work_dir}\" + ) + message(FATAL_ERROR \"\\nFailed to unstash changes in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\") + endif() + endif() + endif() + else() + execute_process( + COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\") + endif() endif() execute_process( From 2b896752567ceb771f0de0ff5afd7cd2de7205cc Mon Sep 17 00:00:00 2001 From: Jiri Malak Date: Mon, 31 Mar 2014 00:25:11 +0200 Subject: [PATCH 277/278] Ninja: Simplify code for linker commands Use GetCreateRuleVariable function instead of redundant code for Rule variable name. Use temporary variables to improve code. --- Source/cmNinjaNormalTargetGenerator.cxx | 80 +++++++++---------------- 1 file changed, 29 insertions(+), 51 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 2d1bc76df..20ce2c5ab 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -313,72 +313,49 @@ cmNinjaNormalTargetGenerator ::ComputeLinkCmd() { std::vector linkCmds; - cmTarget::TargetType targetType = this->GetTarget()->GetType(); - switch (targetType) { + cmMakefile* mf = this->GetMakefile(); + { + std::string linkCmdVar = "CMAKE_"; + linkCmdVar += this->TargetLinkLanguage; + linkCmdVar += this->GetGeneratorTarget()->GetCreateRuleVariable(); + const char *linkCmd = mf->GetDefinition(linkCmdVar); + if (linkCmd) + { + cmSystemTools::ExpandListArgument(linkCmd, linkCmds); + return linkCmds; + } + } + switch (this->GetTarget()->GetType()) { case cmTarget::STATIC_LIBRARY: { - // Check if you have a non archive way to create the static library. - { - std::string linkCmdVar = "CMAKE_"; - linkCmdVar += this->TargetLinkLanguage; - linkCmdVar += "_CREATE_STATIC_LIBRARY"; - if (const char *linkCmd = - this->GetMakefile()->GetDefinition(linkCmdVar)) - { - cmSystemTools::ExpandListArgument(linkCmd, linkCmds); - return linkCmds; - } - } - // We have archive link commands set. First, delete the existing archive. + { std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"), + mf->GetRequiredDefinition("CMAKE_COMMAND"), cmLocalGenerator::SHELL); linkCmds.push_back(cmakeCommand + " -E remove $out"); - + } // TODO: Use ARCHIVE_APPEND for archives over a certain size. { std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_CREATE"; - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); + const char *linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } { std::string linkCmdVar = "CMAKE_"; linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_FINISH"; - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); + const char *linkCmd = mf->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } return linkCmds; } case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: - case cmTarget::EXECUTABLE: { - std::string linkCmdVar = "CMAKE_"; - linkCmdVar += this->TargetLinkLanguage; - switch (targetType) { - case cmTarget::SHARED_LIBRARY: - linkCmdVar += "_CREATE_SHARED_LIBRARY"; - break; - case cmTarget::MODULE_LIBRARY: - linkCmdVar += "_CREATE_SHARED_MODULE"; - break; - case cmTarget::EXECUTABLE: - linkCmdVar += "_LINK_EXECUTABLE"; - break; - default: - assert(0 && "Unexpected target type"); - } - - const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar); - cmSystemTools::ExpandListArgument(linkCmd, linkCmds); - return linkCmds; - } + case cmTarget::EXECUTABLE: + break; default: assert(0 && "Unexpected target type"); } @@ -456,14 +433,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmMakefile* mf = this->GetMakefile(); + std::string frameworkPath; std::string linkPath; + cmGeneratorTarget* gtarget = this->GetGeneratorTarget(); this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, - this->GetGeneratorTarget()); + gtarget); this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars); @@ -480,7 +460,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ? vars["FLAGS"] : vars["ARCH_FLAGS"]); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetGeneratorTarget(), + gtarget, this->TargetLinkLanguage, this->GetConfigName()); if (targetType == cmTarget::EXECUTABLE) { @@ -490,7 +470,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } if (this->GetTarget()->HasSOName(this->GetConfigName())) { vars["SONAME_FLAG"] = - this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage); + mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME"] = this->TargetNameSO; if (targetType == cmTarget::SHARED_LIBRARY) { std::string install_name_dir = this->GetTarget() @@ -513,7 +493,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() EnsureParentDirectoryExists(impLibPath); } - cmMakefile* mf = this->GetMakefile(); if (!this->SetMsvcTargetPdbVariable(vars)) { // It is common to place debug symbols at a specific place, @@ -556,8 +535,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() for (std::vector::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { - cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), - this->GetMakefile()); + cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), mf); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, *cmdLineLists[i]); } @@ -567,7 +545,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // the link commands. if (!preLinkCmdLines.empty()) { const std::string homeOutDir = this->GetLocalGenerator() - ->ConvertToOutputFormat(this->GetMakefile()->GetHomeOutputDirectory(), + ->ConvertToOutputFormat(mf->GetHomeOutputDirectory(), cmLocalGenerator::SHELL); preLinkCmdLines.push_back("cd " + homeOutDir); } @@ -590,7 +568,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() int commandLineLengthLimit = 1; const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE"; - if (!this->GetMakefile()->IsDefinitionSet(forceRspFile) && + if (!mf->IsDefinitionSet(forceRspFile) && cmSystemTools::GetEnv(forceRspFile) == 0) { #ifdef _WIN32 commandLineLengthLimit = 8000 - linkRuleLength; From 5ada4be81bdb7695b2a4741db76ec66473ccd961 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 2 Apr 2014 00:01:06 -0400 Subject: [PATCH 278/278] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 27f2e91b8..aec1b1828 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 0) -set(CMake_VERSION_PATCH 20140401) +set(CMake_VERSION_PATCH 20140402) #set(CMake_VERSION_RC 1)