diff options
97 files changed, 757 insertions, 227 deletions
diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 24ac58d..873af8f 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -19,7 +19,6 @@ endif() if(CMAKE_GENERATOR MATCHES "Visual Studio 6") set(CMAKE_SKIP_COMPATIBILITY_TESTS 1) endif() -include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$") set(_INTEL_WINDOWS 1) @@ -54,6 +53,14 @@ if(CMAKE_SYSTEM MATCHES "OSF1-V.*") endif() endif() +if(CMAKE_SYSTEM_NAME MATCHES "HP-UX" AND CMAKE_CXX_COMPILER_ID MATCHES "HP") + # it is known that version 3.85 fails and 6.25 works without these flags + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4) + # use new C++ library and improved template support + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98") + endif() +endif() + # use the ansi CXX compile flag for building cmake if (CMAKE_ANSI_CXXFLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") @@ -68,3 +75,5 @@ endif () if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text._*") endif () + +include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index b763882..4b895fe 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -103,3 +103,4 @@ All Policies /policy/CMP0049 /policy/CMP0050 /policy/CMP0051 + /policy/CMP0052 diff --git a/Help/policy/CMP0052.rst b/Help/policy/CMP0052.rst new file mode 100644 index 0000000..f857f36 --- /dev/null +++ b/Help/policy/CMP0052.rst @@ -0,0 +1,21 @@ +CMP0052 +------- + +Reject source and build dirs in installed INTERFACE_INCLUDE_DIRECTORIES. + +CMake 3.0 and lower allowed subdirectories of the source directory or build +directory to be in the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of +installed and exported targets, if the directory was also a subdirectory of +the installation prefix. This makes the installation depend on the +existence of the source dir or binary dir, and the installation will be +broken if either are removed after installation. + +The OLD behavior for this policy is to export the content of the +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` with the source or binary +directory. The NEW behavior for this +policy is to issue an error if such a directory is used. + +This policy was introduced in CMake version 3.1. +CMake version |release| warns when the policy is not set and uses +``OLD`` behavior. Use the :command:`cmake_policy` command to set it +to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/release/dev/CMP0052.rst b/Help/release/dev/CMP0052.rst new file mode 100644 index 0000000..adb3d44 --- /dev/null +++ b/Help/release/dev/CMP0052.rst @@ -0,0 +1,5 @@ +CMP0052 +------- + +* Policy :policy:`CMP0052` introduced to control directories in the + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of exported targets. diff --git a/Help/release/dev/ExternalProject_exclude-from-all.rst b/Help/release/dev/ExternalProject_exclude-from-all.rst new file mode 100644 index 0000000..1d62b3a --- /dev/null +++ b/Help/release/dev/ExternalProject_exclude-from-all.rst @@ -0,0 +1,11 @@ +ExternalProject_exclude-from-all +-------------------------------- + +* The :module:`ExternalProject` module ``ExternalProject_Add`` command + learned a new ``EXCLUDE_FROM_ALL`` option to cause the external + project target to have the :prop_tgt:`EXCLUDE_FROM_ALL` target + property set. + +* The :module:`ExternalProject` module ``ExternalProject_Add_Step`` command + learned a new ``EXCLUDE_FROM_MAIN`` option to cause the step to not be + a direct dependency of the main external project target. diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 353aed6..2854387 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -2,15 +2,15 @@ # CMakeDetermineVSServicePack # --------------------------- # -# Determine the Visual Studio service pack of the 'cl' in use. +# Deprecated. Do not use. # -# The functionality of this module has been superseded by the platform -# variable CMAKE_<LANG>_COMPILER_VERSION that contains the compiler -# version number. +# The functionality of this module has been superseded by the +# :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable that contains +# the compiler version number. # -# Usage: +# Determine the Visual Studio service pack of the 'cl' in use. # -# :: +# Usage:: # # if(MSVC) # include(CMakeDetermineVSServicePack) @@ -21,14 +21,12 @@ # endif() # # Function DetermineVSServicePack sets the given variable to one of the -# following values or an empty string if unknown: -# -# :: +# following values or an empty string if unknown:: # # vc80, vc80sp1 # vc90, vc90sp1 # vc100, vc100sp1 -# vc110, vc110sp1, vc110sp2 +# vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4 #============================================================================= # Copyright 2009-2013 Kitware, Inc. @@ -68,6 +66,8 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc110sp2") elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1") set(_version "vc110sp3") + elseif(${_cl_version} VERSION_EQUAL "17.00.61030") + set(_version "vc110sp4") else() set(_version "") endif() @@ -86,27 +86,14 @@ function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VER OUTPUT_QUIET ) - string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" - _cl_version "${_output}") - - if(_cl_version) - string(REGEX MATCHALL "[0-9]+" - _cl_version_list "${_cl_version}") - list(GET _cl_version_list 0 _major) - list(GET _cl_version_list 1 _minor) - list(GET _cl_version_list 2 _patch) - list(GET _cl_version_list 3 _tweak) - + if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)") + set(_cl_version ${CMAKE_MATCH_1}) + set(_major ${CMAKE_MATCH_2}) + set(_minor ${CMAKE_MATCH_3}) if("${_major}${_minor}" STREQUAL "${MSVC_VERSION}") - set(_cl_version ${_major}.${_minor}.${_patch}.${_tweak}) - else() - unset(_cl_version) - endif() - endif() - - if(_cl_version) set(${_SUCCESS_VAR} true PARENT_SCOPE) set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE) + endif() endif() endif() endfunction() @@ -127,20 +114,9 @@ function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSI file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc") - string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" - _cl_version "${_output}") - - if(_cl_version) - string(REGEX MATCHALL "[0-9]+" - _cl_version_list "${_cl_version}") - - list(GET _cl_version_list 0 _major) - list(GET _cl_version_list 1 _minor) - list(GET _cl_version_list 2 _patch) - list(GET _cl_version_list 3 _tweak) - + if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)") set(${_SUCCESS_VAR} true PARENT_SCOPE) - set(${_VERSION_VAR} ${_major}.${_minor}.${_patch}.${_tweak} PARENT_SCOPE) + set(${_VERSION_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE) endif() endfunction() diff --git a/Modules/CMakeFortranCompilerABI.F b/Modules/CMakeFortranCompilerABI.F index 21ca7ff..b34c284 100644 --- a/Modules/CMakeFortranCompilerABI.F +++ b/Modules/CMakeFortranCompilerABI.F @@ -10,11 +10,15 @@ PRINT *, 'INFO:sizeof_dptr[8]' #elif defined(_M_AMD64) PRINT *, 'INFO:sizeof_dptr[8]' +#elif defined(__x86_64__) + PRINT *, 'INFO:sizeof_dptr[8]' #elif defined(_ILP32) PRINT *, 'INFO:sizeof_dptr[4]' #elif defined(_M_IX86) PRINT *, 'INFO:sizeof_dptr[4]' +#elif defined(__i386__) + PRINT *, 'INFO:sizeof_dptr[4]' #elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8 PRINT *, 'INFO:sizeof_dptr[8]' diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake index 8ffe50a..6bb2636 100644 --- a/Modules/CMakeRCInformation.cmake +++ b/Modules/CMakeRCInformation.cmake @@ -13,15 +13,16 @@ # License text for the above reference.) -# This file sets the basic flags for the Fortran language in CMake. +# This file sets the basic flags for the Windows Resource Compiler. # It also loads the available platform file for the system-compiler # if it exists. # make sure we don't use CMAKE_BASE_NAME from somewhere else set(CMAKE_BASE_NAME) -get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE) -if("${CMAKE_BASE_NAME}" MATCHES "windres") - set(CMAKE_BASE_NAME "windres") +if(CMAKE_RC_COMPILER MATCHES "windres[^/]*$") + set(CMAKE_BASE_NAME "windres") +else() + get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE) endif() set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake) @@ -30,7 +31,7 @@ include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL) set (CMAKE_RC_FLAGS "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CACHE STRING - "Flags for Fortran compiler.") + "Flags for Windows Resource Compiler.") # These are the only types of flags that should be passed to the rc # command, if COMPILE_FLAGS is used on a target this will be used diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 0f651e9..3ba91de 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1352,7 +1352,7 @@ function(_ep_add_download_command name) if(cmd_set) set(work_dir ${download_dir}) elseif(cvs_repository) - find_package(CVS) + find_package(CVS QUIET) if(NOT CVS_EXECUTABLE) message(FATAL_ERROR "error: could not find cvs for checkout of ${name}") endif() @@ -1379,7 +1379,7 @@ function(_ep_add_download_command name) set(cmd ${CVS_EXECUTABLE} -d ${cvs_repository} -q co ${cvs_tag} -d ${src_name} ${cvs_module}) list(APPEND depends ${stamp_dir}/${name}-cvsinfo.txt) elseif(svn_repository) - find_package(Subversion) + find_package(Subversion QUIET) if(NOT Subversion_SVN_EXECUTABLE) message(FATAL_ERROR "error: could not find svn for checkout of ${name}") endif() @@ -1415,7 +1415,7 @@ function(_ep_add_download_command name) --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name}) list(APPEND depends ${stamp_dir}/${name}-svninfo.txt) elseif(git_repository) - find_package(Git) + find_package(Git QUIET) if(NOT GIT_EXECUTABLE) message(FATAL_ERROR "error: could not find git for clone of ${name}") endif() @@ -1463,7 +1463,7 @@ function(_ep_add_download_command name) set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) list(APPEND depends ${stamp_dir}/${name}-gitinfo.txt) elseif(hg_repository) - find_package(Hg) + find_package(Hg QUIET) if(NOT HG_EXECUTABLE) message(FATAL_ERROR "error: could not find hg for clone of ${name}") endif() diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake deleted file mode 100644 index a4c122d..0000000 --- a/Modules/Platform/Android.cmake +++ /dev/null @@ -1,5 +0,0 @@ -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 "") diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index 72a5929..ac410de 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/Modules/Platform/Windows-wcl386.cmake @@ -51,7 +51,7 @@ set(CMAKE_C_CREATE_IMPORT_LIBRARY set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) set(CMAKE_C_LINK_EXECUTABLE - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) @@ -73,7 +73,7 @@ set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") set(CMAKE_CXX_CREATE_SHARED_LIBRARY - "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") string(REPLACE " option implib=<TARGET_IMPLIB>" "" CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index aca8996..23c4fc0 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -103,7 +103,7 @@ endmacro() # helper macro to set up a moc rule -macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) +function (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) # For Windows, create a parameters file to work around command line length limit # Pass the parameters in a file. Set the working directory to # be that containing the parameters file and reference it by @@ -144,7 +144,7 @@ macro (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target) DEPENDS ${infile} ${_moc_parameters_file} ${_moc_working_dir} VERBATIM) -endmacro () +endfunction () macro (QT4_GENERATE_MOC infile outfile ) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7b9db16..cf4b121 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 20140403) +set(CMake_VERSION_PATCH 20140414) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index efd3bef..e780f0e 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -22,9 +22,10 @@ // Forward declarations are insufficient since we use them in // std::map data members below... -#define cmCPackTypeMacro(class, superclass) \ - cmTypeMacro(class, superclass); \ - static cmCPackGenerator* CreateGenerator() { return new class; } +#define cmCPackTypeMacro(klass, superclass) \ + cmTypeMacro(klass, superclass); \ + static cmCPackGenerator* CreateGenerator() { return new klass; } \ + class cmCPackTypeMacro_UseTrailingSemicolon #define cmCPackLogger(logType, msg) \ do { \ diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 9f711b7..d797d3b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -217,8 +217,6 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method, url += "?" + fields; } break; - default: - break; } ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 836e41d..246294f 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -134,7 +134,7 @@ public: /* * Is the tomorrow tag set? */ - bool GetTomorrowTag() { return this->TomorrowTag; }; + bool GetTomorrowTag() { return this->TomorrowTag; } /** * Try to run tests of the project @@ -167,7 +167,7 @@ public: * Set the cmake test mode (experimental, nightly, continuous). */ void SetTestModel(int mode); - int GetTestModel() { return this->TestModel; }; + int GetTestModel() { return this->TestModel; } std::string GetTestModelString(); static int GetTestModelFromString(const char* str); @@ -392,7 +392,7 @@ public: int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf); std::vector<std::string> &GetInitialCommandLineArguments() - { return this->InitialCommandLineArguments; }; + { return this->InitialCommandLineArguments; } //! Set the track to submit to void SetSpecificTrack(const char* track); diff --git a/Source/cmCommand.h b/Source/cmCommand.h index b15869a..a34ea71 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -81,7 +81,7 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - virtual void FinalPass() {}; + virtual void FinalPass() {} /** * Does this command have a final pass? Query after InitialPass. diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx index e62e53e..e23ef8a 100644 --- a/Source/cmCommandArgumentLexer.cxx +++ b/Source/cmCommandArgumentLexer.cxx @@ -1069,7 +1069,7 @@ case YY_STATE_EOF(NOESCAPES): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happend but it should silence a warning */ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmCommandArgument_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 0d3c6bb..74e17b6 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -38,7 +38,7 @@ cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) std::string cmCryptoHash::HashString(const std::string& input) { this->Initialize(); - this->Append(reinterpret_cast<unsigned char const*>(&input[0]), + this->Append(reinterpret_cast<unsigned char const*>(input.c_str()), static_cast<int>(input.size())); return this->Finalize(); } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index b293c5b..4f6517e 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -32,7 +32,7 @@ public: cmDepends(cmLocalGenerator* lg=0, const char* targetDir=""); /** at what level will the compile be done from */ - void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;}; + void SetCompileDirectory(const char *dir) {this->CompileDirectory = dir;} /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx index 1e505a5..f7676d9 100644 --- a/Source/cmDependsJavaLexer.cxx +++ b/Source/cmDependsJavaLexer.cxx @@ -1591,7 +1591,7 @@ case YY_STATE_EOF(string): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happen but it silences a warning*/ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmDependsJava_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h index acf8011..d038b5c 100644 --- a/Source/cmDynamicLoader.h +++ b/Source/cmDynamicLoader.h @@ -36,8 +36,8 @@ public: static void FlushCache(); protected: - cmDynamicLoader() {}; - ~cmDynamicLoader() {}; + cmDynamicLoader() {} + ~cmDynamicLoader() {} private: cmDynamicLoader(const cmDynamicLoader&); // Not implemented. diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 1488924..5c94a97 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -24,7 +24,7 @@ class cmExecutionStatus : public cmObject public: cmTypeMacro(cmExecutionStatus, cmObject); - cmExecutionStatus() { this->Clear();}; + cmExecutionStatus() { this->Clear();} virtual void SetReturnInvoked(bool val) { this->ReturnInvoked = val; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index b38c48b..42fce6d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -279,7 +279,43 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (isSubDirectory(li->c_str(), installDir)) { - continue; + // The include directory is inside the install tree. If the + // install tree is not inside the source tree or build tree then + // fall through to the checks below that the include directory is not + // also inside the source tree or build tree. + bool shouldContinue = + isSubDirectory(installDir, topBinaryDir) + || isSubDirectory(installDir, topSourceDir); + + if (!shouldContinue) + { + switch(target->GetPolicyStatusCMP0052()) + { + case cmPolicies::WARN: + { + cmOStringStream s; + s << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << "Directory:\n \"" << *li << "\"\nin " + "INTERFACE_INCLUDE_DIRECTORIES of target \"" + << target->GetName() << "\" is a subdirectory of the install " + "directory:\n \"" << installDir << "\""; + target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, + s.str()); + } + case cmPolicies::OLD: + shouldContinue = true; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; + } + } + if (shouldContinue) + { + continue; + } } if (isSubDirectory(li->c_str(), topBinaryDir)) { diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx index aa384cd..4704f03 100644 --- a/Source/cmExprLexer.cxx +++ b/Source/cmExprLexer.cxx @@ -976,7 +976,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happen but it silences a warning*/ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmExpr_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 3ff527d..3580374 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -20,7 +20,7 @@ public: cmFunctionHelperCommand() {} ///! clean up any memory allocated by the function - ~cmFunctionHelperCommand() {}; + ~cmFunctionHelperCommand() {} /** * This is used to avoid including this command @@ -59,7 +59,7 @@ public: cmExecutionStatus &); virtual bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus &) { return false; }; + cmExecutionStatus &) { return false; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 01fad26..ec5ce9e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -606,12 +606,13 @@ private: cmGlobalGenerator const* GlobalGenerator; typedef cmGeneratorTarget::SourceEntry SourceEntry; SourceEntry* CurrentEntry; - std::queue<std::string> SourceQueue; - std::set<std::string> SourcesQueued; + std::queue<cmSourceFile*> SourceQueue; + std::set<cmSourceFile*> SourcesQueued; typedef std::map<std::string, cmSourceFile*> NameMapType; NameMapType NameMap; + std::vector<std::string> NewSources; - void QueueSource(std::string const& name); + void QueueSource(cmSourceFile* sf); void FollowName(std::string const& name); void FollowNames(std::vector<std::string> const& names); bool IsUtility(std::string const& dep); @@ -636,26 +637,26 @@ cmTargetTraceDependencies // Queue all the source files already specified for the target. if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY) { - std::vector<std::string> sources; std::vector<std::string> configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { configs.push_back(""); } + std::set<cmSourceFile*> emitted; for(std::vector<std::string>::const_iterator ci = configs.begin(); ci != configs.end(); ++ci) { + std::vector<cmSourceFile*> sources; this->Target->GetSourceFiles(sources, *ci); - } - std::set<std::string> emitted; - for(std::vector<std::string>::const_iterator si = sources.begin(); - si != sources.end(); ++si) - { - if(emitted.insert(*si).second && this->SourcesQueued.insert(*si).second) + for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); + si != sources.end(); ++si) { - this->SourceQueue.push(*si); - this->Makefile->GetOrCreateSource(*si); + cmSourceFile* sf = *si; + if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second) + { + this->SourceQueue.push(sf); + } } } } @@ -673,8 +674,7 @@ void cmTargetTraceDependencies::Trace() while(!this->SourceQueue.empty()) { // Get the next source from the queue. - std::string src = this->SourceQueue.front(); - cmSourceFile* sf = this->Makefile->GetSource(src); + cmSourceFile* sf = this->SourceQueue.front(); this->SourceQueue.pop(); this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf]; @@ -699,17 +699,19 @@ void cmTargetTraceDependencies::Trace() } } this->CurrentEntry = 0; + + this->Target->AddTracedSources(this->NewSources); } //---------------------------------------------------------------------------- -void cmTargetTraceDependencies::QueueSource(std::string const& name) +void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf) { - if(this->SourcesQueued.insert(name).second) + if(this->SourcesQueued.insert(sf).second) { - this->SourceQueue.push(name); + this->SourceQueue.push(sf); - // Make sure this file is in the target. - this->Target->AddSource(name); + // Make sure this file is in the target at the end. + this->NewSources.push_back(sf->GetFullPath()); } } @@ -731,7 +733,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) { this->CurrentEntry->Depends.push_back(sf); } - this->QueueSource(sf->GetFullPath()); + this->QueueSource(sf); } } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 54f5f3b..82fb1e5 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -51,7 +51,7 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); ///! Get the name for this generator - virtual std::string GetName() const { return "Generic"; }; + virtual std::string GetName() const { return "Generic"; } /** Check whether the given name matches the current generator. */ virtual bool MatchesGeneratorName(const std::string& name) const diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index b9de845..814c052 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -58,7 +58,7 @@ public: * the CMakeLists.txt file. */ virtual bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus &) { return false;}; + cmExecutionStatus &) { return false;} /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index dcf9f97..8e56d2f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -689,6 +689,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string createRule = "CMAKE_"; createRule += llang; createRule += target.GetCreateRuleVariable(); + bool useWatcomQuote = this->Makefile->IsOn(createRule+"_USE_WATCOM_QUOTE"); std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: @@ -700,7 +701,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string flags; // should be set std::string linkFlags; // should be set this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - &target); + &target, useWatcomQuote); linkLibs = frameworkPath + linkPath + linkLibs; cmLocalGenerator::RuleVariables vars; vars.Language = llang.c_str(); @@ -1611,7 +1612,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, - cmGeneratorTarget* target) + cmGeneratorTarget* target, + bool useWatcomQuote) { std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -1675,7 +1677,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false, false); + *target, false, false, useWatcomQuote); } break; case cmTarget::EXECUTABLE: @@ -1700,7 +1702,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } this->AddLanguageFlags(flags, linkLanguage, buildType); this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false, false); + *target, false, false, useWatcomQuote); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { @@ -1759,9 +1761,8 @@ 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 - // Watcom. - if(this->Makefile->IsOn("MSVC60") || this->Makefile->IsOn("WATCOM")) + // Work-ardound command line parsing limitations in MSVC 6.0 + if(this->Makefile->IsOn("MSVC60")) { // Search for the last space. std::string::size_type pos = lib.rfind(' '); @@ -1798,9 +1799,11 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, std::string& linkPath, cmGeneratorTarget &tgt, bool relink, - bool forResponseFile) + bool forResponseFile, + bool useWatcomQuote) { - OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL; + OutputFormat shellFormat = (forResponseFile) ? RESPONSE : + ((useWatcomQuote) ? WATCOMQUOTE : SHELL); bool escapeAllowMakeVars = !forResponseFile; cmOStringStream fout; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -2283,7 +2286,6 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: - default: return false; } } @@ -2595,7 +2597,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, { result = cmSystemTools::ConvertToOutputPath(result.c_str()); } - else if( output == SHELL) + else if(output == SHELL || output == WATCOMQUOTE) { // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to @@ -2617,11 +2619,11 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, pos++; } } - result = this->EscapeForShell(result, true, false); + result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); } else if(output == RESPONSE) { - result = this->EscapeForShell(result, false, false); + result = this->EscapeForShell(result, false, false, false); } return result; } @@ -3248,7 +3250,8 @@ static bool cmLocalGeneratorIsShellOperator(const std::string& str) //---------------------------------------------------------------------------- std::string cmLocalGenerator::EscapeForShell(const std::string& str, bool makeVars, - bool forEcho) + bool forEcho, + bool useWatcomQuote) { // Do not escape shell operators. if(cmLocalGeneratorIsShellOperator(str)) @@ -3274,6 +3277,10 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, { flags |= cmsysSystem_Shell_Flag_EchoWindows; } + if(useWatcomQuote) + { + flags |= cmsysSystem_Shell_Flag_WatcomQuote; + } if(this->WatcomWMake) { flags |= cmsysSystem_Shell_Flag_WatcomWMake; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 61488fe..8090b34 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -76,17 +76,17 @@ public: ///! Get the makefile for this generator cmMakefile *GetMakefile() { - return this->Makefile; }; + return this->Makefile; } ///! Get the makefile for this generator, const version const cmMakefile *GetMakefile() const { - return this->Makefile; }; + return this->Makefile; } ///! Get the GlobalGenerator this is associated with cmGlobalGenerator *GetGlobalGenerator() { - return this->GlobalGenerator; }; + return this->GlobalGenerator; } const cmGlobalGenerator *GetGlobalGenerator() const { - return this->GlobalGenerator; }; + return this->GlobalGenerator; } ///! Set the Global Generator, done on creation by the GlobalGenerator void SetGlobalGenerator(cmGlobalGenerator *gg); @@ -106,7 +106,7 @@ public: * path setting */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE }; + enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, WATCOMQUOTE, RESPONSE }; std::string ConvertToOutputFormat(const std::string& source, OutputFormat output); std::string Convert(const std::string& remote, RelativeRoot local, @@ -135,7 +135,7 @@ public: ///! set/get the children void AddChild(cmLocalGenerator* g) { this->Children.push_back(g); } - std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; }; + std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; } void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, @@ -288,7 +288,8 @@ public: escapes for the special case of passing to the native echo command. */ std::string EscapeForShell(const std::string& str, bool makeVars = false, - bool forEcho = false); + bool forEcho = false, + bool useWatcomQuote = false); /** Backwards-compatibility version of EscapeForShell. */ std::string EscapeForShellOldStyle(const std::string& str); @@ -370,7 +371,8 @@ public: std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, - cmGeneratorTarget* target); + cmGeneratorTarget* target, + bool useWatcomQuote); virtual void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, @@ -383,7 +385,8 @@ protected: std::string& linkPath, cmGeneratorTarget &, bool relink, - bool forResponseFile); + bool forResponseFile, + bool useWatcomQuote); // Expand rule variables in CMake of the type found in language rules void ExpandRuleVariables(std::string& string, diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9f569e1..ae81c58 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -20,7 +20,7 @@ public: cmMacroHelperCommand() {} ///! clean up any memory allocated by the macro - ~cmMacroHelperCommand() {}; + ~cmMacroHelperCommand() {} /** * This is used to avoid including this command @@ -60,7 +60,7 @@ public: cmExecutionStatus &); virtual bool InitialPass(std::vector<std::string> const&, - cmExecutionStatus &) { return false; }; + cmExecutionStatus &) { return false; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index b1d6fe2..1328974 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3365,7 +3365,6 @@ std::string cmMakefile::GetModulesFile(const char* filename) const case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: - default: result = moduleInCMakeRoot; break; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8ff6daa..7695d6e 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -601,8 +601,11 @@ public: */ std::vector<std::string> GetDefinitions(int cacheonly=0) const; - /** Test a boolean cache entry to see if it is true or false, - * returns false if no entry defined. + /** + * Test a boolean variable to see if it is true or false. + * If the variable is not found in this makefile instance, the + * cache is then queried. + * Returns false if no entry defined. */ bool IsOn(const std::string& name) const; bool IsSet(const std::string& name) const; @@ -815,7 +818,7 @@ public: const std::string& config); // Get the properties - cmPropertyMap &GetProperties() { return this->Properties; }; + cmPropertyMap &GetProperties() { return this->Properties; } ///! Initialize a makefile from its parent void InitializeFromParent(); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 701d5a0..fc52ccc 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -290,7 +290,6 @@ 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<std::string> commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -333,12 +332,15 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Expand the rule variables. { + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Set path conversion for link script shells. this->LocalGenerator->SetLinkScriptShell(useLinkScript); // Collect up flags to link in needed libraries. std::string linkLibs; - this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends, + useWatcomQuote); // Construct object file lists that may be needed to expand the // rule. @@ -357,7 +359,12 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); - vars.Target = targetOutPathReal.c_str(); + cmLocalGenerator::OutputFormat output = (useWatcomQuote) ? + cmLocalGenerator::WATCOMQUOTE : cmLocalGenerator::SHELL; + std::string target = this->Convert(targetFullPathReal, + cmLocalGenerator::START_OUTPUT, + output); + vars.Target = target.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); // Setup the target version. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 754f62f..7ac0256 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -458,8 +458,6 @@ 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(); @@ -541,6 +539,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Expand the rule variables. std::vector<std::string> real_link_commands; { + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Set path conversion for link script shells. this->LocalGenerator->SetLinkScriptShell(useLinkScript); @@ -548,7 +548,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string linkLibs; if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { - this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends, + useWatcomQuote); } // Construct object file lists that may be needed to expand the @@ -587,7 +588,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); - vars.Target = targetOutPathReal.c_str(); + cmLocalGenerator::OutputFormat output = (useWatcomQuote) ? + cmLocalGenerator::WATCOMQUOTE : cmLocalGenerator::SHELL; + std::string target = this->Convert(targetFullPathReal, + cmLocalGenerator::START_OUTPUT, + output); + vars.Target = target.c_str(); vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); if (this->Target->HasSOName(this->ConfigName)) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f940ac4..d4723ad 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1826,14 +1826,16 @@ void cmMakefileTargetGenerator ::CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile, - std::vector<std::string>& makefile_depends) + std::vector<std::string>& makefile_depends, + bool useWatcomQuote) { std::string frameworkPath; std::string linkPath; this->LocalGenerator ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *this->GeneratorTarget, relink, - useResponseFile); + useResponseFile, + useWatcomQuote); linkLibs = frameworkPath + linkPath + linkLibs; if(useResponseFile) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index ff94660..9fac574 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -168,7 +168,8 @@ protected: /** Create list of flags for link libraries. */ void CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile, - std::vector<std::string>& makefile_depends); + std::vector<std::string>& makefile_depends, + bool useWatcomQuote); /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, diff --git a/Source/cmNewLineStyle.cxx b/Source/cmNewLineStyle.cxx index a7d7429..08f0b5b 100644 --- a/Source/cmNewLineStyle.cxx +++ b/Source/cmNewLineStyle.cxx @@ -76,8 +76,6 @@ const std::string cmNewLineStyle::GetCharacters() const return "\n"; case CRLF: return "\r\n"; - default: - ; } return ""; } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1d0336a..c865617 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -439,12 +439,18 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string frameworkPath; std::string linkPath; cmGeneratorTarget* gtarget = this->GetGeneratorTarget(); + + std::string createRule = "CMAKE_"; + createRule += this->TargetLinkLanguage; + createRule += gtarget->GetCreateRuleVariable(); + bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE"); this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, - gtarget); + gtarget, + useWatcomQuote); this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 56155ef..cb6eb90 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -494,6 +494,9 @@ cmNinjaTargetGenerator { cmCustomCommand const* cc = (*si)->GetCustomCommand(); this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); + // Record the custom commands for this target. The container is used + // in WriteObjectBuildStatement when called in a loop below. + this->CustomCommands.push_back((*si)->GetCustomCommand()); } std::vector<cmSourceFile const*> headerSources; this->GeneratorTarget->GetHeaderSources(headerSources, config); @@ -565,14 +568,11 @@ cmNinjaTargetGenerator } // Add order-only dependencies on custom command outputs. - std::vector<cmSourceFile const*> customCommands; - std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GeneratorTarget->GetCustomCommands(customCommands, config); - for(std::vector<cmSourceFile const*>::const_iterator - si = customCommands.begin(); - si != customCommands.end(); ++si) + for(std::vector<cmCustomCommand const*>::const_iterator + cci = this->CustomCommands.begin(); + cci != this->CustomCommands.end(); ++cci) { - cmCustomCommand const* cc = (*si)->GetCustomCommand(); + cmCustomCommand const* cc = *cci; cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->GetMakefile()); const std::vector<std::string>& ccoutputs = ccg.GetOutputs(); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 8669e6e..8073af2 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -153,6 +153,7 @@ private: cmLocalNinjaGenerator* LocalGenerator; /// List of object files for this target. cmNinjaDeps Objects; + std::vector<cmCustomCommand const*> CustomCommands; typedef std::map<std::string, std::string> LanguageFlagMap; LanguageFlagMap LanguageFlags; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 759df91..309f280 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -348,6 +348,12 @@ cmPolicies::cmPolicies() CMP0051, "CMP0051", "List TARGET_OBJECTS in SOURCES target property.", 3,1,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0052, "CMP0052", + "Reject source and build dirs in installed " + "INTERFACE_INCLUDE_DIRECTORIES.", + 3,1,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 7a08a34..60f35c2 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -105,6 +105,8 @@ public: CMP0049, ///< Do not expand variables in target source entries CMP0050, ///< Disallow add_custom_command SOURCE signatures CMP0051, ///< List TARGET_OBJECTS in SOURCES target property + CMP0052, ///< Reject source and build dirs in installed + /// INTERFACE_INCLUDE_DIRECTORIES /** \brief Always the last entry. * diff --git a/Source/cmProperty.h b/Source/cmProperty.h index 789be1d..34897e8 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -31,7 +31,7 @@ public: const char *GetValue() const; // construct with the value not set - cmProperty() { this->ValueHasBeenSet = false; }; + cmProperty() { this->ValueHasBeenSet = false; } protected: std::string Name; diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index 9ca8222..098fadb 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -33,22 +33,22 @@ public: bool chained); /// Default constructor - cmPropertyDefinition() { this->Chained = false; }; + cmPropertyDefinition() { this->Chained = false; } /// Is the property chained? - bool IsChained() const { return this->Chained; }; + bool IsChained() const { return this->Chained; } /// Get the scope cmProperty::ScopeType GetScope() const { - return this->Scope; }; + return this->Scope; } /// Get the documentation (short version) const std::string &GetShortDescription() const { - return this->ShortDescription; }; + return this->ShortDescription; } /// Get the documentation (full version) const std::string &GetFullDescription() const { - return this->FullDescription; }; + return this->FullDescription; } protected: std::string Name; diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index fa33848..02d4235 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -31,9 +31,9 @@ public: cmProperty::ScopeType scope, bool &chain) const; - void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; }; + void SetCMakeInstance(cmake *cm) { this->CMakeInstance = cm; } - cmPropertyMap() { this->CMakeInstance = 0;}; + cmPropertyMap() { this->CMakeInstance = 0;} private: cmake *CMakeInstance; diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 755a2cf..a1d9de1 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -89,7 +89,7 @@ public: void AddDepend(const char* d) { this->Depends.push_back(d); } // Get the properties - cmPropertyMap &GetProperties() { return this->Properties; }; + cmPropertyMap &GetProperties() { return this->Properties; } /** * Check whether the given source file location could refer to this diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index ed8efcc..3731502 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -324,12 +324,12 @@ struct cmDocumentationEntry { std::string Name; std::string Brief; - cmDocumentationEntry(){}; + cmDocumentationEntry(){} cmDocumentationEntry(const char *doc[2]) { if (doc[0]) this->Name = doc[0]; - if (doc[1]) this->Brief = doc[1];}; + if (doc[1]) this->Brief = doc[1];} cmDocumentationEntry(const char *n, const char *b) - { if (n) this->Name = n; if (b) this->Brief = b; }; + { if (n) this->Name = n; if (b) this->Brief = b; } }; /** Data structure to represent a single command line. */ @@ -378,7 +378,8 @@ static thisClass* SafeDownCast(cmObject *c) \ return static_cast<thisClass *>(c); \ } \ return 0;\ -} +} \ +class cmTypeMacro_UseTrailingSemicolon inline bool cmHasLiteralPrefixImpl(const std::string &str1, const char *str2, diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 5b7412d..51069e7 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -83,7 +83,7 @@ protected: RegexReplacement(const char* s): number(-1), value(s) {} RegexReplacement(const std::string& s): number(-1), value(s) {} RegexReplacement(int n): number(n), value() {} - RegexReplacement() {}; + RegexReplacement() {} int number; std::string value; }; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c1c33f2..c27b561 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1616,8 +1616,8 @@ long copy_data(struct archive *ar, struct archive *aw) return (r); } } -#if !defined(__clang__) - return r; /* this should not happen but it silences a warning */ +#if !defined(__clang__) && !defined(__HP_aCC) + return r; /* this should not happen but it quiets some compilers */ #endif } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a87ec31..1f8cddb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -138,6 +138,10 @@ public: LinkClosureMapType; LinkClosureMapType LinkClosureMap; + typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> > + SourceFilesMapType; + SourceFilesMapType SourceFilesMap; + struct TargetPropertyEntry { TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, const std::string &targetName = std::string()) @@ -225,6 +229,7 @@ cmTarget::cmTarget() this->DebugCompileOptionsDone = false; this->DebugCompileDefinitionsDone = false; this->DebugSourcesDone = false; + this->LinkImplementationLanguageIsContextDependent = true; } //---------------------------------------------------------------------------- @@ -457,6 +462,7 @@ void cmTarget::FinishConfigure() //---------------------------------------------------------------------------- void cmTarget::ClearLinkMaps() { + this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); this->Internal->LinkInterfaceMap.clear(); this->Internal->LinkClosureMap.clear(); @@ -548,7 +554,7 @@ bool cmTarget::IsBundleOnApple() const } //---------------------------------------------------------------------------- -static void processSources(cmTarget const* tgt, +static bool processSources(cmTarget const* tgt, const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries, std::vector<std::string> &srcs, std::set<std::string> &uniqueSrcs, @@ -558,6 +564,8 @@ static void processSources(cmTarget const* tgt, { cmMakefile *mf = tgt->GetMakefile(); + bool contextDependent = false; + for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { @@ -572,8 +580,12 @@ static void processSources(cmTarget const* tgt, tgt, dagChecker), entrySources); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) + + if ((*it)->ge->GetHadContextSensitiveCondition()) + { + contextDependent = true; + } + else if (mf->IsGeneratingBuildSystem()) { cacheSources = true; } @@ -594,7 +606,7 @@ static void processSources(cmTarget const* tgt, cm->IssueMessage(cmake::FATAL_ERROR, e, tgt->GetBacktrace()); } - return; + return contextDependent; } } if (cacheSources) @@ -625,6 +637,7 @@ static void processSources(cmTarget const* tgt, + usedSources, (*it)->ge->GetBacktrace()); } } + return contextDependent; } //---------------------------------------------------------------------------- @@ -660,7 +673,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, "SOURCES", 0, 0); std::set<std::string> uniqueSrcs; - processSources(this, + bool contextDependentDirectSources = processSources(this, this->Internal->SourceEntries, files, uniqueSrcs, @@ -712,7 +725,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, } } - processSources(this, + std::vector<std::string>::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, this->Internal->CachedLinkInterfaceSourcesEntries[config], files, uniqueSrcs, @@ -721,6 +735,12 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, config, debugSources); + if (!contextDependentDirectSources + && !(contextDependentInterfaceSources && numFilesBefore < files.size())) + { + this->LinkImplementationLanguageIsContextDependent = false; + } + if (!this->Makefile->IsGeneratingBuildSystem()) { deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries); @@ -793,42 +813,109 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config, cmTarget const* head) const { - std::vector<std::string> srcs; - this->GetSourceFiles(srcs, config, head); - std::set<cmSourceFile*> emitted; + // Lookup any existing link implementation for this configuration. + TargetConfigPair key(head, cmSystemTools::UpperCase(config)); - for(std::vector<std::string>::const_iterator i = srcs.begin(); - i != srcs.end(); ++i) + if(!this->LinkImplementationLanguageIsContextDependent) + { + files = this->Internal->SourceFilesMap.begin()->second; + return; + } + + cmTargetInternals::SourceFilesMapType::iterator + it = this->Internal->SourceFilesMap.find(key); + if(it != this->Internal->SourceFilesMap.end()) { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); - if (emitted.insert(sf).second) + files = it->second; + } + else + { + std::vector<std::string> srcs; + this->GetSourceFiles(srcs, config, head); + + std::set<cmSourceFile*> emitted; + + for(std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) { - files.push_back(sf); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); + if (emitted.insert(sf).second) + { + files.push_back(sf); + } } + this->Internal->SourceFilesMap[key] = files; + } +} + +//---------------------------------------------------------------------------- +void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) +{ + std::string srcFiles; + const char* sep = ""; + for(std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) + { + std::string filename = *i; + srcFiles += sep; + srcFiles += filename; + sep = ";"; + } + if (!srcFiles.empty()) + { + this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + cge->SetEvaluateForBuildsystem(true); + this->Internal->SourceEntries.push_back( + new cmTargetInternals::TargetPropertyEntry(cge)); } } //---------------------------------------------------------------------------- void cmTarget::AddSources(std::vector<std::string> const& srcs) { + std::string srcFiles; + const char* sep = ""; for(std::vector<std::string>::const_iterator i = srcs.begin(); i != srcs.end(); ++i) { - const char* src = i->c_str(); - if(src[0] == '$' && src[1] == '<') - { - this->AddSource(src); - } - else + std::string filename = *i; + const char* src = filename.c_str(); + + if(!(src[0] == '$' && src[1] == '<')) { - this->AddSourceCMP0049(src); + filename = this->ProcessSourceItemCMP0049(filename); + if (cmSystemTools::GetErrorOccuredFlag()) + { + return; + } + this->Makefile->GetOrCreateSource(filename); } + srcFiles += sep; + srcFiles += filename; + sep = ";"; + } + if (!srcFiles.empty()) + { + this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + cge->SetEvaluateForBuildsystem(true); + this->Internal->SourceEntries.push_back( + new cmTargetInternals::TargetPropertyEntry(cge)); } } //---------------------------------------------------------------------------- -cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s) +std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s) { std::string src = s; @@ -863,10 +950,22 @@ cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s) this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { - return 0; + return ""; } } } + return src; +} + +//---------------------------------------------------------------------------- +cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s) +{ + std::string src = this->ProcessSourceItemCMP0049(s); + + if (cmSystemTools::GetErrorOccuredFlag()) + { + return 0; + } return this->AddSource(src); } @@ -939,6 +1038,8 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) TargetPropertyEntryFinder(sfl)) == this->Internal->SourceEntries.end()) { + this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); @@ -1708,6 +1809,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } + this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); @@ -1794,7 +1896,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - + this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); @@ -2684,7 +2786,6 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo( msg += " which has type "; msg += cmTarget::GetTargetTypeName(this->GetType()); this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg); - abort(); return 0; } @@ -2729,7 +2830,6 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo( msg += " which has type "; msg += cmTarget::GetTargetTypeName(this->GetType()); this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg); - abort(); return 0; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 055e029..92b5201 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -30,7 +30,8 @@ F(CMP0038) \ F(CMP0041) \ F(CMP0042) \ - F(CMP0046) + F(CMP0046) \ + F(CMP0052) class cmake; class cmMakefile; @@ -106,7 +107,7 @@ public: ///! Set the cmMakefile that owns this target void SetMakefile(cmMakefile *mf); - cmMakefile *GetMakefile() const { return this->Makefile;}; + cmMakefile *GetMakefile() const { return this->Makefile;} #define DECLARE_TARGET_POLICY(POLICY) \ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \ @@ -135,9 +136,6 @@ public: /** * Get the list of the source files used by this target */ - void GetSourceFiles(std::vector<std::string> &files, - const std::string& config, - cmTarget const* head = 0) const; void GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config, cmTarget const* head = 0) const; @@ -147,6 +145,7 @@ public: * Add sources to the target. */ void AddSources(std::vector<std::string> const& srcs); + void AddTracedSources(std::vector<std::string> const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src); @@ -448,7 +447,7 @@ public: cmTarget const* head = 0) const; // Get the properties - cmPropertyMap &GetProperties() const { return this->Properties; }; + cmPropertyMap &GetProperties() const { return this->Properties; } bool GetMappedConfig(std::string const& desired_config, const char** loc, @@ -683,6 +682,9 @@ private: const std::string& config, bool contentOnly) const; + void GetSourceFiles(std::vector<std::string> &files, + const std::string& config, + cmTarget const* head = 0) const; private: std::string Name; std::vector<cmCustomCommand> PreBuildCommands; @@ -752,6 +754,8 @@ private: void ComputeLinkClosure(const std::string& config, LinkClosure& lc, cmTarget const* head) const; + std::string ProcessSourceItemCMP0049(const std::string& s); + void ClearLinkMaps(); void MaybeInvalidatePropertyCache(const std::string& prop); @@ -782,6 +786,8 @@ private: std::string const& suffix, std::string const& name, const char* version) const; + + mutable bool LinkImplementationLanguageIsContextDependent; }; typedef std::map<std::string,cmTarget> cmTargets; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 1c2e625..56e1338 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -70,7 +70,6 @@ bool cmTargetLinkLibrariesCommand GetRequiredPolicyError(cmPolicies::CMP0016); break; case cmPolicies::NEW: // NEW behavior prints the error. - default: break; } } diff --git a/Source/cmTest.h b/Source/cmTest.h index b3785f6..a93eff5 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -51,10 +51,10 @@ public: 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; }; + cmPropertyMap &GetProperties() { return this->Properties; } /** Get the cmMakefile instance that owns this test. */ - cmMakefile *GetMakefile() { return this->Makefile;}; + cmMakefile *GetMakefile() { return this->Makefile;} /** Get the backtrace of the command that created this test. */ cmListFileBacktrace const& GetBacktrace() const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2cf636c..71ea3f5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -600,7 +600,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) gg->CreateGeneratorTargets(mf); cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - gtgt); + gtgt, false); linkLibs = frameworkPath + linkPath + linkLibs; printf("%s\n", linkLibs.c_str() ); diff --git a/Source/cmake.h b/Source/cmake.h index 6772740..76a3179 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -98,9 +98,9 @@ class cmake /// Destructor ~cmake(); - static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";}; + static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";} static const char *GetCMakeFilesDirectoryPostSlash() { - return "CMakeFiles/";}; + return "CMakeFiles/";} //@{ /** @@ -261,7 +261,7 @@ class cmake void UpdateProgress(const char *msg, float prog); ///! get the cmake policies instance - cmPolicies *GetPolicies() {return this->Policies;} ; + cmPolicies *GetPolicies() {return this->Policies;} ///! Get the variable watch object cmVariableWatch* GetVariableWatch() { return this->VariableWatch; } @@ -278,7 +278,7 @@ class cmake bool GetPropertyAsBool(const std::string& prop); // Get the properties - cmPropertyMap &GetProperties() { return this->Properties; }; + cmPropertyMap &GetProperties() { return this->Properties; } ///! Do all the checks before running configure int DoPreConfigureChecks(); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 977d57b..5e6a226 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -299,6 +299,13 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") IF(CMAKE_SYSTEM MATCHES "HP-UX") SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p") + IF(CMAKE_CXX_COMPILER_ID MATCHES "HP") + # it is known that version 3.85 fails and 6.25 works without these flags + IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4) + # use new C++ library and improved template support + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98") + ENDIF() + ENDIF() ENDIF(CMAKE_SYSTEM MATCHES "HP-UX") ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index f76deb5..251a56d 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -110,16 +110,19 @@ Encoding::CommandLineArguments:: Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(const CommandLineArguments& other) { - size_t i; - for(i=0; i<this->argv_.size(); i++) + if(this != &other) { - free(this->argv_[i]); - } + size_t i; + for(i=0; i<this->argv_.size(); i++) + { + free(this->argv_[i]); + } - this->argv_.resize(other.argv_.size()); - for(i=0; i<this->argv_.size(); i++) - { - this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0; + this->argv_.resize(other.argv_.size()); + for(i=0; i<this->argv_.size(); i++) + { + this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0; + } } return *this; diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index 56776a3..a147057 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -478,11 +478,16 @@ void kwsysMD5_Initialize(kwsysMD5* md5) /*--------------------------------------------------------------------------*/ void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length) { + size_t dlen; if(length < 0) { - length = (int)strlen((char const*)data); + dlen = strlen((char const*)data); } - md5_append(&md5->md5_state, (md5_byte_t const*)data, (size_t)length); + else + { + dlen = (size_t)length; + } + md5_append(&md5->md5_state, (md5_byte_t const*)data, dlen); } /*--------------------------------------------------------------------------*/ diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index 5d178bf..1ee26fa 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -353,6 +353,10 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in, if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags)) { /* Surrounding quotes are needed. Allocate space for them. */ + if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix)) + { + size += 2; + } size += 2; /* We must escape all ending backslashes when quoting on windows. */ @@ -377,7 +381,18 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, if(needQuotes) { /* Add the opening quote for this argument. */ - *out++ = '"'; + if(flags & kwsysSystem_Shell_Flag_WatcomQuote) + { + if(isUnix) + { + *out++ = '"'; + } + *out++ = '\''; + } + else + { + *out++ = '"'; + } } /* Scan the string for characters that require escaping or quoting. */ @@ -549,7 +564,18 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, } /* Add the closing quote for this argument. */ - *out++ = '"'; + if(flags & kwsysSystem_Shell_Flag_WatcomQuote) + { + *out++ = '\''; + if(isUnix) + { + *out++ = '"'; + } + } + else + { + *out++ = '"'; + } } /* Store a terminating null without incrementing. */ diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in index 549db90..f21bf0d 100644 --- a/Source/kwsys/System.h.in +++ b/Source/kwsys/System.h.in @@ -36,6 +36,7 @@ # define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake) # define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake) # define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) +# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote) #endif #ifdef __VMS @@ -102,14 +103,17 @@ enum kwsysSystem_Shell_Flag_e kwsysSystem_Shell_Flag_MinGWMake = (1<<4), /** The target shell is in a NMake makefile. */ - kwsysSystem_Shell_Flag_NMake = (1<<6), + kwsysSystem_Shell_Flag_NMake = (1<<5), /** Make variable reference syntax $(MAKEVAR) should not be escaped to allow a build tool to replace it. Replacement values containing spaces, quotes, backslashes, or other non-alphanumeric characters that have significance to some makes or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5) + kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6), + + /** The target shell quoting uses extra single Quotes for Watcom tools. */ + kwsysSystem_Shell_Flag_WatcomQuote = (1<<7) }; /** @@ -156,6 +160,7 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command, # undef kwsysSystem_Shell_Flag_MinGWMake # undef kwsysSystem_Shell_Flag_NMake # undef kwsysSystem_Shell_Flag_AllowMakeVariables +# undef kwsysSystem_Shell_Flag_WatcomQuote # endif #endif diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1c474ab..0e60ed1 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2440,6 +2440,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set(regex "${regex}|Error message was: ") set(regex "${regex}([Cc]ould *n.t resolve host") set(regex "${regex}|[Cc]ould *n.t connect to host") + set(regex "${regex}|Failed connect to") set(regex "${regex}|Empty reply from server") set(regex "${regex}|The requested URL returned error") set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)") diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index ed3afc5..4ed2f43 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -25,7 +25,9 @@ function(run_cmake test) unset(expect_std${o}) endif() endforeach() - set(RunCMake_TEST_SOURCE_DIR "${top_src}") + if (NOT RunCMake_TEST_SOURCE_DIR) + set(RunCMake_TEST_SOURCE_DIR "${top_src}") + endif() if(NOT RunCMake_TEST_BINARY_DIR) set(RunCMake_TEST_BINARY_DIR "${top_bin}/${test}-build") endif() @@ -36,6 +38,9 @@ function(run_cmake test) if(NOT DEFINED RunCMake_TEST_OPTIONS) set(RunCMake_TEST_OPTIONS "") endif() + if (NOT RunCMake_TEST_FILE) + set(RunCMake_TEST_FILE "${test}") + endif() if(APPLE) list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0025=NEW) endif() @@ -52,7 +57,7 @@ function(run_cmake test) COMMAND ${CMAKE_COMMAND} "${RunCMake_TEST_SOURCE_DIR}" -G "${RunCMake_GENERATOR}" -T "${RunCMake_GENERATOR_TOOLSET}" - -DRunCMake_TEST=${test} + -DRunCMake_TEST=${RunCMake_TEST_FILE} --no-warn-unused-cli ${RunCMake_TEST_OPTIONS} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index f30c9a9..f4b744b 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -16,6 +16,7 @@ \* CMP0041 \* CMP0042 \* CMP0046 + \* CMP0052 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt new file mode 100644 index 0000000..f0adc9f --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/set/PARENT_SCOPE-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/set/PARENT_SCOPE-result.txt +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-result.txt diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt new file mode 100644 index 0000000..f6d408c --- /dev/null +++ b/Tests/RunCMake/include_directories/BinInInstallPrefix-CMP0052-WARN-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0052 is not set: Reject source and build dirs in installed + INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. + + Directory: + + ".*Tests/RunCMake/include_directories/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" + + in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory + of the install directory: + + ".*Tests/RunCMake/include_directories/prefix" +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/include_directories/CMakeLists.txt b/Tests/RunCMake/include_directories/CMakeLists.txt index f452db1..3482e6b 100644 --- a/Tests/RunCMake/include_directories/CMakeLists.txt +++ b/Tests/RunCMake/include_directories/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.0) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-result.txt b/Tests/RunCMake/include_directories/InstallInBinDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInBinDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt b/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt new file mode 100644 index 0000000..254fae1 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInBinDir-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/InstallInBinDir-build/foo" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt b/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInSrcDir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt b/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt new file mode 100644 index 0000000..7be3044 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallInSrcDir-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/copy/foo" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt b/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt b/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake new file mode 100644 index 0000000..0f08e58 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallPrefixInInterface.cmake @@ -0,0 +1,11 @@ + +project(InstallPrefixInInterface) + +add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/foo") + +install(TARGETS testTarget EXPORT testTargets + DESTINATION lib +) + +install(EXPORT testTargets DESTINATION lib/cmake) diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirInSource-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/InstallToPrefixInSrcDirOutOfSource-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index c00b924..434beb9 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -12,3 +12,128 @@ run_cmake(CMP0021) run_cmake(install_config) run_cmake(incomplete-genex) run_cmake(export-NOWARN) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/copy/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/copy/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy") +run_cmake(InstallInSrcDir) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_FILE) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build") +set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") +run_cmake(InstallInBinDir) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_FILE) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/prefix/src/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/prefix/src/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/SourceDirectoryInInterface.cmake" + "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" + COPYONLY +) + +foreach(policyStatus "" NEW OLD) + if (NOT "${policyStatus}" STREQUAL "") + set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) + else() + unset(policyOption) + set(policyStatus WARN) + endif() + set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}) + # Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run + # the test suite in-source properly. Otherwise the install directory would be + # a subdirectory or the source directory, which is allowed and tested separately + # below. + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") + set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface") + run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_FILE) + + set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface") + run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) + unset(RunCMake_TEST_SOURCE_DIR) + unset(RunCMake_TEST_FILE) +endforeach() + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") +run_cmake(InstallPrefixInInterface) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake" + COPYONLY +) +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc") +run_cmake(InstallToPrefixInSrcDirOutOfSource) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_FILE) + + +file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_NO_CLEAN ON) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/CMakeLists.txt" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/empty.cpp" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/empty.cpp" + COPYONLY +) +configure_file( + "${RunCMake_SOURCE_DIR}/InstallPrefixInInterface.cmake" + "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake" + COPYONLY +) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix") +set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface") +set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc") +run_cmake(InstallToPrefixInSrcDirInSource) +unset(RunCMake_TEST_SOURCE_DIR) +unset(RunCMake_TEST_BINARY_DIR) +unset(RunCMake_TEST_FILE) +unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt new file mode 100644 index 0000000..afa43e0 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-NEW-stderr.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: + + ".*Tests/RunCMake/include_directories/prefix/src/foo" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-OLD-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt new file mode 100644 index 0000000..78710c0 --- /dev/null +++ b/Tests/RunCMake/include_directories/SrcInInstallPrefix-CMP0052-WARN-stderr.txt @@ -0,0 +1,15 @@ +CMake Warning \(dev\) in CMakeLists.txt: + Policy CMP0052 is not set: Reject source and build dirs in installed + INTERFACE_INCLUDE_DIRECTORIES. Run "cmake --help-policy CMP0052" for + policy details. Use the cmake_policy command to set the policy and + suppress this warning. + + Directory: + + ".*Tests/RunCMake/include_directories/prefix/src/foo" + + in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory + of the install directory: + + ".*Tests/RunCMake/include_directories/prefix" +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/set/ParentScope-result.txt b/Tests/RunCMake/set/ParentScope-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/set/ParentScope-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/set/PARENT_SCOPE.cmake b/Tests/RunCMake/set/ParentScope.cmake index 9bd6bca..9bd6bca 100644 --- a/Tests/RunCMake/set/PARENT_SCOPE.cmake +++ b/Tests/RunCMake/set/ParentScope.cmake diff --git a/Tests/RunCMake/set/RunCMakeTest.cmake b/Tests/RunCMake/set/RunCMakeTest.cmake index 5d036e3..1b51ea2 100644 --- a/Tests/RunCMake/set/RunCMakeTest.cmake +++ b/Tests/RunCMake/set/RunCMakeTest.cmake @@ -1,3 +1,3 @@ include(RunCMake) -run_cmake(PARENT_SCOPE) +run_cmake(ParentScope) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index 4ae4bec..0ae67bd 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -79,6 +79,11 @@ if(SPHINX_QTHELP) # https://codereview.qt-project.org/#change,82250 in Qt 4. COMMAND ${CMAKE_COMMAND} "-DCSS_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/_static" -P "${CMAKE_CURRENT_SOURCE_DIR}/apply_qthelp_css_workaround.cmake" + # Workaround sphinx configurability: + # https://bitbucket.org/birkenfeld/sphinx/issue/1448/make-qthelp-more-configurable + COMMAND ${CMAKE_COMMAND} "-DQTHELP_DIR=${CMAKE_CURRENT_BINARY_DIR}/qthelp/" + "-DCMake_VERSION=${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}" + -P "${CMAKE_CURRENT_SOURCE_DIR}/fixup_qthelp_names.cmake" COMMAND qcollectiongenerator ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp ) endif() diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in index ef622fd..f7e4b8b 100644 --- a/Utilities/Sphinx/conf.py.in +++ b/Utilities/Sphinx/conf.py.in @@ -61,3 +61,7 @@ html_theme = 'default' html_title = 'CMake %s Documentation' % release html_short_title = '%s Documentation' % release html_favicon = 'cmake-favicon.ico' +# Not supported yet by sphinx: +# https://bitbucket.org/birkenfeld/sphinx/issue/1448/make-qthelp-more-configurable +# qthelp_namespace = "org.cmake" +# qthelp_qch_name = "CMake-300.qch" diff --git a/Utilities/Sphinx/fixup_qthelp_names.cmake b/Utilities/Sphinx/fixup_qthelp_names.cmake new file mode 100644 index 0000000..e35ef25 --- /dev/null +++ b/Utilities/Sphinx/fixup_qthelp_names.cmake @@ -0,0 +1,32 @@ + +file(READ "${QTHELP_DIR}/CMake.qhcp" QHCP_CONTENT) + +string(REPLACE + "<homePage>qthelp://org.sphinx.cmake" "<homePage>qthelp://org.cmake" + QHCP_CONTENT "${QHCP_CONTENT}" +) +string(REPLACE + "<startPage>qthelp://org.sphinx.cmake" "<startPage>qthelp://org.cmake" + QHCP_CONTENT "${QHCP_CONTENT}" +) + +string(REPLACE + "<output>CMake.qch" "<output>CMake-${CMake_VERSION}.qch" + QHCP_CONTENT "${QHCP_CONTENT}" +) +string(REPLACE + "<file>CMake.qch" "<file>CMake-${CMake_VERSION}.qch" + QHCP_CONTENT "${QHCP_CONTENT}" +) + +file(WRITE "${QTHELP_DIR}/CMake.qhcp" "${QHCP_CONTENT}") + + +file(READ "${QTHELP_DIR}/CMake.qhp" QHP_CONTENT) + +string(REPLACE + "<namespace>org.sphinx.cmake" "<namespace>org.cmake" + QHP_CONTENT "${QHP_CONTENT}" +) + +file(WRITE "${QTHELP_DIR}/CMake.qhp" "${QHP_CONTENT}") @@ -1086,8 +1086,8 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then cmake_test_flags= # If we are on HP-UX, check for -Ae for the C compiler. - cmake_test_flags="-Ae" if [ "x${cmake_system}" = "xHP-UX" ]; then + cmake_test_flags="-Ae" TMPFILE=`cmake_tmp_file` echo ' int main(int argc, char** argv) { (void)argc; (void)argv; return 0; } @@ -1108,6 +1108,29 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then echo "${cmake_c_compiler} does not need ${cmake_test_flags}" fi rm -f "${TMPFILE}.c" + echo ' + #include <iostream> + int main(int argc, char** argv) { + for(int i=0; i < 1; ++i); + for(int i=0; i < 1; ++i); + (void)argc; (void)argv; return 0; } +' > ${TMPFILE}.cxx + cmake_need_AAstd98=0 + cmake_test_flags="-AA +hpxstd98" + if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then + : + else + if cmake_try_run "${cmake_cxx_compiler}" \ + "${cmake_cxx_flags} ${cmake_test_flags}" "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then + cmake_need_AAstd98=1 + fi + fi + if [ "x${cmake_need_AAstd98}" = "x1" ]; then + cmake_cxx_flags="${cmake_cxx_flags} ${cmake_test_flags}" + echo "${cmake_cxx_compiler} needs ${cmake_test_flags}" + else + echo "${cmake_cxx_compiler} does not need ${cmake_test_flags}" + fi fi cmake_test_flags= fi |