diff options
30 files changed, 121 insertions, 133 deletions
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst index 5eec009..a72af14 100644 --- a/Help/manual/cmake-server.7.rst +++ b/Help/manual/cmake-server.7.rst @@ -57,17 +57,17 @@ or using a named pipe (with the ``--pipe <NAMED_PIPE>`` parameter). When connecting to the server (via named pipe or by starting it in ``--debug`` mode), the server will reply with a hello message:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"supportedProtocolVersions":[{"major":1,"minor":0}],"type":"hello"} - ]== CMake Server ==] + ]== "CMake Server" ==] Messages sent to and from the process are wrapped in magic strings:: - [== CMake Server ==[ + [== "CMake Server" ==[ { ... some JSON message ... } - ]== CMake Server ==] + ]== "CMake Server" ==] The server is now ready to accept further requests via the named pipe or stdin. @@ -87,7 +87,7 @@ the response into the given filename. This is a response from the cmake server with "showStats" set to true:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "errorMessage":"Waiting for type \"handshake\".", @@ -100,7 +100,7 @@ This is a response from the cmake server with "showStats" set to true:: "totalTime":0.025995 } } - ]== CMake Server ==] + ]== "CMake Server" ==] The server has made a copy of this response into the file /tmp/error.txt and took 0.011 seconds to turn the JSON response into a string, and it took 0.025 @@ -137,9 +137,9 @@ contain values. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "error" @@ -150,9 +150,9 @@ contain an "errorMessage". Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","errorMessage":"Protocol version not supported.","inReplyTo":"handshake","type":"error"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "progress" @@ -181,9 +181,9 @@ box title. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","message":"Something happened.","title":"Title Text","inReplyTo":"handshake","type":"message"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "signal" @@ -208,13 +208,13 @@ an influence on the build system is changed. The "dirty" signal may look like this:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "inReplyTo":"", "name":"dirty", "type":"signal"} - ]== CMake Server ==] + ]== "CMake Server" ==] "fileChange" Signal @@ -226,7 +226,7 @@ that was detected. Possible changes are "change" and "rename". The "fileChange" signal looks like this:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"", "inReplyTo":"", @@ -234,7 +234,7 @@ The "fileChange" signal looks like this:: "path":"/absolute/CMakeLists.txt", "properties":["change"], "type":"signal"} - ]== CMake Server ==] + ]== "CMake Server" ==] Specific Message Types @@ -256,9 +256,9 @@ these requires a special command line argument when starting the cmake server mo Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"supportedProtocolVersions":[{"major":0,"minor":1}],"type":"hello"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "handshake" @@ -280,17 +280,17 @@ Protocol version 1.0 requires the following attributes to be set: Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","type":"handshake","protocolVersion":{"major":0}, "sourceDirectory":"/home/code/cmake", "buildDirectory":"/tmp/testbuild", "generator":"Ninja"} - ]== CMake Server ==] + ]== "CMake Server" ==] which will result in a response type "reply":: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"zimtstern","inReplyTo":"handshake","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] indicating that the server is ready for action. @@ -303,13 +303,13 @@ JSON structure with information on cmake state. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"globalSettings"} - ]== CMake Server ==] + ]== "CMake Server" ==] which will result in a response type "reply":: - [== CMake Server ==[ + [== "CMake Server" ==[ { "buildDirectory": "/tmp/test-build", "capabilities": { @@ -346,7 +346,7 @@ which will result in a response type "reply":: "warnUnused": false, "warnUnusedCli": true } - ]== CMake Server ==] + ]== "CMake Server" ==] Type "setGlobalSettings" @@ -364,15 +364,15 @@ The server will respond with an empty reply message or an error. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"setGlobalSettings","debugOutput":true} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply to this with:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"inReplyTo":"setGlobalSettings","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "configure" @@ -391,15 +391,15 @@ cache handling that are passed to the cmake command line client. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"configure", "cacheArguments":["-Dsomething=else"]} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply like this (after reporting progress for some time):: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","inReplyTo":"configure","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "compute" @@ -410,15 +410,15 @@ is only available after a project was successfully "configure"d. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"compute"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply (after reporting progress information):: - [== CMake Server ==[ + [== "CMake Server" ==[ {"cookie":"","inReplyTo":"compute","type":"reply"} - ]== CMake Server ==] + ]== "CMake Server" ==] Type "codemodel" @@ -521,13 +521,13 @@ sourceDirectory of the target. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"codemodel"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "configurations": [ { @@ -567,7 +567,7 @@ CMake will reply:: "inReplyTo": "codemodel", "type": "reply" } - ]== CMake Server ==] + ]== "CMake Server" ==] Type "cmakeInputs" @@ -581,13 +581,13 @@ This request is only available after a project was successfully Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"cmakeInputs"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will reply with the following information:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"buildFiles": [ {"isCMake":true,"isTemporary":false,"sources":["/usr/lib/cmake/...", ... ]}, @@ -600,7 +600,7 @@ CMake will reply with the following information:: "inReplyTo":"cmakeInputs", "type":"reply" } - ]== CMake Server ==] + ]== "CMake Server" ==] All file names are either relative to the top level source directory or absolute. @@ -619,13 +619,13 @@ list the cached configuration values. Example:: - [== CMake Server ==[ + [== "CMake Server" ==[ {"type":"cache"} - ]== CMake Server ==] + ]== "CMake Server" ==] CMake will respond with the following output:: - [== CMake Server ==[ + [== "CMake Server" ==[ { "cookie":"","inReplyTo":"cache","type":"reply", "cache": @@ -641,7 +641,7 @@ CMake will respond with the following output:: "value":"TEST"} ] } - ]== CMake Server ==] + ]== "CMake Server" ==] The output can be limited to a list of keys by passing an array of key names to the "keys" optional field of the "cache" request. @@ -655,16 +655,16 @@ command will report on the files and directories watched. Example:: - [== CMake Server ==] + [== "CMake Server" ==[ {"type":"fileSystemWatchers"} - [== CMake Server ==] + ]== "CMake Server" ==] CMake will respond with the following output:: - [== CMake Server ==] + [== "CMake Server" ==[ { "cookie":"","inReplyTo":"fileSystemWatchers","type":"reply", "watchedFiles": [ "/absolute/path" ], "watchedDirectories": [ "/absolute" ] } - [== CMake Server ==] + ]== "CMake Server" ==] diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 1d09bd5..61adf40 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -9,20 +9,22 @@ set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) + set(_ext c) else() set(_std -std) + set(_ext gnu) endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=gnu11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11") endif() if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0) set(CMAKE_C90_STANDARD_COMPILE_OPTION "${_std}=c89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=gnu89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=${_ext}89") set(CMAKE_C99_STANDARD_COMPILE_OPTION "${_std}=c99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=gnu99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=${_ext}99") endif() if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) @@ -42,6 +44,7 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) endif() unset(_std) +unset(_ext) macro(cmake_record_c_compile_features) macro(_get_intel_c_features std_version list) diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 3cc4503..73dd7fa 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -9,8 +9,10 @@ set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>") if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") set(_std -Qstd) + set(_ext c++) else() set(_std -std) + set(_ext gnu++) endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) @@ -25,15 +27,15 @@ endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}11") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=${_ext}0x") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=${_ext}98") endif() if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) @@ -50,6 +52,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) endif() unset(_std) +unset(_ext) macro(cmake_record_cxx_compile_features) macro(_get_intel_features std_version list) diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake index e56b67b..f4717d5 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake @@ -1,10 +1,6 @@ # <ndk>/build/core/toolchains/aarch64-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "aarch64-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) - # Suppress -Wl,-z,nocopyreloc flag on arm64-v8a set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) diff --git a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake index 0bcfc86..b71a674 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake @@ -1,7 +1,4 @@ # <ndk>/build/core/toolchains/aarch64-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) # Suppress -Wl,-z,nocopyreloc flag on arm64-v8a set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) diff --git a/Modules/Platform/Android/abi-armeabi-Clang.cmake b/Modules/Platform/Android/abi-armeabi-Clang.cmake index 4fc3009..b857bd3 100644 --- a/Modules/Platform/Android/abi-armeabi-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-Clang.cmake @@ -14,7 +14,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -msoft-float" " -mtune=xscale" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-GNU.cmake b/Modules/Platform/Android/abi-armeabi-GNU.cmake index 10cac00..33e8b31 100644 --- a/Modules/Platform/Android/abi-armeabi-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-GNU.cmake @@ -12,7 +12,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -msoft-float" " -mtune=xscale" - " -fpic" ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake index 15f1d4a..a7412f5 100644 --- a/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v6-Clang.cmake @@ -13,7 +13,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake index 7492de0..1fda184 100644 --- a/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-v6-GNU.cmake @@ -11,7 +11,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake index 3a3efb3..e2ab58b 100644 --- a/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake +++ b/Modules/Platform/Android/abi-armeabi-v7a-Clang.cmake @@ -23,7 +23,6 @@ string(APPEND _ANDROID_ABI_INIT_LDFLAGS string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake index d27e37e..b7c328d 100644 --- a/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake +++ b/Modules/Platform/Android/abi-armeabi-v7a-GNU.cmake @@ -17,7 +17,6 @@ endif() string(APPEND _ANDROID_ABI_INIT_CFLAGS " -mfloat-abi=softfp" - " -fpic" ) string(APPEND _ANDROID_ABI_INIT_LDFLAGS diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake index 84e7dbd..3b0eb01 100644 --- a/Modules/Platform/Android/abi-common.cmake +++ b/Modules/Platform/Android/abi-common.cmake @@ -3,6 +3,15 @@ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -no-canonical-prefixes" ) +if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE + AND NOT CMAKE_SYSTEM_VERSION VERSION_LESS 16) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() + +if(CMAKE_POSITION_INDEPENDENT_CODE) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -fPIE -pie") +endif() + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,--gc-sections") if(NOT _ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc) diff --git a/Modules/Platform/Android/abi-mips-Clang.cmake b/Modules/Platform/Android/abi-mips-Clang.cmake index bf6b9fc..73addde 100644 --- a/Modules/Platform/Android/abi-mips-Clang.cmake +++ b/Modules/Platform/Android/abi-mips-Clang.cmake @@ -1,8 +1,4 @@ # <ndk>/build/core/toolchains/mipsel-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "mipsel-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-mips-GNU.cmake b/Modules/Platform/Android/abi-mips-GNU.cmake index d380440..982ad46 100644 --- a/Modules/Platform/Android/abi-mips-GNU.cmake +++ b/Modules/Platform/Android/abi-mips-GNU.cmake @@ -1,6 +1,3 @@ # <ndk>/build/core/toolchains/mipsel-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-mips64-Clang.cmake b/Modules/Platform/Android/abi-mips64-Clang.cmake index 1a94107..603f1b2 100644 --- a/Modules/Platform/Android/abi-mips64-Clang.cmake +++ b/Modules/Platform/Android/abi-mips64-Clang.cmake @@ -1,8 +1,4 @@ # <ndk>/build/core/toolchains/mips64el-linux-android-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "mips64el-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-mips64-GNU.cmake b/Modules/Platform/Android/abi-mips64-GNU.cmake index 4525d40..a1bc2c2 100644 --- a/Modules/Platform/Android/abi-mips64-GNU.cmake +++ b/Modules/Platform/Android/abi-mips64-GNU.cmake @@ -1,6 +1,3 @@ # <ndk>/build/core/toolchains/mips64el-linux-android-4.9/setup.mk -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fpic" - ) include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-x86-Clang.cmake b/Modules/Platform/Android/abi-x86-Clang.cmake index f63ed36..fe7eace 100644 --- a/Modules/Platform/Android/abi-x86-Clang.cmake +++ b/Modules/Platform/Android/abi-x86-Clang.cmake @@ -1,8 +1,4 @@ # <ndk>/build/core/toolchains/x86-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "i686-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fPIC" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-x86_64-Clang.cmake b/Modules/Platform/Android/abi-x86_64-Clang.cmake index c15042b..3cbcd49 100644 --- a/Modules/Platform/Android/abi-x86_64-Clang.cmake +++ b/Modules/Platform/Android/abi-x86_64-Clang.cmake @@ -1,8 +1,4 @@ # <ndk>/build/core/toolchains/x86_64-clang/setup.mk set(_ANDROID_ABI_CLANG_TARGET "x86_64-none-linux-android") -string(APPEND _ANDROID_ABI_INIT_CFLAGS - " -fPIC" - ) - include(Platform/Android/abi-common-Clang) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a2acd97..c656fba 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 7) -set(CMake_VERSION_PATCH 20161024) +set(CMake_VERSION_PATCH 20161025) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 5d35f13..f46019e 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -271,7 +271,9 @@ void cmExtraSublimeTextGenerator::AppendTarget( << this->BuildMakeCommand(make, makefileName.c_str(), targetName) << "],\n"; fout << "\t\t\t\"working_dir\": \"${project_path}\",\n"; - fout << "\t\t\t\"file_regex\": \"^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$\"\n"; + fout << "\t\t\t\"file_regex\": \"" + "^(..[^:]*)(?::|\\\\()([0-9]+)(?::|\\\\))(?:([0-9]+):)?\\\\s*(.*)" + "\"\n"; fout << "\t\t}"; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 182d7e4..ee594b0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -879,20 +879,6 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath( return convPath; } -std::string cmGlobalNinjaGenerator::ConvertToNinjaFolderRule( - const std::string& path) -{ - cmLocalNinjaGenerator* ng = - static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]); - std::string convPath = ng->ConvertToRelativePath( - this->LocalGenerators[0]->GetState()->GetSourceDirectory(), path + "/all"); - convPath = this->NinjaOutputPath(convPath); -#ifdef _WIN32 - std::replace(convPath.begin(), convPath.end(), '/', '\\'); -#endif - return convPath; -} - void cmGlobalNinjaGenerator::AddCXXCompileCommand( const std::string& commandLine, const std::string& sourceFile) { @@ -1119,11 +1105,11 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) this->LocalGenerators.begin(); lgi != this->LocalGenerators.end(); ++lgi) { cmLocalGenerator const* lg = *lgi; - const std::string currentSourceFolder( - lg->GetStateSnapshot().GetDirectory().GetCurrentSource()); + const std::string currentBinaryFolder( + lg->GetStateSnapshot().GetDirectory().GetCurrentBinary()); // The directory-level rule should depend on the target-level rules // for all targets in the directory. - targetsPerFolder[currentSourceFolder] = cmNinjaDeps(); + targetsPerFolder[currentBinaryFolder] = cmNinjaDeps(); for (std::vector<cmGeneratorTarget*>::const_iterator ti = lg->GetGeneratorTargets().begin(); ti != lg->GetGeneratorTargets().end(); ++ti) { @@ -1136,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) type == cmStateEnums::OBJECT_LIBRARY || type == cmStateEnums::UTILITY) && !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { - targetsPerFolder[currentSourceFolder].push_back(gt->GetName()); + targetsPerFolder[currentBinaryFolder].push_back(gt->GetName()); } } @@ -1147,28 +1133,30 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) for (std::vector<cmStateSnapshot>::const_iterator stateIt = children.begin(); stateIt != children.end(); ++stateIt) { - targetsPerFolder[currentSourceFolder].push_back( - this->ConvertToNinjaFolderRule( - stateIt->GetDirectory().GetCurrentSource())); + std::string const currentBinaryDir = + stateIt->GetDirectory().GetCurrentBinary(); + + targetsPerFolder[currentBinaryFolder].push_back( + this->ConvertToNinjaPath(currentBinaryDir + "/all")); } } - std::string const rootSourceDir = - this->LocalGenerators[0]->GetSourceDirectory(); + std::string const rootBinaryDir = + this->LocalGenerators[0]->GetBinaryDirectory(); for (std::map<std::string, cmNinjaDeps>::const_iterator it = targetsPerFolder.begin(); it != targetsPerFolder.end(); ++it) { cmGlobalNinjaGenerator::WriteDivider(os); - std::string const& currentSourceDir = it->first; + std::string const& currentBinaryDir = it->first; - // Do not generate a rule for the root source dir. - if (rootSourceDir.length() >= currentSourceDir.length()) { + // Do not generate a rule for the root binary dir. + if (rootBinaryDir.length() >= currentBinaryDir.length()) { continue; } - std::string const comment = "Folder: " + currentSourceDir; + std::string const comment = "Folder: " + currentBinaryDir; cmNinjaDeps output(1); - output.push_back(this->ConvertToNinjaFolderRule(currentSourceDir)); + output.push_back(this->ConvertToNinjaPath(currentBinaryDir + "/all")); this->WritePhonyBuild(os, comment, output, it->second); } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 1084469..81ec3eb 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -241,7 +241,6 @@ public: } std::string ConvertToNinjaPath(const std::string& path) const; - std::string ConvertToNinjaFolderRule(const std::string& path); struct MapToNinjaPathImpl { diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h index c82274a..2d64cbd 100644 --- a/Source/cmServerDictionary.h +++ b/Source/cmServerDictionary.h @@ -87,8 +87,8 @@ static const std::string kWARN_UNUSED_KEY = "warnUnused"; static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories"; static const std::string kWATCHED_FILES_KEY = "watchedFiles"; -static const std::string kSTART_MAGIC = "[== CMake Server ==["; -static const std::string kEND_MAGIC = "]== CMake Server ==]"; +static const std::string kSTART_MAGIC = "[== \"CMake Server\" ==["; +static const std::string kEND_MAGIC = "]== \"CMake Server\" ==]"; static const std::string kRENAME_PROPERTY_VALUE = "rename"; static const std::string kCHANGE_PROPERTY_VALUE = "change"; diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 446dc3c..7b4e51e 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -51,14 +51,23 @@ function(run_SubDir) set(SubDir_all [[SubDir\all]]) set(SubDir_test [[SubDir\test]]) set(SubDir_install [[SubDir\install]]) + set(SubDirBinary_test [[SubDirBinary\test]]) + set(SubDirBinary_all [[SubDirBinary\all]]) + set(SubDirBinary_install [[SubDirBinary\install]]) else() set(SubDir_all [[SubDir/all]]) set(SubDir_test [[SubDir/test]]) set(SubDir_install [[SubDir/install]]) + set(SubDirBinary_all [[SubDirBinary/all]]) + set(SubDirBinary_test [[SubDirBinary/test]]) + set(SubDirBinary_install [[SubDirBinary/install]]) endif() run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all}) run_cmake_command(SubDir-test ${CMAKE_COMMAND} --build . --target ${SubDir_test}) run_cmake_command(SubDir-install ${CMAKE_COMMAND} --build . --target ${SubDir_install}) + run_cmake_command(SubDirBinary-build ${CMAKE_COMMAND} --build . --target ${SubDirBinary_all}) + run_cmake_command(SubDirBinary-test ${CMAKE_COMMAND} --build . --target ${SubDirBinary_test}) + run_cmake_command(SubDirBinary-install ${CMAKE_COMMAND} --build . --target ${SubDirBinary_install}) endfunction() run_SubDir() diff --git a/Tests/RunCMake/Ninja/SubDir.cmake b/Tests/RunCMake/Ninja/SubDir.cmake index d227753..11f467a 100644 --- a/Tests/RunCMake/Ninja/SubDir.cmake +++ b/Tests/RunCMake/Ninja/SubDir.cmake @@ -1,5 +1,6 @@ include(CTest) add_subdirectory(SubDir) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/SubDirSource SubDirBinary) add_custom_target(TopFail ALL COMMAND does_not_exist) add_test(NAME TopTest COMMAND ${CMAKE_COMMAND} -E echo "Running TopTest") install(CODE [[ diff --git a/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt new file mode 100644 index 0000000..244eaa0 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-build-stdout.txt @@ -0,0 +1 @@ +Building SubDirSourceInAll diff --git a/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt new file mode 100644 index 0000000..6b6c6dd --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-install-stdout.txt @@ -0,0 +1 @@ +-- Installing SubDirSource diff --git a/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt new file mode 100644 index 0000000..d6d6605 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirBinary-test-stdout.txt @@ -0,0 +1 @@ +1/1 Test #1: SubDirSourceTest diff --git a/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt new file mode 100644 index 0000000..2664261 --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirSource/CMakeLists.txt @@ -0,0 +1,6 @@ +add_custom_target(SubDirSourceFail COMMAND does_not_exist) +add_custom_target(SubDirSourceInAll ALL COMMAND ${CMAKE_COMMAND} -E echo "Building SubDirSourceInAll") +add_test(NAME SubDirSourceTest COMMAND ${CMAKE_COMMAND} -E echo "Running SubDirSourceTest") +install(CODE [[ + message(STATUS "Installing SubDirSource") +]]) diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py index 94384eb..d11431d 100644 --- a/Tests/Server/cmakelib.py +++ b/Tests/Server/cmakelib.py @@ -46,11 +46,11 @@ def waitForRawMessage(cmakeCommand): stdoutdata += stdoutdataLine.decode('utf-8') else: break - begin = stdoutdata.find("[== CMake Server ==[\n") - end = stdoutdata.find("]== CMake Server ==]") + begin = stdoutdata.find('[== "CMake Server" ==[\n') + end = stdoutdata.find(']== "CMake Server" ==]') if (begin != -1 and end != -1): - begin += len("[== CMake Server ==[\n") + begin += len('[== "CMake Server" ==[\n') payload = stdoutdata[begin:end] if print_communication: print("\nSERVER>", json.loads(payload), "\n") @@ -59,9 +59,9 @@ def waitForRawMessage(cmakeCommand): def writeRawData(cmakeCommand, content): writeRawData.counter += 1 payload = """ -[== CMake Server ==[ +[== "CMake Server" ==[ %s -]== CMake Server ==] +]== "CMake Server" ==] """ % content rn = ( writeRawData.counter % 2 ) == 0 |