diff --git i/CMakeLists.txt w/CMakeLists.txt index e87b3c7..c6239f0 100644 --- i/CMakeLists.txt +++ w/CMakeLists.txt @@ -118,4 +118,27 @@ install( DIRECTORY "${PROJECT_SOURCE_DIR}/include" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/.." PATTERN "build2file" EXCLUDE -) +) + +# +# Removes the INTERFACE_SOURCES flux::flux property in the flux-targets.cmake +# file that is there only because of the poor interaction of the +# $ with the install(TARGETS...) command. The generator +# creates an empty string instead of no string and the install(TARGETS...) +# takes that empty string as a indication that the code should put the source +# path in as a source file list (why?). +# +# The code here gets inserted into near the end of the cmake_install.cmake +# file. It reads the flux-targets.cmake file into memory, clears the file, +# then recreates the file skipping the line that contains the malformed +# INTERFACE_SOURCES property value. +# +set(FLUX_TARGETS_FILE "${CMAKE_INSTALL_PREFIX}/lib/cmake/flux/flux-targets.cmake") +install(CODE + "file (STRINGS \"${FLUX_TARGETS_FILE}\" FLUX_TARGETS_FILE_LINES) + file(WRITE \"${FLUX_TARGETS_FILE}\" \"\") + foreach(FLUX_TARGETS_FILE_LINE IN LISTS FLUX_TARGETS_FILE_LINES) + if (NOT FLUX_TARGETS_FILE_LINE MATCHES \"^[ \t]*INTERFACE_SOURCES[ \t].*$\") + file(APPEND \"${FLUX_TARGETS_FILE}\" \"\${FLUX_TARGETS_FILE_LINE}\\n\") + endif() + endforeach()")