diff --git a/CMakeLists.txt b/CMakeLists.txt index 454f4fa6ba..61d1ecac50 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 "$/data" CONTENT "${arx_core_dir}\n") +endif() # Install the data install script if(INSTALL_SCRIPTS AND NOT WIN32)