<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class="">Hey,</div><div class=""><br class=""></div><div class="">it’s nice to see that we’re now able to set include directories and compiler flags for imported targets as well apparently.</div><div class="">This means, no more</div><div class=""><br class=""></div><div class="">    add_library(foo UNKNOWN IMPORTED)</div><div class="">    set_target_properties(foo PROPERTIES</div><div class="">      INTERFACE_INCLUDE_DIRECTORIES …</div><div class="">      IMPORTED_LOCATION ..)</div><div class=""><br class=""></div><div class="">but using target_* just like for any other target as well</div><div class=""><br class=""></div><div class="">    add_library(foo UNKNOWN IMPORTED)</div><div class="">    target_include_directories(foo PUBLIC …)</div><div class="">    </div><div class="">However, reading through the 3.11 documentation [1] I think I’ve found a bug unfortunately:</div><div class=""><br class=""></div><div class="">"It is not possible to use an IMPORTED target in the left-hand-side of the target_compile_definitions(), target_include_directories(), target_compile_options() or target_link_libraries() commands, as that would be an attempt to modify it. IMPORTED targets are designed to be used only in the right-hand-side of those commands."</div><div class=""><br class=""></div><div class="">If that’s really the case, I will submit a patch for it right away. I just want to make sure, I’m not misunderstanding something here?</div><div class=""><br class=""></div><div class="">Greetings,</div><div class=""><br class=""></div><div class="">Kai Wolf</div><div class=""><a href="http://kai-wolf.me/" class=""></a><a href="http://kai-wolf.me/" class=""></a><a href="http://kai-wolf.me/" class=""></a><a href="http://kai-wolf.me/" class="">http://kai-wolf.me/</a></div><div class=""><br class=""></div><div class="">[1] <a href="https://cmake.org/cmake/help/v3.11/manual/cmake-buildsystem.7.html?highlight=right%20hand%20side#imported-targets" class="">https://cmake.org/cmake/help/v3.11/manual/cmake-buildsystem.7.html?highlight=right%20hand%20side#imported-targets</a></div>


