[CMake] Resolving CMP0026 warnings

Stephen Kelly steveire at gmail.com
Thu Feb 5 15:36:04 EST 2015


Knox, Kent wrote:

> The problem is that get_prerequisites( ) needs a path to the target.  How
> do I now get this path without calling the LOCATION property?  I don't
> know where I can use a generator expression.

Replace your configure_file with something like

 file(GENERATE OUTPUT 
"${CMAKE_CURRENT_BINARY_DIR}/copyLibraryDependencies$<CONFIG>.cmake"
   CONTENT "if(CMAKE_INSTALL_CONFIG_NAME STREQUAL $<CONFIG>)
     set(libraryLocation $<TARGET_FILE:myHumbleLibrary>)
   endif()
"
 )

There's no need to 'fix' the library then. Of course, if there are multiple 
targets, you might want to generate a loop instead of one such file per 
target etc. I'll leave it to you to parametrize whatever you want :).

Thanks,

Steve.




More information about the CMake mailing list