Skip to content

Commit

Permalink
CMake: Use file(GENERATE) to write the 'data' file
Browse files Browse the repository at this point in the history
… when available.

Fixes warning:
Policy CMP0026 is not set: Disallow use of the LOCATION target property.

See: bug #694
  • Loading branch information
dscharrer committed Dec 10, 2014
1 parent 5de94e4 commit 97a2bb1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions CMakeLists.txt
Expand Up @@ -1480,12 +1480,17 @@ install(DIRECTORY data/core/ DESTINATION "${INSTALL_DATADIR}")
# Also tell arx where to find the not yet installed data
# This is required to run arx from the build directory without installing
set(arx_core_dir "${CMAKE_SOURCE_DIR}/data/core")
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
get_property(arx_location TARGET arx PROPERTY LOCATION_${config})
get_filename_component(arx_location "${arx_location}" PATH)
file(RELATIVE_PATH arx_core_dir_rel "${arx_location}" "${arx_core_dir}")
file(WRITE "${arx_location}/data" "${arx_core_dir_rel}\n")
endforeach()
get_filename_component(arx_core_dir "${arx_core_dir}" ABSOLUTE)
file(TO_NATIVE_PATH "${arx_core_dir}" arx_core_dir)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES CMAKE_BUILD_TYPE)
get_property(arx_location TARGET arx PROPERTY LOCATION_${config})
get_filename_component(arx_location "${arx_location}" PATH)
file(WRITE "${arx_location}/data" "${arx_core_dir}\n")
endforeach()
else()
file(GENERATE OUTPUT "$<TARGET_FILE_DIR:arx>/data" CONTENT "${arx_core_dir}\n")
endif()

# Install the data install script
if(INSTALL_SCRIPTS AND NOT WIN32)
Expand Down

0 comments on commit 97a2bb1

Please sign in to comment.