On Sunday 17 February 2013, Brad King wrote:
> On 2/16/2013 12:32 PM, Alexander Neundorf wrote:
> > There's another try now in ConfigFileTargetChecks5.
> > The export-file now warns if a target does not exist, but does not error
> > out.
> 
> I think in light of the discussion in the other thread,
> "Setting target properties before the target is defined",
> there is a valid use case for the dependencies to not
> exist when the target will not be used anyway.  We do
> not know the final intention until generation time.

The ConfigFileTargetChecks5 now uses a directory property.
It still emits the warning if a referenced target does not exist yet in the 
targets-file, I think this is a good thing, packages should be 
find_package()'ed by their order of dependencies.

Updated generated file is attached.

Alex
# Generated by CMake 2.8.10.20130216-gf66ac

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
   message(FATAL_ERROR "CMake >= 2.6.0 required")
endif()
cmake_policy(PUSH)
cmake_policy(VERSION 2.6)
#----------------------------------------------------------------
# Generated CMake target import file.
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget KF5::kcoreaddons)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)


# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)

# Create imported target KF5::kcoreaddons
add_library(KF5::kcoreaddons SHARED IMPORTED)

# Load information for each installed configuration.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
file(GLOB CONFIG_FILES "${_DIR}/kcoreaddonsTargets-*.cmake")
foreach(f ${CONFIG_FILES})
  include(${f})
endforeach()

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
  foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
    if(NOT EXISTS "${file}" )
      message(FATAL_ERROR "The imported target \"${target}\" references the file
   \"${file}\"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   \"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
    endif()
  endforeach()
  unset(_IMPORT_CHECK_FILES_FOR_${target})
endforeach()
unset(_IMPORT_CHECK_TARGETS)

# Targets in this file do not link against other targets from the
# same project which are exported in a separate export set.

# Make sure the targets imported from some other project exist.
unset(_CMAKE_IMPORT_FILE_TMP)
get_directory_property(_CMAKE_IMPORT_FILE_TMP CMAKE_CONFIG_REFERENCED_IMPORTED_TARGETS)
set_directory_properties(PROPERTIES CMAKE_CONFIG_REFERENCED_IMPORTED_TARGETS "${_CMAKE_IMPORT_FILE_TMP};Qt5::Concurrent;Qt5::Core;kdeqt5staging;")
unset(_CMAKE_IMPORT_FILE_TMP)


# Print a warning for each target which is used but does not exist yet.
unset(_cmake_missing_targets)
foreach(_target Qt5::Concurrent;Qt5::Core;kdeqt5staging;)
  if(NOT TARGET ${_target})
    list(APPEND _cmake_missing_targets ${_target})
  endif()
endforeach()
if(_cmake_missing_targets)
  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
    set(_cmake_msg_type STATUS)
  else()
    set(_cmake_msg_type AUTHOR_WARNING)
  endif()
  message(${_cmake_msg_type} "The following IMPORTED targets are required, but do not exist yet: ${_cmake_missing_targets}
This will cause errors in target_link_libraries() if these IMPORTED targets still do not exist then. Import the targets according to their dependencies to remove this warning.")
  unset(_cmake_missing_targets)
endif()

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to