diff options
author | Marvin W <git@larma.de> | 2017-03-30 15:29:21 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-30 16:39:26 +0200 |
commit | e910b39751a90f977110190b12cdb738f6a1d132 (patch) | |
tree | e8888a442e782a21e5cf1a0b24f3dbb7d13a08d9 /CMakeLists.txt | |
parent | e872356b1734624840b5d25513805ca2f10f921c (diff) | |
download | dino-e910b39751a90f977110190b12cdb738f6a1d132.tar.gz dino-e910b39751a90f977110190b12cdb738f6a1d132.zip |
Make configure/make compatible with autotools
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 173bed35..4e367591 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,19 +17,28 @@ foreach(plugin ${PLUGINS}) endforeach(plugin) # Prepare instal paths -message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") +macro(set_path what val desc) + if(NOT ${what}) + unset(${what} CACHE) + set(${what} ${val}) + endif() + message(STATUS "${desc}: ${${what}}") +endmacro(set_path) string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}") -set(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share") - -set(APPLICATION_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications") -set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin") -set(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino") -set(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons") -set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include") -set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR_NAME}") -set(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins") -set(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi") +message(STATUS "Installation directory for architecture-independent files: ${CMAKE_INSTALL_PREFIX}") +set_path(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Installation directory for architecture-dependent files") +set_path(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Installation directory for read-only architecture-independent data") + +set_path(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "Installation directory for user executables") +set_path(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino" "Installation directory for dino-specific data") +set_path(DESKTOP_FILE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "Installation directory for .desktop files") +set_path(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "Installation directory for icons") +set_path(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include" "Installation directory for C header files") +set_path(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${LIBDIR_NAME}" "Installation directory for object code libraries") +set_path(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins" "Installation directory for dino plugin object code files") +set_path(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi" "Installation directory for Vala API files") + set(TARGET_INSTALL LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) set(PLUGIN_INSTALL LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} RUNTIME DESTINATION ${PLUGIN_INSTALL_DIR}) @@ -57,6 +66,20 @@ AddValaCFlagIfSupported(-Wno-deprecated-declarations) AddValaCFlagIfSupported(-Wno-incompatible-pointer-types) AddValaCFlagIfSupported(-Wno-int-conversion) AddValaCFlagIfSupported(-Wno-discarded-qualifiers) +AddValaCFlagIfSupported(-Wno-unused-but-set-variable) +AddValaCFlagIfSupported(-Wno-unused-variable) +AddValaCFlagIfSupported(-Wno-unused-function) +AddValaCFlagIfSupported(-Wno-unused-label) + +if($ENV{USE_CCACHE}) + # Configure CCache if available + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + message(STATUS "Using ccache") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif(CCACHE_FOUND) +endif($ENV{USE_CCACHE}) if(NOT NO_DEBUG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") @@ -66,6 +89,10 @@ endif(NOT NO_DEBUG) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +if(NOT VALA_EXECUTABLE) + unset(VALA_EXECUTABLE CACHE) +endif() + find_package(Vala 0.30 REQUIRED) if(VALA_VERSION VERSION_GREATER "0.34.90" AND VALA_VERSION VERSION_LESS "0.36.1") # Due to a bug on 0.36.0 (and pre-releases), we need to disable FAST_VAPI |