diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ed4ce458..725de1145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,12 +319,6 @@ else() ) endif() -# ==== Install target ==== -install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .) -install(DIRECTORY ${STK_DATA_DIR} DESTINATION ${STK_INSTALL_DATA_DIR} PATTERN ".svn" EXCLUDE) -install(FILES ${PROJECT_BINARY_DIR}/supertuxkart.desktop DESTINATION share/applications) -install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps) -install(FILES data/supertuxkart.appdata DESTINATION share/appdata) # ==== Checking if data folder exists ==== if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data) @@ -333,14 +327,18 @@ endif() # ==== Checking if stk-assets folder exists ==== if(CHECK_ASSETS) - if((IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets) OR - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../supertuxkart-assets) OR - ((IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/karts) AND - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/library) AND - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/music) AND - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/sfx) AND - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/textures) AND - (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/tracks))) + if((IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/karts) AND + (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/library) AND + (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/music) AND + (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/sfx) AND + (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/textures) AND + (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/tracks)) + message(STATUS "Assets found in data directory") + elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets) + set(STK_ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets/) + message(STATUS "Assets found") + elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../supertuxkart-assets) + set(STK_ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../supertuxkart-assets/) message(STATUS "Assets found") else() set (CUR_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -350,6 +348,18 @@ if(CHECK_ASSETS) endif() endif() + +# ==== Install target ==== +install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .) +install(DIRECTORY ${STK_DATA_DIR} DESTINATION ${STK_INSTALL_DATA_DIR} PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE) +if(STK_ASSETS_DIR AND CHECK_ASSETS) + install(DIRECTORY ${STK_ASSETS_DIR} DESTINATION ${STK_INSTALL_DATA_DIR}/data PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE) +endif() +install(FILES ${PROJECT_BINARY_DIR}/supertuxkart.desktop DESTINATION share/applications) +install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps) +install(FILES data/supertuxkart.appdata DESTINATION share/appdata) + + set(PREFIX ${CMAKE_INSTALL_PREFIX}) configure_file(data/supertuxkart_desktop.template supertuxkart.desktop) add_dependencies(supertuxkart supertuxkart.desktop)