</div>
<div><br class=""><blockquote type="cite" class=""><div class="">Am 09.03.2018 um 20:00 schrieb Robert Maynard <<a href="mailto:robert.maynard@kitware.com" class="">robert.maynard@kitware.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div class="">I am proud to announce the third CMake 3.11 release candidate.<br class="">  <a href="https://cmake.org/download/" class="">https://cmake.org/download/</a><br class=""><br class="">Documentation is available at:<br class="">  <a href="https://cmake.org/cmake/help/v3.11" class="">https://cmake.org/cmake/help/v3.11</a><br class=""><br class="">Release notes appear below and are also published at<br class="">  <a href="https://cmake.org/cmake/help/v3.11/release/3.11.html" class="">https://cmake.org/cmake/help/v3.11/release/3.11.html</a><br class=""><br class="">Some of the more significant changes in CMake 3.11 are:<br class=""><br class="">* The Makefile Generators and the "Ninja" generator learned to add<br class="">  compiler launcher tools along with the compiler for the "Fortran"<br class="">  language ("C", "CXX", and "CUDA" were supported previously). See the<br class="">  "CMAKE_<LANG>_COMPILER_LAUNCHER" variable and<br class="">  "<LANG>_COMPILER_LAUNCHER" target property for details.<br class=""><br class="">* Visual Studio Generators learned to support the "COMPILE_LANGUAGE"<br class="">  "generator expression" in target-wide "COMPILE_DEFINITIONS",<br class="">  "INCLUDE_DIRECTORIES", "COMPILE_OPTIONS", and "file(GENERATE)".  See<br class="">  generator expression documentation for caveats.<br class=""><br class="">* The "Xcode" Generator learned to support the "COMPILE_LANGUAGE"<br class="">  "generator expression" in target-wide "COMPILE_DEFINITIONS" and<br class="">  "INCLUDE_DIRECTORIES".  It previously supported only<br class="">  "COMPILE_OPTIONS" and "file(GENERATE)". See generator expression<br class="">  documentation for caveats.<br class=""><br class="">* "add_library()" and "add_executable()" commands can now be called<br class="">  without any sources and will not complain as long as sources are<br class="">  added later via the "target_sources()" command.<br class=""><br class="">* The "target_compile_definitions()" command learned to set the<br class="">  "INTERFACE_COMPILE_DEFINITIONS" property on Imported Targets.<br class=""><br class="">* The "target_compile_features()" command learned to set the<br class="">  "INTERFACE_COMPILE_FEATURES" property on Imported Targets.<br class=""><br class="">* The "target_compile_options()" command learned to set the<br class="">  "INTERFACE_COMPILE_OPTIONS" property on Imported Targets.<br class=""><br class="">* The "target_include_directories()" command learned to set the<br class="">  "INTERFACE_INCLUDE_DIRECTORIES" property on Imported Targets.<br class=""><br class="">* The "target_sources()" command learned to set the<br class="">  "INTERFACE_SOURCES" property on Imported Targets.<br class=""><br class="">* The "target_link_libraries()" command learned to set the<br class="">  "INTERFACE_LINK_LIBRARIES" property on Imported Targets.<br class=""><br class="">* The "COMPILE_DEFINITIONS" source file property learned to support<br class="">  "generator expressions".<br class=""><br class="">* A "COMPILE_OPTIONS" source file property was added to manage list<br class="">  of options to pass to the compiler.<br class=""><br class="">* When using "AUTOMOC" or "AUTOUIC", CMake now starts multiple<br class="">  parallel "moc" or "uic" processes to reduce the build time. A new<br class="">  "CMAKE_AUTOGEN_PARALLEL" variable and "AUTOGEN_PARALLEL" target<br class="">  property may be set to specify the number of parallel "moc" or "uic"<br class="">  processes to start.  The default is derived from the number of CPUs<br class="">  on the host.<br class=""><br class=""><br class="">CMake 3.11 Release Notes<br class="">************************<br class=""><br class="">Changes made since CMake 3.10 include the following.<br class=""><br class=""><br class="">New Features<br class="">============<br class=""><br class=""><br class="">Platforms<br class="">---------<br class=""><br class="">* TI C/C++ compilers are now supported by the "Ninja" generator.<br class=""><br class=""><br class="">Generators<br class="">----------<br class=""><br class="">* The "CodeBlocks" extra generator learned to check a<br class="">  "CMAKE_CODEBLOCKS_COMPILER_ID" variable for a custom compiler<br class="">  identification value to place in the project file.<br class=""><br class="">* The Makefile Generators and the "Ninja" generator learned to add<br class="">  compiler launcher tools along with the compiler for the "Fortran"<br class="">  language ("C", "CXX", and "CUDA" were supported previously). See the<br class="">  "CMAKE_<LANG>_COMPILER_LAUNCHER" variable and<br class="">  "<LANG>_COMPILER_LAUNCHER" target property for details.<br class=""><br class="">* Visual Studio Generators learned to support the "COMPILE_LANGUAGE"<br class="">  "generator expression" in target-wide "COMPILE_DEFINITIONS",<br class="">  "INCLUDE_DIRECTORIES", "COMPILE_OPTIONS", and "file(GENERATE)".  See<br class="">  generator expression documentation for caveats.<br class=""><br class="">* The "Xcode" generator learned to support the "COMPILE_LANGUAGE"<br class="">  "generator expression" in target-wide "COMPILE_DEFINITIONS" and<br class="">  "INCLUDE_DIRECTORIES".  It previously supported only<br class="">  "COMPILE_OPTIONS" and "file(GENERATE)". See generator expression<br class="">  documentation for caveats.<br class=""><br class=""><br class="">Commands<br class="">--------<br class=""><br class="">* "add_library()" and "add_executable()" commands can now be called<br class="">  without any sources and will not complain as long as sources are<br class="">  added later via the "target_sources()" command.<br class=""><br class="">* The "file(DOWNLOAD)" and "file(UPLOAD)" commands gained "NETRC"<br class="">  and "NETRC_FILE" options to specify use of a ".netrc" file.<br class=""><br class="">* The "target_compile_definitions()" command learned to set the<br class="">  "INTERFACE_COMPILE_DEFINITIONS" property on Imported Targets.<br class=""><br class="">* The "target_compile_features()" command learned to set the<br class="">  "INTERFACE_COMPILE_FEATURES" property on Imported Targets.<br class=""><br class="">* The "target_compile_options()" command learned to set the<br class="">  "INTERFACE_COMPILE_OPTIONS" property on Imported Targets.<br class=""><br class="">* The "target_include_directories()" command learned to set the<br class="">  "INTERFACE_INCLUDE_DIRECTORIES" property on Imported Targets.<br class=""><br class="">* The "target_sources()" command learned to set the<br class="">  "INTERFACE_SOURCES" property on Imported Targets.<br class=""><br class="">* The "target_link_libraries()" command learned to set the<br class="">  "INTERFACE_LINK_LIBRARIES" property on Imported Targets.<br class=""><br class=""><br class="">Variables<br class="">---------<br class=""><br class="">* A "CMAKE_GENERATOR_INSTANCE" variable was introduced to hold the<br class="">  selected instance of the generator's corresponding native tools if<br class="">  multiple are available.  This is used by the "Visual Studio 15 2017"<br class="">  generator to hold the selected instance of Visual Studio<br class="">  persistently.<br class=""><br class="">* A "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS" variable was added<br class="">  to enable setting of default permissions for directories created<br class="">  implicitly during installation of files by "install()" and<br class="">  "file(INSTALL)", e.g. during "make install".<br class=""><br class="">* A "CMAKE_JOB_POOLS" variable was added specify a value to use for<br class="">  the "JOB_POOLS" property. This enables control over build<br class="">  parallelism with command line configuration parameters when using<br class="">  the Ninja generator.<br class=""><br class="">* The "CMAKE_NETRC" and "CMAKE_NETRC_FILE" variables were added to<br class="">  specify use of a ".netrc" file by the "file(DOWNLOAD)" and<br class="">  "file(UPLOAD)" commands and the "ExternalProject" module.<br class=""><br class="">* A "CMAKE_CUDA_SEPARABLE_COMPILATION" variable was added to<br class="">  initialize the "CUDA_SEPARABLE_COMPILATION" target property on<br class="">  targets when they are created.<br class=""><br class=""><br class="">Properties<br class="">----------<br class=""><br class="">* The "COMPILE_DEFINITIONS" source file property learned to support<br class="">  "generator expressions".<br class=""><br class="">* A "COMPILE_OPTIONS" source file property was added to manage list<br class="">  of options to pass to the compiler.<br class=""><br class="">* An "IMPORTED_GLOBAL" target property was added to indicate whether<br class="">  an IMPORTED target is globally visible. It is automatically set to a<br class="">  true value for targets created with the "GLOBAL" option to<br class="">  "add_library()" or "add_executable()". Additionally, project code<br class="">  may now *promote* a local imported target to be globally visible by<br class="">  setting this property to "TRUE".<br class=""><br class="">* An "INCLUDE_DIRECTORIES" source file property was added to specify<br class="">  list of preprocessor include file search directories.<br class=""><br class="">* Source file properties "VS_SHADER_DISABLE_OPTIMIZATIONS" and<br class="">  "VS_SHADER_ENABLE_DEBUG" have been added to specify more details of<br class="">  ".hlsl" sources with Visual Studio Generators.<br class=""><br class=""><br class="">Modules<br class="">-------<br class=""><br class="">* The "CheckIncludeFile" module "check_include_file" macro learned<br class="">  to honor the "CMAKE_REQUIRED_LIBRARIES" variable.<br class=""><br class="">* The "CheckIncludeFileCXX" module "check_include_file_cxx" macro<br class="">  learned to honor the "CMAKE_REQUIRED_LIBRARIES" variable.<br class=""><br class="">* The "CheckIncludeFiles" module "check_include_files" macro learned<br class="">  to honor the "CMAKE_REQUIRED_LIBRARIES" variable.<br class=""><br class="">* The "CheckIncludeFiles" module "CHECK_INCLUDE_FILES()" command<br class="">  gained a "LANGUAGE" option to specify whether to check using the "C"<br class="">  or "CXX" compiler.<br class=""><br class="">* The "CMakePackageConfigHelpers" module<br class="">  "write_basic_package_version_file()" command learned a new<br class="">  "SameMinorVersion" mode for the "COMPATIBILITY" argument.<br class=""><br class="">* The "ExternalProject" module learned to substitute<br class="">  "<DOWNLOAD_DIR>" in comments, commands, working directory and<br class="">  byproducts.<br class=""><br class="">* The "ExternalProject" module gained "NETRC" and "NETRC_FILE"<br class="">  options to specify use of a ".netrc" file.<br class=""><br class="">* A new "FetchContent" module was added which supports populating<br class="">  content at configure time using any of the download/update methods<br class="">  supported by "ExternalProject_Add()".  This allows the content to be<br class="">  used immediately during the configure stage, such as with<br class="">  "add_subdirectory()", etc.  Hierarchical project structures are well<br class="">  supported, allowing parent projects to override the content details<br class="">  of child projects and ensuring content is not populated multiple<br class="">  times throughout the whole project tree.<br class=""><br class="">* The "FindBLAS" and "FindLAPACK" modules learned to support FLAME<br class="">  "blis" and "libflame".<br class=""><br class="">* The "FindDoxygen" module "doxygen_add_docs()" function now<br class="">  supports a new "DOXYGEN_VERBATIM_VARS" list variable.  Any<br class="">  "DOXYGEN_..." variable contained in that list will bypass the<br class="">  automatic quoting logic, leaving its contents untouched when<br class="">  transferring them to the output "Doxyfile".<br class=""><br class="">* A "FindIconv" module was added to locate iconv support.<br class=""><br class="">* The "GenerateExportHeader" module "GENERATE_EXPORT_HEADER" command<br class="">  gained an "INCLUDE_GUARD_NAME" option to change the name of the<br class="">  include guard symbol written to the generated export header.<br class="">  Additionally, it now adds a comment after the closing "#endif" on<br class="">  the generated export header's include guard.<br class=""><br class="">* The "UseJava" module "add_jar" command gained a<br class="">  "GENERATE_NATIVE_HEADERS" option to generate native header files<br class="">  using "javac -h" for "javac" 1.8 or above.  This supersedes<br class="">  "create_javah", which no longer works with JDK 1.10 and above due to<br class="">  removal of the "javah" tool by JEP 313.<br class=""><br class=""><br class="">Autogen<br class="">-------<br class=""><br class="">* When using "AUTOMOC" or "AUTOUIC", CMake now starts multiple<br class="">  parallel "moc" or "uic" processes to reduce the build time. A new<br class="">  "CMAKE_AUTOGEN_PARALLEL" variable and "AUTOGEN_PARALLEL" target<br class="">  property may be set to specify the number of parallel "moc" or "uic"<br class="">  processes to start.  The default is derived from the number of CPUs<br class="">  on the host.<br class=""><br class=""><br class="">CTest<br class="">-----<br class=""><br class="">* The "ctest_start()" command no longer sets<br class="">  "CTEST_RUN_CURRENT_SCRIPT" due to issues with scoping if it is<br class="">  called from inside a function. Instead, it sets an internal variable<br class="">  in CTest. However, setting "CTEST_RUN_CURRENT_SCRIPT" to 0 at the<br class="">  global scope still prevents the script from being re-run at the end.<br class=""><br class=""><br class="">CPack<br class="">-----<br class=""><br class="">* "cpack(1)" gained "--trace" and "--trace-expand" options.<br class=""><br class="">* The "CPackIFW" module gained new<br class="">  "CPACK_IFW_PACKAGE_REMOVE_TARGET_DIR" variable to control if the<br class="">  target directory should not be deleted when uninstalling.<br class=""><br class="">* The "CPackRPM" module learned to enable enforcing of execute<br class="">  privileges on programs and shared libraries. See<br class="">  "CPACK_RPM_INSTALL_WITH_EXEC" variable.<br class=""><br class="">* A "CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS" variable was added<br class="">  which serves the same purpose during packaging (e.g. "make package")<br class="">  as the "CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS" variable serves<br class="">  during installation (e.g. "make install").<br class=""><br class=""><br class="">Other<br class="">-----<br class=""><br class="">* Alias Targets may now alias Imported Targets that are created with<br class="">  the "GLOBAL" option to "add_library()".<br class=""><br class="">* Interface Libraries may now have custom properties set on them if<br class="">  they start with either an underscore ("_") or a lowercase ASCII<br class="">  character. The original intention was to only allow properties which<br class="">  made sense for "INTERFACE" libraries, but it also blocked usage of<br class="">  custom properties.<br class=""><br class="">* The "cmake(1)" "--open <dir>" command-line option was added to<br class="">  open generated IDE projects like Visual Studio solutions or Xcode<br class="">  projects.<br class=""><br class=""><br class="">Deprecated and Removed Features<br class="">===============================<br class=""><br class="">* An explicit deprecation diagnostic was added for policies<br class="">  "CMP0037" through "CMP0054" ("CMP0036" and below were already<br class="">  deprecated). The "cmake-policies(7)" manual explains that the OLD<br class="">  behaviors of all policies are deprecated and that projects should<br class="">  port to the NEW behaviors.<br class=""><br class="">* The "KDevelop3" generator has been removed.<br class=""><br class=""><br class="">Other Changes<br class="">=============<br class=""><br class="">* Policy "CMP0037" no longer reserves target names associated with<br class="">  optional features, such as "test" and "package", unless the<br class="">  corresponding feature is enabled.<br class=""><br class="">* The "FindOpenGL" module now prefers GLVND libraries if available.<br class="">  See policy "CMP0072".<br class=""><br class="">* The minimum deployment target set in the<br class="">  "CMAKE_OSX_DEPLOYMENT_TARGET" variable used to be only applied for<br class="">  macOS regardless of the selected SDK.  It is now properly set for<br class="">  the target platform selected by "CMAKE_OSX_SYSROOT". For example, if<br class="">  the sysroot variable specifies an iOS SDK then the value in<br class="">  "CMAKE_OSX_DEPLOYMENT_TARGET" is interpreted as minimum iOS version.<br class=""><br class="">* The "Xcode" generator behavior of generating one project file per<br class="">  "project()" command may now be controlled with the<br class="">  "CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY" variable. This could<br class="">  be useful to speed up the CMake generation step for large projects<br class="">  and to work-around a bug in the "ZERO_CHECK" logic.<br class=""><br class="">* Since the "CMakeCache.txt" format does not support newlines in<br class="">  values, values containing newlines are now truncated before writing<br class="">  to the file. In addition, a warning comment is written to the cache<br class="">  file, and a warning message is displayed to the user on the console.<br class=""><br class="">----------------------------------------------------------------------------<br class="">Changes made since CMake 3.11.0-rc2:<br class=""><br class="">Brad King (3):<br class="">      XL: Recognize compilers identified by __ibmxl__<br class="">      CUDA: Do not pass unsupported @rspfile arguments to NVCC<br class="">      CMake 3.11.0-rc3<br class=""><br class="">KWSys Upstream (1):<br class="">      KWSys 2018-03-07 (2ad561e7)<br class=""><br class="">Sebastian Holtermann (1):<br class="">      Autogen: Check if a file is empty before reading it<br class="">-- <br class=""><br class="">Powered by <a href="http://www.kitware.com" class="">www.kitware.com</a><br class=""><br class="">Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" class="">http://www.cmake.org/Wiki/CMake_FAQ</a><br class=""><br class="">Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br class=""><br class="">CMake Support: <a href="http://cmake.org/cmake/help/support.html" class="">http://cmake.org/cmake/help/support.html</a><br class="">CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" class="">http://cmake.org/cmake/help/consulting.html</a><br class="">CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" class="">http://cmake.org/cmake/help/training.html</a><br class=""><br class="">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" class="">http://www.kitware.com/opensource/opensource.html</a><br class=""><br class="">Follow this link to subscribe/unsubscribe:<br class=""><a href="https://cmake.org/mailman/listinfo/cmake" class="">https://cmake.org/mailman/listinfo/cmake</a><br class=""></div></div></blockquote></div><br class=""></body></html>