diff options
91 files changed, 760 insertions, 308 deletions
diff --git a/Help/command/add_executable.rst b/Help/command/add_executable.rst index 6763620..c7a30d7 100644 --- a/Help/command/add_executable.rst +++ b/Help/command/add_executable.rst @@ -74,8 +74,9 @@ properties for more information. Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be used to refer to ``<target>`` in subsequent commands. The ``<name>`` does not appear in the generated buildsystem as a make target. The -``<target>`` may not be an :ref:`Imported Target <Imported Targets>` or an -``ALIAS``. ``ALIAS`` targets can be used as targets to read properties +``<target>`` may not be a non-``GLOBAL`` +:ref:`Imported Target <Imported Targets>` or an ``ALIAS``. +``ALIAS`` targets can be used as targets to read properties from, executables for custom commands and custom targets. They can also be tested for existence with the regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used to modify properties of ``<target>``, that diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 78b316d..4e85d8c 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -125,7 +125,8 @@ Alias Libraries Creates an :ref:`Alias Target <Alias Targets>`, such that ``<name>`` can be used to refer to ``<target>`` in subsequent commands. The ``<name>`` does not appear in the generated buildsystem as a make target. The ``<target>`` -may not be an :ref:`Imported Target <Imported Targets>` or an ``ALIAS``. +may not be a non-``GLOBAL`` :ref:`Imported Target <Imported Targets>` or an +``ALIAS``. ``ALIAS`` targets can be used as linkable targets and as targets to read properties from. They can also be tested for existence with the regular :command:`if(TARGET)` subcommand. The ``<name>`` may not be used diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 8bd3233..3709e7a 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -12,14 +12,15 @@ Add compile definitions to a target. Specify compile definitions to use when compiling a given ``<target>``. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:ref:`Imported Target <Imported Targets>`. +:ref:`ALIAS target <Alias Targets>`. The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_DEFINITIONS` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the -:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property of ``<target>``. The -following arguments specify compile definitions. Repeated calls for the +:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +The following arguments specify compile definitions. Repeated calls for the same ``<target>`` append items in the order called. Arguments to ``target_compile_definitions`` may use "generator expressions" diff --git a/Help/command/target_compile_features.rst b/Help/command/target_compile_features.rst index b66a4ec..bf413bf 100644 --- a/Help/command/target_compile_features.rst +++ b/Help/command/target_compile_features.rst @@ -18,12 +18,13 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the features. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_FEATURES` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the -:prop_tgt:`INTERFACE_COMPILE_FEATURES` property of ``<target>``. Repeated -calls for the same ``<target>`` append items. +:prop_tgt:`INTERFACE_COMPILE_FEATURES` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +Repeated calls for the same ``<target>`` append items. The named ``<target>`` must have been created by a command such as -:command:`add_executable` or :command:`add_library` and must not be -an ``IMPORTED`` target. +:command:`add_executable` or :command:`add_library` and must not be an +:ref:`ALIAS target <Alias Targets>`. Arguments to ``target_compile_features`` may use "generator expressions" with the syntax ``$<...>``. diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 73e01e7..3e7dc47 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -12,8 +12,10 @@ Add compile options to a target. Specify compile options to use when compiling a given target. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:ref:`IMPORTED Target <Imported Targets>`. If ``BEFORE`` is specified, -the content will be prepended to the property instead of being appended. +:ref:`ALIAS target <Alias Targets>`. + +If ``BEFORE`` is specified, the content will be prepended to the property +instead of being appended. This command can be used to add any options, but alternative commands exist to add preprocessor definitions @@ -27,8 +29,9 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_OPTIONS` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the -:prop_tgt:`INTERFACE_COMPILE_OPTIONS` property of ``<target>``. The -following arguments specify compile options. Repeated calls for the same +:prop_tgt:`INTERFACE_COMPILE_OPTIONS` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +The following arguments specify compile options. Repeated calls for the same ``<target>`` append items in the order called. Arguments to ``target_compile_options`` may use "generator expressions" diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst index 30ec2cb..e71be64 100644 --- a/Help/command/target_include_directories.rst +++ b/Help/command/target_include_directories.rst @@ -12,7 +12,7 @@ Add include directories to a target. Specify include directories to use when compiling a given target. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:prop_tgt:`IMPORTED` target. +:ref:`ALIAS target <Alias Targets>`. If ``BEFORE`` is specified, the content will be prepended to the property instead of being appended. @@ -21,9 +21,9 @@ The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`INCLUDE_DIRECTORIES` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the -:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` -property of ``<target>``. The following arguments specify include -directories. +:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +The following arguments specify include directories. Specified include directories may be absolute paths or relative paths. Repeated calls for the same <target> append items in the order called. If diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 30d69f2..2ec8744 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -19,7 +19,8 @@ All of them have the general form:: target_link_libraries(<target> ... <item>... ...) The named ``<target>`` must have been created in the current directory by -a command such as :command:`add_executable` or :command:`add_library`. +a command such as :command:`add_executable` or :command:`add_library` and +must not be an :ref:`ALIAS target <Alias Targets>`. Repeated calls for the same ``<target>`` append items in the order called. Each ``<item>`` may be: diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index d6f148d..a4f5196 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -12,14 +12,15 @@ Add sources to a target. Specify sources to use when compiling a given target. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an -:ref:`IMPORTED Target <Imported Targets>`. +:ref:`ALIAS target <Alias Targets>`. The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify the scope of the following arguments. ``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`SOURCES` property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the -:prop_tgt:`INTERFACE_SOURCES` property of ``<target>``. The -following arguments specify sources. Repeated calls for the same +:prop_tgt:`INTERFACE_SOURCES` property of ``<target>``. +(:ref:`IMPORTED targets <Imported Targets>` only support ``INTERFACE`` items.) +The following arguments specify sources. Repeated calls for the same ``<target>`` append items in the order called. Arguments to ``target_sources`` may use "generator expressions" diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index dd59a00..13b22f8 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -390,6 +390,8 @@ Properties on Source Files /prop_sf/VS_DEPLOYMENT_LOCATION /prop_sf/VS_INCLUDE_IN_VSIX /prop_sf/VS_RESOURCE_GENERATOR + /prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS + /prop_sf/VS_SHADER_ENABLE_DEBUG /prop_sf/VS_SHADER_ENTRYPOINT /prop_sf/VS_SHADER_FLAGS /prop_sf/VS_SHADER_MODEL diff --git a/Help/policy/CMP0040.rst b/Help/policy/CMP0040.rst index d46baf6..0afe589 100644 --- a/Help/policy/CMP0040.rst +++ b/Help/policy/CMP0040.rst @@ -2,7 +2,7 @@ CMP0040 ------- The target in the ``TARGET`` signature of :command:`add_custom_command` -must exist and must be defined in current directory. +must exist and must be defined in the current directory. CMake 2.8.12 and lower silently ignored a custom command created with the ``TARGET`` signature of :command:`add_custom_command` diff --git a/Help/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS.rst b/Help/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS.rst new file mode 100644 index 0000000..446dd26 --- /dev/null +++ b/Help/prop_sf/VS_SHADER_DISABLE_OPTIMIZATIONS.rst @@ -0,0 +1,6 @@ +VS_SHADER_DISABLE_OPTIMIZATIONS +------------------------------- + +Disable compiler optimizations for an ``.hlsl`` source file. This adds the +``-Od`` flag to the command line for the FxCompiler tool. Specify the value +``true`` for this property to disable compiler optimizations. diff --git a/Help/prop_sf/VS_SHADER_ENABLE_DEBUG.rst b/Help/prop_sf/VS_SHADER_ENABLE_DEBUG.rst new file mode 100644 index 0000000..c0e60a3 --- /dev/null +++ b/Help/prop_sf/VS_SHADER_ENABLE_DEBUG.rst @@ -0,0 +1,6 @@ +VS_SHADER_ENABLE_DEBUG +---------------------- + +Enable debugging information for an ``.hlsl`` source file. This adds the +``-Zi`` flag to the command line for the FxCompiler tool. Specify the value +``true`` to generate debugging information for the compiled shader. diff --git a/Help/release/dev/generalize-importedtargets-behavior.rst b/Help/release/dev/generalize-importedtargets-behavior.rst new file mode 100644 index 0000000..c6f4523 --- /dev/null +++ b/Help/release/dev/generalize-importedtargets-behavior.rst @@ -0,0 +1,25 @@ +generalize-importedtargets-behavior +----------------------------------- + +* The :command:`target_compile_definitions` command learned to set the + :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property on + :ref:`Imported Targets`. + +* The :command:`target_compile_features` command learned to set the + :prop_tgt:`INTERFACE_COMPILE_FEATURES` property on :ref:`Imported Targets`. + +* The :command:`target_compile_options` command learned to set the + :prop_tgt:`INTERFACE_COMPILE_OPTIONS` property on :ref:`Imported Targets`. + +* The :command:`target_include_directories` command learned to set the + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` property on + :ref:`Imported Targets`. + +* The :command:`target_sources` command learned to set the + :prop_tgt:`INTERFACE_SOURCES` property on :ref:`Imported Targets`. + +* The :command:`target_link_libraries` command learned to set the + :prop_tgt:`INTERFACE_LINK_LIBRARIES` property on :ref:`Imported Targets`. + +* :ref:`Alias Targets` may now alias :ref:`Imported Targets` that are + created with the ``GLOBAL`` option to :command:`add_library`. diff --git a/Help/release/dev/vs-hlsl-opt-dbg.rst b/Help/release/dev/vs-hlsl-opt-dbg.rst new file mode 100644 index 0000000..8f398ae --- /dev/null +++ b/Help/release/dev/vs-hlsl-opt-dbg.rst @@ -0,0 +1,6 @@ +vs-hlsl-opt-dbg +--------------- + +* Source file properties :prop_sf:`VS_SHADER_DISABLE_OPTIMIZATIONS` and + :prop_sf:`VS_SHADER_ENABLE_DEBUG` have been added to specify more + details of ``.hlsl`` sources with :ref:`Visual Studio Generators`. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 1879827..91bf2f2 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -987,7 +987,7 @@ function(cpack_deb_prepare_package_vars) if(READELF_EXECUTABLE) foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES) extract_so_info("${_FILE}" libname soversion) - if(libname AND soversion) + if(libname AND DEFINED soversion) list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})") else() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 0e6d336..2acb4bc 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -115,6 +115,9 @@ if(NOT FREETYPE_LIBRARY) ) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(FREETYPE) +else() + # on Windows, ensure paths are in canonical format (forward slahes): + file(TO_CMAKE_PATH "${FREETYPE_LIBRARY}" FREETYPE_LIBRARY) endif() unset(FREETYPE_FIND_ARGS) diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake index d9705d9..aa531d5 100644 --- a/Modules/FindICU.cmake +++ b/Modules/FindICU.cmake @@ -156,7 +156,7 @@ function(_ICU_FIND) # Find all ICU programs - list(APPEND icu_binary_suffixes "${_bin64}" "bin") + list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin") foreach(program ${icu_programs}) string(TOUPPER "${program}" program_upcase) set(cache_var "ICU_${program_upcase}_EXECUTABLE") @@ -172,6 +172,11 @@ function(_ICU_FIND) # Find all ICU libraries list(APPEND icu_library_suffixes "${_lib64}" "lib") set(ICU_REQUIRED_LIBS_FOUND ON) + set(static_prefix ) + # static icu libraries compiled with MSVC have the prefix 's' + if(MSVC) + set(static_prefix "s") + endif() foreach(component ${ICU_FIND_COMPONENTS}) string(TOUPPER "${component}" component_upcase) set(component_cache "ICU_${component_upcase}_LIBRARY") @@ -206,6 +211,20 @@ function(_ICU_FIND) list(APPEND component_debug_libnames "icui18nd") endif() + if(static_prefix) + unset(static_component_libnames) + unset(static_component_debug_libnames) + foreach(component_libname ${component_libnames}) + list(APPEND static_component_libnames + ${static_prefix}${component_libname}) + endforeach() + foreach(component_libname ${component_debug_libnames}) + list(APPEND static_component_debug_libnames + ${static_prefix}${component_libname}) + endforeach() + list(APPEND component_libnames ${static_component_libnames}) + list(APPEND component_debug_libnames ${static_component_debug_libnames}) + endif() find_library("${component_cache_release}" ${component_libnames} HINTS ${icu_roots} PATH_SUFFIXES ${icu_library_suffixes} diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a471413..8b4adf6 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 10) -set(CMake_VERSION_PATCH 20171026) +set(CMake_VERSION_PATCH 20171031) #set(CMake_VERSION_RC 1) diff --git a/Source/LexerParser/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx index bf6bc2f..6b4fc85 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.cxx +++ b/Source/LexerParser/cmCommandArgumentLexer.cxx @@ -674,6 +674,13 @@ Modify cmCommandArgumentLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" +static const char *DCURLYVariable = "${"; +static const char *RCURLYVariable = "}"; +static const char *ATVariable = "@"; +static const char *DOLLARVariable = "$"; +static const char *LCURLYVariable = "{"; +static const char *BSLASHVariable = "\\"; + /*--------------------------------------------------------------------------*/ #define INITIAL 0 @@ -1011,7 +1018,7 @@ YY_RULE_SETUP { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->DCURLYVariable; + yylvalp->str = DCURLYVariable; return cal_DCURLY; } YY_BREAK @@ -1020,7 +1027,7 @@ YY_RULE_SETUP { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->RCURLYVariable; + yylvalp->str = RCURLYVariable; return cal_RCURLY; } YY_BREAK @@ -1029,7 +1036,7 @@ YY_RULE_SETUP { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->ATVariable; + yylvalp->str = ATVariable; return cal_AT; } YY_BREAK @@ -1064,7 +1071,7 @@ case 10: YY_RULE_SETUP { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->DOLLARVariable; + yylvalp->str = DOLLARVariable; return cal_DOLLAR; } YY_BREAK @@ -1072,7 +1079,7 @@ case 11: YY_RULE_SETUP { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->LCURLYVariable; + yylvalp->str = LCURLYVariable; return cal_LCURLY; } YY_BREAK @@ -1080,7 +1087,7 @@ case 12: YY_RULE_SETUP { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->BSLASHVariable; + yylvalp->str = BSLASHVariable; return cal_BSLASH; } YY_BREAK @@ -1088,7 +1095,7 @@ case 13: YY_RULE_SETUP { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->BSLASHVariable; + yylvalp->str = BSLASHVariable; return cal_SYMBOL; } YY_BREAK diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index acf18f3..5927b9e 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l @@ -28,6 +28,13 @@ Modify cmCommandArgumentLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" +static const char *DCURLYVariable = "${"; +static const char *RCURLYVariable = "}"; +static const char *ATVariable = "@"; +static const char *DOLLARVariable = "$"; +static const char *LCURLYVariable = "{"; +static const char *BSLASHVariable = "\\"; + /*--------------------------------------------------------------------------*/ %} @@ -63,21 +70,21 @@ Modify cmCommandArgumentLexer.cxx: "${" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->DCURLYVariable; + yylvalp->str = DCURLYVariable; return cal_DCURLY; } "}" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->RCURLYVariable; + yylvalp->str = RCURLYVariable; return cal_RCURLY; } "@" { //std::cerr << __LINE__ << " here: [" << yytext << "]" << std::endl; //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->ATVariable; + yylvalp->str = ATVariable; return cal_AT; } @@ -103,25 +110,25 @@ Modify cmCommandArgumentLexer.cxx: "$" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->DOLLARVariable; + yylvalp->str = DOLLARVariable; return cal_DOLLAR; } "{" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->LCURLYVariable; + yylvalp->str = LCURLYVariable; return cal_LCURLY; } <ESCAPES>"\\" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->BSLASHVariable; + yylvalp->str = BSLASHVariable; return cal_BSLASH; } <NOESCAPES>"\\" { //yyextra->AllocateParserType(yylvalp, yytext, strlen(yytext)); - yylvalp->str = yyextra->BSLASHVariable; + yylvalp->str = BSLASHVariable; return cal_SYMBOL; } diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index a95e3da..b9e200a 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -112,8 +112,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args, if (!aliasedTarget) { std::ostringstream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" - << aliasedName << "\" does not already " - "exist."; + << aliasedName << "\" does not already exist."; this->SetError(e.str()); return false; } @@ -121,15 +120,15 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args, if (type != cmStateEnums::EXECUTABLE) { std::ostringstream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" - << aliasedName << "\" is not an " - "executable."; + << aliasedName << "\" is not an executable."; this->SetError(e.str()); return false; } - if (aliasedTarget->IsImported()) { + if (aliasedTarget->IsImported() && + !aliasedTarget->IsImportedGloballyVisible()) { std::ostringstream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" - << aliasedName << "\" is IMPORTED."; + << aliasedName << "\" is imported but not globally visible."; this->SetError(e.str()); return false; } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 4400f44..0fcffdd 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -228,13 +228,6 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args, this->SetError(e.str()); return false; } - if (aliasedTarget->IsImported()) { - std::ostringstream e; - e << "cannot create ALIAS target \"" << libName << "\" because target \"" - << aliasedName << "\" is IMPORTED."; - this->SetError(e.str()); - return false; - } this->Makefile->AddAlias(libName, aliasedName); return true; } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 6ae58d6..bf314bd 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -21,13 +21,6 @@ cmCommandArgumentParserHelper::cmCommandArgumentParserHelper() this->FileLine = -1; this->FileName = nullptr; this->RemoveEmpty = true; - this->EmptyVariable[0] = 0; - strcpy(this->DCURLYVariable, "${"); - strcpy(this->RCURLYVariable, "}"); - strcpy(this->ATVariable, "@"); - strcpy(this->DOLLARVariable, "$"); - strcpy(this->LCURLYVariable, "{"); - strcpy(this->BSLASHVariable, "\\"); this->NoEscapeMode = false; this->ReplaceAtSyntax = false; @@ -44,10 +37,10 @@ void cmCommandArgumentParserHelper::SetLineFile(long line, const char* file) this->FileName = file; } -char* cmCommandArgumentParserHelper::AddString(const std::string& str) +const char* cmCommandArgumentParserHelper::AddString(const std::string& str) { if (str.empty()) { - return this->EmptyVariable; + return ""; } char* stVal = new char[str.size() + 1]; strcpy(stVal, str.c_str()); @@ -55,14 +48,14 @@ char* cmCommandArgumentParserHelper::AddString(const std::string& str) return stVal; } -char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, - const char* var) +const char* cmCommandArgumentParserHelper::ExpandSpecialVariable( + const char* key, const char* var) { if (!key) { return this->ExpandVariable(var); } if (!var) { - return this->EmptyVariable; + return ""; } if (strcmp(key, "ENV") == 0) { std::string str; @@ -72,7 +65,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } return this->AddString(str); } - return this->EmptyVariable; + return ""; } if (strcmp(key, "CACHE") == 0) { if (const char* c = @@ -82,7 +75,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, } return this->AddString(c); } - return this->EmptyVariable; + return ""; } std::ostringstream e; e << "Syntax $" << key << "{} is not supported. " @@ -91,7 +84,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, return nullptr; } -char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) +const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { if (!var) { return nullptr; @@ -125,11 +118,11 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) return this->AddString(value ? value : ""); } -char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) +const char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) { if (this->ReplaceAtSyntax) { // try to expand the variable - char* ret = this->ExpandVariable(var); + const char* ret = this->ExpandVariable(var); // if the return was 0 and we want to replace empty strings // then return an empty string if (!ret && this->RemoveEmpty) { @@ -150,7 +143,8 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) return this->AddString(ref); } -char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2) +const char* cmCommandArgumentParserHelper::CombineUnions(const char* in1, + const char* in2) { if (!in1) { return in2; @@ -176,10 +170,11 @@ void cmCommandArgumentParserHelper::AllocateParserType( if (len == 0) { return; } - pt->str = new char[len + 1]; - strncpy(pt->str, str, len); - pt->str[len] = 0; - this->Variables.push_back(pt->str); + char* out = new char[len + 1]; + strncpy(out, str, len); + out[len] = 0; + pt->str = out; + this->Variables.push_back(out); } bool cmCommandArgumentParserHelper::HandleEscapeSymbol( diff --git a/Source/cmCommandArgumentParserHelper.h b/Source/cmCommandArgumentParserHelper.h index cb2a390..098c000 100644 --- a/Source/cmCommandArgumentParserHelper.h +++ b/Source/cmCommandArgumentParserHelper.h @@ -17,7 +17,7 @@ class cmCommandArgumentParserHelper public: struct ParserType { - char* str; + const char* str; }; cmCommandArgumentParserHelper(); @@ -35,11 +35,11 @@ public: void Error(const char* str); // For yacc - char* CombineUnions(char* in1, char* in2); + const char* CombineUnions(const char* in1, const char* in2); - char* ExpandSpecialVariable(const char* key, const char* var); - char* ExpandVariable(const char* var); - char* ExpandVariableForAt(const char* var); + const char* ExpandSpecialVariable(const char* key, const char* var); + const char* ExpandVariable(const char* var); + const char* ExpandVariableForAt(const char* var); void SetResult(const char* value); void SetMakefile(const cmMakefile* mf); @@ -53,13 +53,6 @@ public: void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; } const char* GetError() { return this->ErrorString.c_str(); } - char EmptyVariable[1]; - char DCURLYVariable[3]; - char RCURLYVariable[3]; - char ATVariable[3]; - char DOLLARVariable[3]; - char LCURLYVariable[3]; - char BSLASHVariable[3]; private: std::string::size_type InputBufferPos; @@ -69,7 +62,7 @@ private: void Print(const char* place, const char* str); void SafePrintMissing(const char* str, int line, int cnt); - char* AddString(const std::string& str); + const char* AddString(const std::string& str); void CleanupParser(); void SetError(std::string const& msg); diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 542a860..df288bd 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> +#include "cmAlgorithms.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSystemTools.h" @@ -121,7 +122,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args, } // create a function blocker - cmForEachFunctionBlocker* f = new cmForEachFunctionBlocker(this->Makefile); + auto f = cm::make_unique<cmForEachFunctionBlocker>(this->Makefile); if (args.size() > 1) { if (args[1] == "RANGE") { int start = 0; @@ -175,7 +176,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args, } else { f->Args = args; } - this->Makefile->AddFunctionBlocker(f); + this->Makefile->AddFunctionBlocker(f.release()); return true; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 78943e4..97e461d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2288,7 +2288,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( this->XCodeObjectMap[gtgt] = target; // Add source files without build rules for editing convenience. - if (gtgt->GetType() == cmStateEnums::UTILITY) { + if (gtgt->GetType() == cmStateEnums::UTILITY && + gtgt->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { std::vector<cmSourceFile*> sources; if (!gtgt->GetConfigCommonSourceFiles(sources)) { return nullptr; @@ -2705,7 +2706,7 @@ bool cmGlobalXCodeGenerator::CreateGroups( generator->GetGeneratorTargets(); for (auto gtgt : tgts) { // Same skipping logic here as in CreateXCodeTargets so that we do not - // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source + // end up with (empty anyhow) ZERO_CHECK, install, or test source // groups: // if (gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { @@ -2714,6 +2715,9 @@ bool cmGlobalXCodeGenerator::CreateGroups( if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } + if (gtgt->GetName() == CMAKE_CHECK_BUILD_SYSTEM_TARGET) { + continue; + } // add the soon to be generated Info.plist file as a source for a // MACOSX_BUNDLE file diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 7d15ee2..f614dca 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -126,7 +126,7 @@ class cmMakefile; 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0040, \ "The target in the TARGET signature of add_custom_command() must " \ - "exist.", \ + "exist and must be defined in the current directory.", \ 3, 0, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0041, \ "Error on relative include with generator expression.", 3, 0, 0, \ diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index e7080cd..c7550e6 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -9,6 +9,7 @@ #include "cmFilePathChecksum.h" #include "cmGeneratorTarget.h" #include "cmGlobalGenerator.h" +#include "cmLinkItem.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" @@ -16,6 +17,7 @@ #include "cmSourceFile.h" #include "cmSourceGroup.h" #include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cm_sys_stat.h" @@ -24,6 +26,7 @@ #include <algorithm> #include <array> +#include <deque> #include <map> #include <set> #include <sstream> @@ -156,7 +159,7 @@ static void GetConfigs(cmMakefile* makefile, std::string& configDefault, { configDefault = makefile->GetConfigurations(configsList); if (configsList.empty()) { - configsList.push_back(""); + configsList.push_back(configDefault); } } @@ -299,6 +302,50 @@ static std::vector<std::string> AddGeneratedSource( return genFiles; } +/* @brief Tests if targetDepend is a STATIC_LIBRARY and if any of its + * recursive STATIC_LIBRARY dependencies depends on targetOrigin + * (STATIC_LIBRARY cycle). + */ +static bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin, + cmGeneratorTarget const* targetDepend, + std::string const& config) +{ + bool cycle = false; + if ((targetOrigin->GetType() == cmStateEnums::STATIC_LIBRARY) && + (targetDepend->GetType() == cmStateEnums::STATIC_LIBRARY)) { + std::set<cmGeneratorTarget const*> knownLibs; + std::deque<cmGeneratorTarget const*> testLibs; + + // Insert initial static_library dependency + knownLibs.insert(targetDepend); + testLibs.push_back(targetDepend); + + while (!testLibs.empty()) { + cmGeneratorTarget const* testTarget = testLibs.front(); + testLibs.pop_front(); + // Check if the test target is the origin target (cycle) + if (testTarget == targetOrigin) { + cycle = true; + break; + } + // Collect all static_library dependencies from the test target + cmLinkImplementationLibraries const* libs = + testTarget->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* depTarget = item.Target; + if ((depTarget != nullptr) && + (depTarget->GetType() == cmStateEnums::STATIC_LIBRARY) && + knownLibs.insert(depTarget).second) { + testLibs.push_back(depTarget); + } + } + } + } + } + return cycle; +} + struct cmQtAutoGenSetup { std::set<std::string> MocSkip; @@ -631,7 +678,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( GetConfigs(makefile, configDefault, configsList); std::set<std::string> autogenDependFiles; - std::set<std::string> autogenDependTargets; + std::set<cmTarget*> autogenDependTargets; std::vector<std::string> autogenProvides; // Remove build directories on cleanup @@ -953,7 +1000,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // Allow target and file dependencies auto* depTarget = makefile->FindTargetToUse(depName); if (depTarget != nullptr) { - autogenDependTargets.insert(depTarget->GetName()); + autogenDependTargets.insert(depTarget); } else { autogenDependFiles.insert(depName); } @@ -980,8 +1027,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( // Create the autogen target/command if (usePRE_BUILD) { // Add additional autogen target dependencies to origin target - for (std::string const& depTarget : autogenDependTargets) { - target->Target->AddUtility(depTarget, makefile); + for (cmTarget* depTarget : autogenDependTargets) { + target->Target->AddUtility(depTarget->GetName(), makefile); } // Add the pre-build command directly to bypass the OBJECT_LIBRARY @@ -999,20 +1046,35 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( target->Target->AddPreBuildCommand(cc); } else { - // Add utility target dependencies to the autogen target dependencies - for (std::string const& depTarget : target->Target->GetUtilities()) { - autogenDependTargets.insert(depTarget); - } + // Convert file dependencies std::set to std::vector + std::vector<std::string> autogenDepends(autogenDependFiles.begin(), + autogenDependFiles.end()); + // Add link library target dependencies to the autogen target dependencies - for (const auto& item : target->Target->GetOriginalLinkLibraries()) { - if (makefile->FindTargetToUse(item.first) != nullptr) { - autogenDependTargets.insert(item.first); + for (std::string const& config : configsList) { + cmLinkImplementationLibraries const* libs = + target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(target, libTarget, config)) { + std::string util; + if (configsList.size() > 1) { + util += "$<$<CONFIG:"; + util += config; + util += ">:"; + } + util += libTarget->GetName(); + if (configsList.size() > 1) { + util += ">"; + } + autogenDepends.push_back(util); + } + } } } - // Convert file dependencies std::set to std::vector - const std::vector<std::string> autogenDepends(autogenDependFiles.begin(), - autogenDependFiles.end()); // Create autogen target cmTarget* autogenTarget = makefile->AddUtilityCommand( autogenTargetName, true, workingDirectory.c_str(), @@ -1022,9 +1084,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( localGen->AddGeneratorTarget( new cmGeneratorTarget(autogenTarget, localGen)); + // Forward origin utilities to autogen target + for (std::string const& depName : target->Target->GetUtilities()) { + autogenTarget->AddUtility(depName, makefile); + } // Add additional autogen target dependencies to autogen target - for (std::string const& depTarget : autogenDependTargets) { - autogenTarget->AddUtility(depTarget, makefile); + for (cmTarget* depTarget : autogenDependTargets) { + autogenTarget->AddUtility(depTarget->GetName(), makefile); } // Set FOLDER property in autogen target diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f13312f..a01d5d6 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1931,11 +1931,21 @@ bool cmQtAutoGenerators::RccGenerateFile(const RccJob& rccJob) bool rccGenerated = false; std::string rccFileAbs; - if (this->MultiConfig == cmQtAutoGen::SINGLE) { - rccFileAbs = rccJob.RccFile; - } else { - rccFileAbs = - cmQtAutoGen::AppendFilenameSuffix(rccJob.RccFile, this->ConfigSuffix); + { + std::string suffix; + switch (this->MultiConfig) { + case cmQtAutoGen::SINGLE: + break; + case cmQtAutoGen::WRAP: + suffix = this->ConfigSuffix; + suffix += "_"; + suffix += this->FilePathChecksum.getPart(rccJob.RccFile, 4); + break; + case cmQtAutoGen::FULL: + suffix = this->ConfigSuffix; + break; + } + rccFileAbs = cmQtAutoGen::AppendFilenameSuffix(rccJob.RccFile, suffix); } std::string const rccFileRel = cmSystemTools::RelativePath( this->AutogenBuildDir.c_str(), rccFileAbs.c_str()); diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index d159d41..bd4121d 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -17,15 +17,6 @@ bool cmTargetCompileDefinitionsCommand::InitialPass( return this->HandleArguments(args, "COMPILE_DEFINITIONS"); } -void cmTargetCompileDefinitionsCommand::HandleImportedTarget( - const std::string& tgt) -{ - std::ostringstream e; - e << "Cannot specify compile definitions for imported target \"" << tgt - << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); -} - void cmTargetCompileDefinitionsCommand::HandleMissingTarget( const std::string& name) { @@ -56,5 +47,5 @@ bool cmTargetCompileDefinitionsCommand::HandleDirectContent( cmTarget* tgt, const std::vector<std::string>& content, bool, bool) { tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content).c_str()); - return true; + return true; // Successfully handled. } diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index f910452..d41483a 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -30,7 +30,6 @@ public: cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) override; void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmTargetCompileFeaturesCommand.cxx b/Source/cmTargetCompileFeaturesCommand.cxx index 722bbe5..f58e404 100644 --- a/Source/cmTargetCompileFeaturesCommand.cxx +++ b/Source/cmTargetCompileFeaturesCommand.cxx @@ -17,15 +17,6 @@ bool cmTargetCompileFeaturesCommand::InitialPass( return this->HandleArguments(args, "COMPILE_FEATURES", NO_FLAGS); } -void cmTargetCompileFeaturesCommand::HandleImportedTarget( - const std::string& tgt) -{ - std::ostringstream e; - e << "Cannot specify compile features for imported target \"" << tgt - << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); -} - void cmTargetCompileFeaturesCommand::HandleMissingTarget( const std::string& name) { @@ -49,8 +40,8 @@ bool cmTargetCompileFeaturesCommand::HandleDirectContent( std::string error; if (!this->Makefile->AddRequiredTargetFeature(tgt, it, &error)) { this->SetError(error); - return false; + return false; // Not (successfully) handled. } } - return true; + return true; // Successfully handled. } diff --git a/Source/cmTargetCompileFeaturesCommand.h b/Source/cmTargetCompileFeaturesCommand.h index 444d260..45240a5 100644 --- a/Source/cmTargetCompileFeaturesCommand.h +++ b/Source/cmTargetCompileFeaturesCommand.h @@ -22,7 +22,6 @@ class cmTargetCompileFeaturesCommand : public cmTargetPropCommandBase cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) override; void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmTargetCompileOptionsCommand.cxx b/Source/cmTargetCompileOptionsCommand.cxx index 1b4056d..4df3630 100644 --- a/Source/cmTargetCompileOptionsCommand.cxx +++ b/Source/cmTargetCompileOptionsCommand.cxx @@ -18,21 +18,12 @@ bool cmTargetCompileOptionsCommand::InitialPass( return this->HandleArguments(args, "COMPILE_OPTIONS", PROCESS_BEFORE); } -void cmTargetCompileOptionsCommand::HandleImportedTarget( - const std::string& tgt) -{ - std::ostringstream e; - e << "Cannot specify compile options for imported target \"" << tgt << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); -} - void cmTargetCompileOptionsCommand::HandleMissingTarget( const std::string& name) { std::ostringstream e; e << "Cannot specify compile options for target \"" << name - << "\" " - "which is not built by this project."; + << "\" which is not built by this project."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } @@ -47,5 +38,5 @@ bool cmTargetCompileOptionsCommand::HandleDirectContent( { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); tgt->InsertCompileOption(this->Join(content), lfbt); - return true; + return true; // Successfully handled. } diff --git a/Source/cmTargetCompileOptionsCommand.h b/Source/cmTargetCompileOptionsCommand.h index 3fab238..6fb151a 100644 --- a/Source/cmTargetCompileOptionsCommand.h +++ b/Source/cmTargetCompileOptionsCommand.h @@ -30,7 +30,6 @@ public: cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) override; void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index 4646c7e..dcec830 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -21,22 +21,12 @@ bool cmTargetIncludeDirectoriesCommand::InitialPass( ArgumentFlags(PROCESS_BEFORE | PROCESS_SYSTEM)); } -void cmTargetIncludeDirectoriesCommand::HandleImportedTarget( - const std::string& tgt) -{ - std::ostringstream e; - e << "Cannot specify include directories for imported target \"" << tgt - << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); -} - void cmTargetIncludeDirectoriesCommand::HandleMissingTarget( const std::string& name) { std::ostringstream e; e << "Cannot specify include directories for target \"" << name - << "\" " - "which is not built by this project."; + << "\" which is not built by this project."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } @@ -79,7 +69,7 @@ bool cmTargetIncludeDirectoriesCommand::HandleDirectContent( } tgt->AddSystemIncludeDirectories(sdirs); } - return true; + return true; // Successfully handled. } void cmTargetIncludeDirectoriesCommand::HandleInterfaceContent( diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 27a2f43..57bf8fc 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -30,7 +30,6 @@ public: cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) override; void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index dda0464..37bcb70 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -40,6 +40,16 @@ bool cmTargetLinkLibrariesCommand::InitialPass( this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->FindTarget( args[0]); if (!this->Target) { + const std::vector<cmTarget*>& importedTargets = + this->Makefile->GetOwnedImportedTargets(); + for (cmTarget* importedTarget : importedTargets) { + if (importedTarget->GetName() == args[0]) { + this->Target = importedTarget; + break; + } + } + } + if (!this->Target) { cmake::MessageType t = cmake::FATAL_ERROR; // fail by default std::ostringstream e; e << "Cannot specify link libraries for target \"" << args[0] << "\" " @@ -228,7 +238,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( } else { // Lookup old-style cache entry if type is unspecified. So if you // do a target_link_libraries(foo optimized bar) it will stay optimized - // and not use the lookup. As there maybe the case where someone has + // and not use the lookup. As there may be the case where someone has // specifed that a library is both debug and optimized. (this check is // only there for backwards compatibility when mixing projects built // with old versions of CMake and new) @@ -299,6 +309,14 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, "target_link_libraries"); return false; } + if (this->Target->IsImported() && + this->CurrentProcessingState != ProcessingKeywordLinkInterface) { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + "IMPORTED library can only be used with the INTERFACE keyword of " + "target_link_libraries"); + return false; + } cmTarget::TLLSignature sig = (this->CurrentProcessingState == ProcessingPlainPrivateInterface || @@ -355,6 +373,16 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, cmTarget* t = this->Makefile->FindLocalNonAliasTarget(this->Target->GetName()); if (!t) { + const std::vector<cmTarget*>& importedTargets = + this->Makefile->GetOwnedImportedTargets(); + for (cmTarget* importedTarget : importedTargets) { + if (importedTarget->GetName() == this->Target->GetName()) { + t = importedTarget; + break; + } + } + } + if (!t) { std::ostringstream e; e << "Attempt to add link library \"" << lib << "\" to target \"" << this->Target->GetName() diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 45fe430..9a8fd96 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -17,11 +17,11 @@ bool cmTargetPropCommandBase::HandleArguments( return false; } - // Lookup the target for which libraries are specified. if (this->Makefile->IsAlias(args[0])) { this->SetError("can not be used on an ALIAS target."); return false; } + // Lookup the target for which property-values are specified. this->Target = this->Makefile->GetCMakeInstance()->GetGlobalGenerator()->FindTarget( args[0]); @@ -84,16 +84,13 @@ bool cmTargetPropCommandBase::ProcessContentArgs( this->SetError("called with invalid arguments"); return false; } - - if (this->Target->IsImported()) { - this->HandleImportedTarget(args[0]); - return false; - } - if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY && scope != "INTERFACE") { - this->SetError("may only be set INTERFACE properties on INTERFACE " - "targets"); + this->SetError("may only set INTERFACE properties on INTERFACE targets"); + return false; + } + if (this->Target->IsImported() && scope != "INTERFACE") { + this->SetError("may only set INTERFACE properties on IMPORTED targets"); return false; } diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index 46a2f6b..3c736fc 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -35,7 +35,6 @@ protected: bool prepend, bool system); private: - virtual void HandleImportedTarget(const std::string& tgt) = 0; virtual void HandleMissingTarget(const std::string& name) = 0; virtual bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 058659a..3dd3748 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -17,13 +17,6 @@ bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args, return this->HandleArguments(args, "SOURCES"); } -void cmTargetSourcesCommand::HandleImportedTarget(const std::string& tgt) -{ - std::ostringstream e; - e << "Cannot specify sources for imported target \"" << tgt << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); -} - void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name) { std::ostringstream e; @@ -43,5 +36,5 @@ bool cmTargetSourcesCommand::HandleDirectContent( cmTarget* tgt, const std::vector<std::string>& content, bool, bool) { tgt->AppendProperty("SOURCES", this->Join(content).c_str()); - return true; + return true; // Successfully handled. } diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index 0639e98..ea8776a 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -30,7 +30,6 @@ public: cmExecutionStatus& status) override; private: - void HandleImportedTarget(const std::string& tgt) override; void HandleMissingTarget(const std::string& name) override; bool HandleDirectContent(cmTarget* tgt, diff --git a/Source/cmVS141CLFlagTable.h b/Source/cmVS141CLFlagTable.h index c780d46..7d3e356 100644 --- a/Source/cmVS141CLFlagTable.h +++ b/Source/cmVS141CLFlagTable.h @@ -1,6 +1,10 @@ static cmVS7FlagTable cmVS141CLFlagTable[] = { // Enum Properties + { "DiagnosticsFormat", "diagnostics:classic", "Classic", "Classic", 0 }, + { "DiagnosticsFormat", "diagnostics:column", "Column", "Column", 0 }, + { "DiagnosticsFormat", "diagnostics:caret", "Caret", "Caret", 0 }, + { "DebugInformationFormat", "", "None", "None", 0 }, { "DebugInformationFormat", "Z7", "C7 compatible", "OldStyle", 0 }, { "DebugInformationFormat", "Zi", "Program Database", "ProgramDatabase", 0 }, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0a303b0..1aadf67 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1602,6 +1602,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) std::string shaderEntryPoint; std::string shaderModel; std::string shaderAdditionalFlags; + std::string shaderDisableOptimizations; + std::string shaderEnableDebug; std::string outputHeaderFile; std::string variableName; std::string settingsGenerator; @@ -1668,6 +1670,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) shaderAdditionalFlags = saf; toolHasSettings = true; } + // Figure out if debug information should be generated + if (const char* sed = sf->GetProperty("VS_SHADER_ENABLE_DEBUG")) { + shaderEnableDebug = cmSystemTools::IsOn(sed) ? "true" : "false"; + toolHasSettings = true; + } + // Figure out if optimizations should be disabled + if (const char* sdo = sf->GetProperty("VS_SHADER_DISABLE_OPTIMIZATIONS")) { + shaderDisableOptimizations = cmSystemTools::IsOn(sdo) ? "true" : "false"; + toolHasSettings = true; + } } else if (ext == "jpg" || ext == "png") { tool = "Image"; } else if (ext == "resw") { @@ -1810,6 +1822,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) this->WriteString("</VariableName>\n", 0); } } + if (!shaderEnableDebug.empty()) { + this->WriteString("<EnableDebuggingInformation>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(shaderEnableDebug) + << "</EnableDebuggingInformation>\n"; + } + if (!shaderDisableOptimizations.empty()) { + this->WriteString("<DisableOptimizations>", 3); + (*this->BuildFileStream) << cmVS10EscapeXML(shaderDisableOptimizations) + << "</DisableOptimizations>\n"; + } if (!shaderAdditionalFlags.empty()) { this->WriteString("<AdditionalOptions>", 3); (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index cf55741..6705851 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -38,12 +38,14 @@ codecvt::codecvt(Encoding e) } } -codecvt::~codecvt(){}; +codecvt::~codecvt() +{ +} bool codecvt::do_always_noconv() const throw() { return m_noconv; -}; +} std::codecvt_base::result codecvt::do_out(mbstate_t& state, const char* from, const char* from_end, @@ -122,7 +124,7 @@ std::codecvt_base::result codecvt::do_out(mbstate_t& state, const char* from, static_cast<void>(to_next); return std::codecvt_base::noconv; #endif -}; +} std::codecvt_base::result codecvt::do_unshift(mbstate_t& state, char* to, char* to_end, @@ -143,7 +145,7 @@ std::codecvt_base::result codecvt::do_unshift(mbstate_t& state, char* to, static_cast<void>(to_end); return std::codecvt_base::ok; #endif -}; +} #if defined(_WIN32) std::codecvt_base::result codecvt::Decode(mbstate_t& state, int size, @@ -235,9 +237,9 @@ void codecvt::BufferPartial(mbstate_t& state, int size, int codecvt::do_max_length() const throw() { return 4; -}; +} int codecvt::do_encoding() const throw() { return 0; -}; +} diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 4810cd0..ef75b01 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -33,16 +33,14 @@ #include "cmsys/Process.h" #include "cmsys/Terminal.h" #include <algorithm> -#include <functional> #include <iostream> #include <iterator> -#include <map> #include <memory> // IWYU pragma: keep #include <sstream> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <time.h> -#include <utility> class cmConnection; @@ -161,7 +159,8 @@ static bool cmTarFilesFrom(std::string const& file, return true; } -int cmcmd::HandleIWYU(const std::string& runCmd, const std::string&, +static int HandleIWYU(const std::string& runCmd, + const std::string& /* sourceFile */, const std::vector<std::string>& orig_cmd) { // Construct the iwyu command line by taking what was given @@ -188,7 +187,7 @@ int cmcmd::HandleIWYU(const std::string& runCmd, const std::string&, return 0; } -int cmcmd::HandleTidy(const std::string& runCmd, const std::string& sourceFile, +static int HandleTidy(const std::string& runCmd, const std::string& sourceFile, const std::vector<std::string>& orig_cmd) { // Construct the clang-tidy command line by taking what was given @@ -219,7 +218,8 @@ int cmcmd::HandleTidy(const std::string& runCmd, const std::string& sourceFile, return ret; } -int cmcmd::HandleLWYU(const std::string& runCmd, const std::string&, +static int HandleLWYU(const std::string& runCmd, + const std::string& /* sourceFile */, const std::vector<std::string>&) { // Construct the ldd -r -u (link what you use lwyu) command line @@ -251,7 +251,7 @@ int cmcmd::HandleLWYU(const std::string& runCmd, const std::string&, return 0; } -int cmcmd::HandleCppLint(const std::string& runCmd, +static int HandleCppLint(const std::string& runCmd, const std::string& sourceFile, const std::vector<std::string>&) { @@ -275,7 +275,7 @@ int cmcmd::HandleCppLint(const std::string& runCmd, return ret; } -int cmcmd::HandleCppCheck(const std::string& runCmd, +static int HandleCppCheck(const std::string& runCmd, const std::string& sourceFile, const std::vector<std::string>& orig_cmd) { @@ -327,60 +327,70 @@ int cmcmd::HandleCppCheck(const std::string& runCmd, return 0; } +typedef int (*CoCompileHandler)(const std::string&, const std::string&, + const std::vector<std::string>&); + +struct CoCompiler +{ + const char* Option; + CoCompileHandler Handler; + bool NoOriginalCommand; +}; + +static CoCompiler CoCompilers[] = { // Table of options and handlers. + { "--cppcheck=", HandleCppCheck, false }, + { "--cpplint=", HandleCppLint, false }, + { "--iwyu=", HandleIWYU, false }, + { "--lwyu=", HandleLWYU, true }, + { "--tidy=", HandleTidy, false } +}; + +struct CoCompileJob +{ + std::string Command; + CoCompileHandler Handler; +}; + // called when args[0] == "__run_co_compile" int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) { - // initialize a map from command option to handler function - std::map<std::string, - std::function<int(const std::string&, const std::string&, - const std::vector<std::string>&)>> - coCompileTypes; - auto a1 = std::placeholders::_1; - auto a2 = std::placeholders::_2; - auto a3 = std::placeholders::_3; - // create a map from option to handler function for option - // if the option does not call the original command then it will need - // to set runOriginalCmd to false later in this function - coCompileTypes["--iwyu="] = std::bind(&cmcmd::HandleIWYU, a1, a2, a3); - coCompileTypes["--tidy="] = std::bind(&cmcmd::HandleTidy, a1, a2, a3); - coCompileTypes["--lwyu="] = std::bind(&cmcmd::HandleLWYU, a1, a2, a3); - coCompileTypes["--cpplint="] = std::bind(&cmcmd::HandleCppLint, a1, a2, a3); - coCompileTypes["--cppcheck="] = - std::bind(&cmcmd::HandleCppCheck, a1, a2, a3); - // copy the command options to a vector of strings - std::vector<std::string> commandOptions; - commandOptions.reserve(coCompileTypes.size()); - for (const auto& i : coCompileTypes) { - commandOptions.push_back(i.first); - } - - std::string runCmd; // command to be run from --thing=command - std::string sourceFile; // store --source= - std::string commandFound; // the command that was in the args list + std::vector<CoCompileJob> jobs; + std::string sourceFile; // store --source= + + // Default is to run the original command found after -- if the option + // does not need to do that, it should be specified here, currently only + // lwyu does that. + bool runOriginalCmd = true; + std::vector<std::string> orig_cmd; bool doing_options = true; - for (std::string::size_type cc = 2; cc < args.size(); cc++) { - std::string const& arg = args[cc]; + for (std::string::size_type i = 2; i < args.size(); ++i) { + std::string const& arg = args[i]; // if the arg is -- then the rest of the args after // go into orig_cmd if (arg == "--") { doing_options = false; } else if (doing_options) { bool optionFound = false; - // check arg against all the commandOptions - for (auto const& command : commandOptions) { - if (arg.compare(0, command.size(), command) == 0) { + for (CoCompiler const* cc = cm::cbegin(CoCompilers); + cc != cm::cend(CoCompilers); ++cc) { + size_t optionLen = strlen(cc->Option); + if (arg.compare(0, optionLen, cc->Option) == 0) { optionFound = true; - runCmd = arg.substr(command.size()); - commandFound = command; + CoCompileJob job; + job.Command = arg.substr(optionLen); + job.Handler = cc->Handler; + jobs.push_back(std::move(job)); + if (cc->NoOriginalCommand) { + runOriginalCmd = false; + } } } - // check arg with --source= if (cmHasLiteralPrefix(arg, "--source=")) { sourceFile = arg.substr(9); optionFound = true; } - // if it was not a commandOptions or --source then error + // if it was not a co-compiler or --source then error if (!optionFound) { std::cerr << "__run_co_compile given unknown argument: " << arg << "\n"; @@ -390,39 +400,40 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) orig_cmd.push_back(arg); } } - if (commandFound.empty()) { - std::cerr << "__run_co_compile missing command to run. Looking for one of " - "the following:\n"; - for (const auto& i : commandOptions) { - std::cerr << i << "\n"; + if (jobs.empty()) { + std::cerr << "__run_co_compile missing command to run. " + "Looking for one or more of the following:\n"; + for (CoCompiler const* cc = cm::cbegin(CoCompilers); + cc != cm::cend(CoCompilers); ++cc) { + std::cerr << cc->Option << "\n"; } return 1; } - // Default is to run the original command found after -- if the option - // does not need to do that, it should be specified here, currently only - // lwyu does that. - bool runOriginalCmd = true; - if (commandFound == "--lwyu=") { - runOriginalCmd = false; - } + if (runOriginalCmd && orig_cmd.empty()) { std::cerr << "__run_co_compile missing compile command after --\n"; return 1; } - // call the command handler here - int ret = coCompileTypes[commandFound](runCmd, sourceFile, orig_cmd); - // if the command returns non-zero then return and fail. - // for commands that do not want to break the build, they should return - // 0 no matter what. - if (ret != 0) { - return ret; + for (CoCompileJob const& job : jobs) { + // call the command handler here + int ret = job.Handler(job.Command, sourceFile, orig_cmd); + + // if the command returns non-zero then return and fail. + // for commands that do not want to break the build, they should return + // 0 no matter what. + if (ret != 0) { + return ret; + } } + // if there is no original command to run return now if (!runOriginalCmd) { - return ret; + return 0; } + // Now run the real compiler command and return its result value + int ret; if (!cmSystemTools::RunSingleCommand(orig_cmd, nullptr, nullptr, &ret, nullptr, cmSystemTools::OUTPUT_PASSTHROUGH)) { diff --git a/Source/cmcmd.h b/Source/cmcmd.h index 090ca08..d1e03d0 100644 --- a/Source/cmcmd.h +++ b/Source/cmcmd.h @@ -18,24 +18,6 @@ public: */ static int ExecuteCMakeCommand(std::vector<std::string>&); - // define co-compile command handlers they must be public - // because they are used in a std::function map - static int HandleIWYU(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd); - static int HandleTidy(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd); - static int HandleLWYU(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd); - static int HandleCppLint(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd); - static int HandleCppCheck(const std::string& runCmd, - const std::string& sourceFile, - const std::vector<std::string>& orig_cmd); - protected: static int HandleCoCompileCommands(std::vector<std::string>& args); static int HashSumFile(std::vector<std::string>& args, diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index ec35b89..b9d8e46 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -214,5 +214,9 @@ add_subdirectory(objectLibrary) add_subdirectory(sameName) # -- Test +# Tests static library cycles +add_subdirectory(staticLibraryCycle) + +# -- Test # Complex test case add_subdirectory(complex) diff --git a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt new file mode 100644 index 0000000..144a435 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt @@ -0,0 +1,17 @@ +# Test AUTOMOC and AUTORCC on source files with the same name +# but in different subdirectories + +set(CMAKE_AUTOMOC ON) + +# Cyclic static libraries +add_library(slc_a STATIC a.cpp) +target_link_libraries(slc_a ${QT_LIBRARIES} slc_b) + +add_library(slc_b STATIC b.cpp) +target_link_libraries(slc_b ${QT_LIBRARIES} slc_c) + +add_library(slc_c STATIC c.cpp) +target_link_libraries(slc_c ${QT_LIBRARIES} slc_a) + +add_executable(slc main.cpp) +target_link_libraries(slc ${QT_LIBRARIES} slc_a) diff --git a/Tests/QtAutogen/staticLibraryCycle/a.cpp b/Tests/QtAutogen/staticLibraryCycle/a.cpp new file mode 100644 index 0000000..97cc66e --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/a.cpp @@ -0,0 +1,7 @@ +#include "a.h" +#include "b.h" + +A::A() +{ + B b; +} diff --git a/Tests/QtAutogen/staticLibraryCycle/a.h b/Tests/QtAutogen/staticLibraryCycle/a.h new file mode 100644 index 0000000..7176170 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/a.h @@ -0,0 +1,13 @@ +#ifndef CLASSA_HPP +#define CLASSA_HPP + +#include <QObject> + +class A : public QObject +{ + Q_OBJECT +public: + A(); +}; + +#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/b.cpp b/Tests/QtAutogen/staticLibraryCycle/b.cpp new file mode 100644 index 0000000..a807d89 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/b.cpp @@ -0,0 +1,7 @@ +#include "b.h" +#include "c.h" + +B::B() +{ + C c; +} diff --git a/Tests/QtAutogen/staticLibraryCycle/b.h b/Tests/QtAutogen/staticLibraryCycle/b.h new file mode 100644 index 0000000..ededbd8 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/b.h @@ -0,0 +1,13 @@ +#ifndef CLASSB_HPP +#define CLASSB_HPP + +#include <QObject> + +class B : public QObject +{ + Q_OBJECT +public: + B(); +}; + +#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/c.cpp b/Tests/QtAutogen/staticLibraryCycle/c.cpp new file mode 100644 index 0000000..7d427c2 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/c.cpp @@ -0,0 +1,7 @@ +#include "c.h" +#include "a.h" + +C::C() +{ + A a; +} diff --git a/Tests/QtAutogen/staticLibraryCycle/c.h b/Tests/QtAutogen/staticLibraryCycle/c.h new file mode 100644 index 0000000..20f3725 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/c.h @@ -0,0 +1,13 @@ +#ifndef CLASSC_HPP +#define CLASSC_HPP + +#include <QObject> + +class C : public QObject +{ + Q_OBJECT +public: + C(); +}; + +#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/main.cpp b/Tests/QtAutogen/staticLibraryCycle/main.cpp new file mode 100644 index 0000000..f5b7fd2 --- /dev/null +++ b/Tests/QtAutogen/staticLibraryCycle/main.cpp @@ -0,0 +1,8 @@ +#include "a.h" + +int main(int argv, char** args) +{ + // Object instances + A a; + return 0; +} diff --git a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt index e3e3ff4..70ed05b 100644 --- a/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt +++ b/Tests/RunCMake/CMP0040/CMP0040-WARN-missing-target-stderr.txt @@ -1,8 +1,8 @@ CMake Warning \(dev\) at CMP0040-WARN-missing-target.cmake:2 \(add_custom_command\): Policy CMP0040 is not set: The target in the TARGET signature of - add_custom_command\(\) must exist. Run "cmake --help-policy CMP0040" for - policy details. Use the cmake_policy command to set the policy and - suppress this warning. + add_custom_command\(\) must exist and must be defined in the current + directory. Run "cmake --help-policy CMP0040" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + No TARGET 'foobar' has been created in this directory. Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index b70aeb9..5d584af 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -374,6 +374,12 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>) add_RunCMake_test(Cppcheck -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck>) + add_RunCMake_test(MultiLint + -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy> + -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu> + -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint> + -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck> + ) if(DEFINED CMake_TEST_CUDA) list(APPEND CompilerLauncher_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) endif() diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index aa55c44..b00e373 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -12,7 +12,7 @@ run_cpack_test(DIST "RPM" false "MONOLITHIC") run_cpack_test(EMPTY_DIR "RPM;DEB;TGZ" true "MONOLITHIC;COMPONENT") run_cpack_test(VERSION "RPM;DEB" false "MONOLITHIC;COMPONENT") run_cpack_test(EXTRA "DEB" false "COMPONENT") -run_cpack_test(GENERATE_SHLIBS "DEB" true "COMPONENT") +run_cpack_test_subtests(GENERATE_SHLIBS "soversion_not_zero;soversion_zero" "DEB" true "COMPONENT") run_cpack_test(GENERATE_SHLIBS_LDCONFIG "DEB" true "COMPONENT") run_cpack_test(INSTALL_SCRIPTS "RPM" false "COMPONENT") run_cpack_test(LONG_FILENAMES "DEB" false "MONOLITHIC") diff --git a/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake index 7375ecc..1b2eb48 100644 --- a/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/DIST/VerifyResult.cmake @@ -5,6 +5,11 @@ execute_process(COMMAND ${RPMBUILD_EXECUTABLE} -E %{?dist} set(whitespaces_ "[\t\n\r ]*") +# since we have no control over dist tag value we should try to escape +# the content for use as a regular expression +string(REPLACE "+" "\\+" DIST_TAG "${DIST_TAG}") +string(REPLACE "." "\\." DIST_TAG "${DIST_TAG}") + getPackageInfo("${FOUND_FILE_1}" "FILE_INFO_") if(NOT FILE_INFO_ MATCHES ".*Release${whitespaces_}:${whitespaces_}1${DIST_TAG}") message(FATAL_ERROR "Unexpected Release in '${FOUND_FILE_1}'; file info: '${FILE_INFO_}'") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake index b1952ef..8cefeea 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/VerifyResult.cmake @@ -1,4 +1,9 @@ -set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero") + set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +else() # soversion_zero + set(shlibs_shlibs "^libtest_lib 0 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$") +endif() + # optional dot at the end of permissions regex is for SELinux enabled systems set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*") verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs") diff --git a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake index 90351ba..e0eb67b 100644 --- a/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake +++ b/Tests/RunCMake/CPack/tests/GENERATE_SHLIBS/test.cmake @@ -9,6 +9,11 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" "#include \"test_lib.hpp\"\nint test_lib() {return 0;}\n") add_library(test_lib SHARED "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp") -set_target_properties(test_lib PROPERTIES SOVERSION "0.8") + +if(RunCMake_SUBTEST_SUFFIX STREQUAL "soversion_not_zero") + set_target_properties(test_lib PROPERTIES SOVERSION "0.8") +else() # soversion_zero + set_target_properties(test_lib PROPERTIES SOVERSION "0") +endif() install(TARGETS test_lib DESTINATION foo COMPONENT libs) diff --git a/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt index ffa1da8..a7fbad6 100644 --- a/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt +++ b/Tests/RunCMake/CommandLine/E___run_co_compile-no-iwyu-stderr.txt @@ -1,5 +1,6 @@ -^__run_co_compile missing command to run. Looking for one of the following: -.*--cppcheck= -.*--cpplint= -.*--iwyu= -.*--tidy= +^__run_co_compile missing command to run. Looking for one or more of the following: +--cppcheck= +--cpplint= +--iwyu= +--lwyu= +--tidy= diff --git a/Tests/RunCMake/MultiLint/C-Build-stdout.txt b/Tests/RunCMake/MultiLint/C-Build-stdout.txt new file mode 100644 index 0000000..d10427e --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.c:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt b/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt new file mode 100644 index 0000000..d10427e --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-launch-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.c:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/C-launch.cmake b/Tests/RunCMake/MultiLint/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/MultiLint/C.cmake b/Tests/RunCMake/MultiLint/C.cmake new file mode 100644 index 0000000..495d6f0 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C.cmake @@ -0,0 +1,6 @@ +enable_language(C) +set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.c) diff --git a/Tests/RunCMake/MultiLint/CMakeLists.txt b/Tests/RunCMake/MultiLint/CMakeLists.txt new file mode 100644 index 0000000..bf2ef15 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt b/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt new file mode 100644 index 0000000..aaf5fd7 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.cxx:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt b/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..aaf5fd7 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-launch-Build-stdout.txt @@ -0,0 +1,8 @@ +Warning: include-what-you-use reported diagnostics: +should add these lines: +* +#include <\.\.\.> ++ +.*Tests[/\]RunCMake[/\]MultiLint[/\]main\.cxx:0:0: warning: message \[checker\].* +Total errors found: 0 +.*Warning: cppcheck reported diagnostics.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/MultiLint/CXX-launch.cmake b/Tests/RunCMake/MultiLint/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX.cmake b/Tests/RunCMake/MultiLint/CXX.cmake new file mode 100644 index 0000000..dc30146 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX.cmake @@ -0,0 +1,6 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_CXX_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80) +set(CMAKE_CXX_CPPCHECK "${PSEUDO_CPPCHECK}") +add_executable(main main.cxx) diff --git a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake new file mode 100644 index 0000000..afd98fd --- /dev/null +++ b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake @@ -0,0 +1,27 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS + "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}" + "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}" + "-DPSEUDO_IWYU=${PSEUDO_IWYU}" + "-DPSEUDO_TIDY=${PSEUDO_TIDY}" + ) + +function(run_multilint lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${lang}-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_multilint(C) +run_multilint(CXX) + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_multilint(C-launch) + run_multilint(CXX-launch) +endif() diff --git a/Tests/RunCMake/MultiLint/main.c b/Tests/RunCMake/MultiLint/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/MultiLint/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/MultiLint/main.cxx b/Tests/RunCMake/MultiLint/main.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/MultiLint/main.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt deleted file mode 100644 index adcd3a2..0000000 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at UNKNOWNwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Cannot specify link libraries for target \"TestUnknownLibWithoutSources\" - which is not built by this project. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake index 8e014c2..a977d42 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake +++ b/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects.cmake @@ -2,4 +2,4 @@ enable_language(CXX) add_library(ObjectLibDependency OBJECT test.cpp) add_library(TestUnknownLibWithoutSources UNKNOWN IMPORTED) -target_link_libraries(TestUnknownLibWithoutSources PUBLIC $<TARGET_OBJECTS:ObjectLibDependency>) +target_link_libraries(TestUnknownLibWithoutSources INTERFACE $<TARGET_OBJECTS:ObjectLibDependency>) diff --git a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake index 9a5eaaf..dded248 100644 --- a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake +++ b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake @@ -6,6 +6,7 @@ run_cmake(exclude-from-all) run_cmake(imported) run_cmake(invalid-name) run_cmake(invalid-target) +run_cmake(imported-global-target) run_cmake(imported-target) run_cmake(alias-target) run_cmake(set_property) diff --git a/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt b/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt new file mode 100644 index 0000000..8259c80 --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-global-target-stderr.txt @@ -0,0 +1,2 @@ +^'alias-test-exe' is an alias for 'test-exe' and its name-property contains 'test-exe'. +'alias-test-lib' is an alias for 'test-lib' and its name-property contains 'test-lib'.$ diff --git a/Tests/RunCMake/alias_targets/imported-global-target.cmake b/Tests/RunCMake/alias_targets/imported-global-target.cmake new file mode 100644 index 0000000..12c4e0a --- /dev/null +++ b/Tests/RunCMake/alias_targets/imported-global-target.cmake @@ -0,0 +1,46 @@ + +enable_language(CXX) + + +add_executable(test-exe IMPORTED GLOBAL) +add_executable(alias-test-exe ALIAS test-exe) + +if(TARGET alias-test-exe) + get_target_property(aliased-target alias-test-exe ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-exe") + get_target_property(aliased-name alias-test-exe NAME) + if("${aliased-name}" STREQUAL "test-exe") + message("'alias-test-exe' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-exe' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-exe' is something but not a real target!?") + endif() +else() + message("'alias-test-exe' does not exist!?") +endif() + + +add_library(test-lib SHARED IMPORTED GLOBAL) +add_library(alias-test-lib ALIAS test-lib) + +if(TARGET alias-test-lib) + get_target_property(aliased-target alias-test-lib ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-lib") + get_target_property(aliased-name alias-test-lib NAME) + if("${aliased-name}" STREQUAL "test-lib") + message("'alias-test-lib' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-lib' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-lib' is something but not a real target!?") + endif() +else() + message("'alias-test-lib' does not exist!?") +endif() diff --git a/Tests/RunCMake/alias_targets/imported-target-stderr.txt b/Tests/RunCMake/alias_targets/imported-target-stderr.txt index bbff29a..12ffbc2 100644 --- a/Tests/RunCMake/alias_targets/imported-target-stderr.txt +++ b/Tests/RunCMake/alias_targets/imported-target-stderr.txt @@ -1,5 +1,9 @@ -CMake Error at imported-target.cmake:6 \(add_library\): - add_library cannot create ALIAS target "alias" because target "foo" is - IMPORTED. +^CMake Error at imported-target.cmake:[0-9]+ \(add_executable\): + add_executable cannot create ALIAS target \"alias-test-exe\" because target + \"test-exe\" is imported but not globally visible. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\) + + +'alias-test-exe' does not exist![?] +'alias-test-lib' does not exist![?]$ diff --git a/Tests/RunCMake/alias_targets/imported-target.cmake b/Tests/RunCMake/alias_targets/imported-target.cmake index 7259ab0..bb682fe 100644 --- a/Tests/RunCMake/alias_targets/imported-target.cmake +++ b/Tests/RunCMake/alias_targets/imported-target.cmake @@ -1,6 +1,46 @@ enable_language(CXX) -add_library(foo SHARED IMPORTED) -add_library(alias ALIAS foo) +add_executable(test-exe IMPORTED) +add_executable(alias-test-exe ALIAS test-exe) + +if(TARGET alias-test-exe) + get_target_property(aliased-target alias-test-exe ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-exe") + get_target_property(aliased-name alias-test-exe NAME) + if("${aliased-name}" STREQUAL "test-exe") + message("'alias-test-exe' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-exe' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-exe' is something but not a real target!?") + endif() +else() + message("'alias-test-exe' does not exist!?") +endif() + + +add_library(test-lib SHARED IMPORTED) +add_library(alias-test-lib ALIAS test-lib) + +if(TARGET alias-test-lib) + get_target_property(aliased-target alias-test-lib ALIASED_TARGET) + if("${aliased-target}" STREQUAL "test-lib") + get_target_property(aliased-name alias-test-lib NAME) + if("${aliased-name}" STREQUAL "test-lib") + message("'alias-test-lib' is an alias for '${aliased-target}'" + " and its name-property contains '${aliased-name}'.") + else() + message("'alias-test-lib' is an alias for '${aliased-target}'" + " but its name-property contains '${aliased-name}'!?") + endif() + else() + message("'alias-test-lib' is something but not a real target!?") + endif() +else() + message("'alias-test-lib' does not exist!?") +endif() diff --git a/Tests/RunCMake/interface_library/target_commands-stderr.txt b/Tests/RunCMake/interface_library/target_commands-stderr.txt index be11b77..9362a75 100644 --- a/Tests/RunCMake/interface_library/target_commands-stderr.txt +++ b/Tests/RunCMake/interface_library/target_commands-stderr.txt @@ -23,25 +23,25 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:9 \(target_include_directories\): - target_include_directories may only be set INTERFACE properties on - INTERFACE targets + target_include_directories may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:10 \(target_include_directories\): - target_include_directories may only be set INTERFACE properties on - INTERFACE targets + target_include_directories may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:12 \(target_compile_definitions\): - target_compile_definitions may only be set INTERFACE properties on - INTERFACE targets + target_compile_definitions may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + CMake Error at target_commands.cmake:13 \(target_compile_definitions\): - target_compile_definitions may only be set INTERFACE properties on - INTERFACE targets + target_compile_definitions may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt index 7a07427..afad537 100644 --- a/Tests/RunCMake/target_compile_features/imported_target-stderr.txt +++ b/Tests/RunCMake/target_compile_features/imported_target-stderr.txt @@ -1,4 +1,5 @@ -CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): - Cannot specify compile features for imported target "main". +^CMake Error at imported_target.cmake:[0-9]+ \(target_compile_features\): + target_compile_features may only set INTERFACE properties on INTERFACE + targets Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/target_compile_features/imported_target.cmake b/Tests/RunCMake/target_compile_features/imported_target.cmake index e886ce9..e410ace 100644 --- a/Tests/RunCMake/target_compile_features/imported_target.cmake +++ b/Tests/RunCMake/target_compile_features/imported_target.cmake @@ -1,4 +1,10 @@ enable_language(CXX) -add_library(main INTERFACE IMPORTED) -target_compile_features(main INTERFACE cxx_delegating_constructors) +add_library(lib1-interface INTERFACE IMPORTED) +target_compile_features(lib1-interface INTERFACE cxx_delegating_constructors) + +add_library(lib2-interface INTERFACE IMPORTED) +target_compile_features(lib2-interface PUBLIC cxx_delegating_constructors) + +add_library(lib-shared SHARED IMPORTED) +target_compile_features(lib-shared INTERFACE cxx_delegating_constructors) diff --git a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt index 3708998..23a8eeb 100644 --- a/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt +++ b/Tests/RunCMake/target_compile_features/invalid_args_on_interface-stderr.txt @@ -1,5 +1,5 @@ CMake Error at invalid_args_on_interface.cmake:[0-9]+ \(target_compile_features\): - target_compile_features may only be set INTERFACE properties on INTERFACE + target_compile_features may only set INTERFACE properties on INTERFACE targets Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake new file mode 100644 index 0000000..e5ec3f6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTarget.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal INTERFACE z) diff --git a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/add_library/UNKNOWNwithNoSourcesButLinkObjects-result.txt +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-result.txt diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt new file mode 100644 index 0000000..1cafa5b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at ImportedTargetFailure.cmake:[0-9]+ \(target_link_libraries\): + IMPORTED library can only be used with the INTERFACE keyword of + target_link_libraries +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake new file mode 100644 index 0000000..3ac0aa9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/ImportedTargetFailure.cmake @@ -0,0 +1,2 @@ +add_library(UnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) +target_link_libraries(UnknownImportedGlobal PRIVATE z) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index b1c9435..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,6 +4,8 @@ run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) +run_cmake(ImportedTarget) +run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) run_cmake(SubDirTarget) |