sciqlop_params.cmake
128 lines
| 4.1 KiB
| text/x-cmake
|
CMakeLexer
/ cmake / sciqlop_params.cmake
r0 | # | |||
# sciqlop_params : Define compilation parameters | ||||
# | ||||
# Debug or release | ||||
# | ||||
# As the "NMake Makefiles" forces by default the CMAKE_BUILD_TYPE variable to Debug, SCIQLOP_BUILD_TYPE variable is used to be sure that the debug mode is a user choice | ||||
r21 | #SET(SCIQLOP_BUILD_TYPE "Release" CACHE STRING "Choose to compile in Debug or Release mode") | |||
r0 | ||||
r26 | IF(CMAKE_BUILD_TYPE MATCHES "Debug") | |||
SET (DEBUG_SUFFIX "d") | ||||
ELSE() | ||||
MESSAGE (STATUS "Build in Release") | ||||
SET (DEBUG_SUFFIX "") | ||||
ENDIF() | ||||
r0 | # | |||
# Need to compile tests? | ||||
# | ||||
OPTION (BUILD_TESTS "Build the tests" OFF) | ||||
ENABLE_TESTING(${BUILD_TESTS}) | ||||
# | ||||
# Path to the folder for sciqlop's extern libraries. | ||||
# | ||||
# When looking for an external library in sciqlop, we look to the following | ||||
# folders: | ||||
# - The specific folder for the library (generally of the form <LIBRARY>_ROOT_DIR | ||||
# - The global Sciqlop extern folder | ||||
# - The system folders. | ||||
# | ||||
# If a dependency is found in the global extern folder or a specific folder for | ||||
# the library, then it is installed with the sciqlop libraries. If it is found | ||||
# in the system folders, it is not. This behavior can be overriden with the | ||||
# <LIBRARY>_COPY_SHARED_LIBRARIES flag. | ||||
# | ||||
set(SCIQLOP_EXTERN_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/extern" | ||||
CACHE PATH "Path to the folder for sciqlop's extern libraries") | ||||
option(SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR "Force the <LIBRARY>_ROOT_DIR to be updated to the global sciqlop extern folder" | ||||
OFF) | ||||
if (SCIQLOP_FORCE_UPDATE_EXT_ROOT_DIR) | ||||
set(libRootDirForceValue FORCE) | ||||
else() | ||||
set(libRootDirForceValue) | ||||
endif() | ||||
r239 | # | |||
# Sciqlop_modules.cmake | ||||
# | ||||
# Set ouptut directories | ||||
# | ||||
IF (UNIX) | ||||
# 32 or 64 bits compiler | ||||
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | ||||
SET(defaultLib "lib64/sciqlop") | ||||
ELSE() | ||||
SET(defaultLib "lib/sciqlop") | ||||
ENDIF() | ||||
SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin) | ||||
SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) | ||||
SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${defaultLib}) | ||||
ELSEIF(WIN32) | ||||
SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) | ||||
SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) | ||||
SET (CONFIG_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist/app/QtProject) | ||||
ELSE() | ||||
SET (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) | ||||
SET (CONFIG_OUTPUT_PATH $ENV{HOME}/.config/QtProject) | ||||
SET (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dist) | ||||
ENDIF() | ||||
r0 | ||||
# | ||||
# Static or shared libraries | ||||
# | ||||
OPTION (BUILD_SHARED_LIBS "Build the shared libraries" ON) | ||||
# Generate position independant code (-fPIC) | ||||
SET(CMAKE_POSITION_INDEPENDENT_CODE TRUE) | ||||
r239 | ||||
# Configuration for make install | ||||
set(PROJECT_PLUGIN_PREFIX "SciQlop") | ||||
r0 | IF (UNIX) | |||
r239 | SET(CMAKE_INSTALL_PREFIX "/usr/local/${PROJECT_PLUGIN_PREFIX}") | |||
r0 | SET(defaultBin "bin") | |||
SET(defaultInc "include/sciqlop") | ||||
# 32 or 64 bits compiler | ||||
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) | ||||
r239 | SET(defaultLib "lib64") | |||
SET(defaultPluginsLib "lib64/${PROJECT_PLUGIN_PREFIX}") | ||||
r0 | ELSE() | |||
r239 | SET(defaultLib "lib/") | |||
SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}") | ||||
r0 | ENDIF() | |||
r239 | SET(defaultDoc "share/docs/${PROJECT_PLUGIN_PREFIX}") | |||
r0 | ELSE() | |||
SET(defaultBin "bin") | ||||
r239 | SET(defaultInc "include/${PROJECT_PLUGIN_PREFIX}") | |||
SET(defaultLib "lib") | ||||
SET(defaultPluginsLib "lib/${PROJECT_PLUGIN_PREFIX}") | ||||
SET(defaultDoc "docs/${PROJECT_PLUGIN_PREFIX}") | ||||
r0 | ENDIF() | |||
SET(INSTALL_BINARY_DIR "${defaultBin}" CACHE STRING | ||||
"Installation directory for binaries") | ||||
SET(INSTALL_LIBRARY_DIR "${defaultLib}" CACHE STRING | ||||
"Installation directory for libraries") | ||||
r239 | SET(INSTALL_PLUGINS_LIBRARY_DIR "${defaultPluginsLib}" CACHE STRING | |||
"Installation directory for libraries") | ||||
r0 | SET(INSTALL_INCLUDE_DIR "${defaultInc}" CACHE STRING | |||
"Installation directory for headers") | ||||
SET(INSTALL_DOCUMENTATION_DIR "${defaultDoc}" CACHE STRING | ||||
"Installation directory for documentations") | ||||
r239 | ||||
# Set the rpath when installing | ||||
SET(CMAKE_SKIP_BUILD_RPATH FALSE) | ||||
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) | ||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}") | ||||
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||||
message("Install RPATH: ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}") | ||||