[CMake] Workaround for CMP0026
NoRulez
norulez at me.com
Wed Feb 4 07:47:09 EST 2015
Hello,
currently I'm updating my CMake scripts to use newer features and/or to solve some old workarounds.
I have the following code:
get_target_property(${PROJECT_NAME}OutputDirectory ${PROJECT_NAME} LOCATION_RELEASE)
get_filename_component(${PROJECT_NAME}OutputDirectory ${${PROJECT_NAME}OutputDirectory} PATH)
install(DIRECTORY "${${PROJECT_NAME}OutputDirectory}/MyDir"
DESTINATION share/myproj)
In the description for porting such code is to use "file(GENERATE...)"
If I use this, how can I then read the value?
The following gives me the error that the file doesn't exist (in release build):
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/MyPath$<CONFIG>.txt CONTENT "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
file(READ ${CMAKE_CURRENT_BINARY_DIR}/MyPathRelease.txt MYCONTENT)
install(DIRECTORY ${MYCONTENT}/MyDir DESTINATION share/myproj)
Without the "file(read" and install, the files are created.
So, how can i use such information for the install stuff?
I already tried "set_source_file_properties(${CMAKE_CURRENT_BINARY_DIR}/MyPath$<CONFIG>.txt PROPERTIES GENERATED TRUE)" but that doesn't work either.
Thanks in advance
Best Regards
More information about the CMake
mailing list