Andrey Astafyev
dbc0b76a76
При включении CMLIB_USE_DEVELOPMENT_INSTALL_PREFIX установка будет производиться в каталог _output внутри проекта.
42 lines
1.6 KiB
CMake
42 lines
1.6 KiB
CMake
if (NOT THEME_NAME)
|
|
set(THEME_NAME "default")
|
|
endif()
|
|
|
|
canonical_string(${ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
|
|
canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL)
|
|
canonical_string(${THEME_NAME} CMLIB_THEME_NAME_CANONICAL)
|
|
|
|
string(TOLOWER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_LOWER)
|
|
string(TOLOWER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_LOWER)
|
|
string(TOLOWER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_LOWER)
|
|
|
|
string(TOUPPER ${CMLIB_ORGANIZATION_NAME_CANONICAL} CMLIB_ORGANIZATION_NAME_UPPER)
|
|
string(TOUPPER ${CMLIB_PROJECT_NAME_CANONICAL} CMLIB_PROJECT_NAME_UPPER)
|
|
string(TOUPPER ${CMLIB_THEME_NAME_CANONICAL} CMLIB_THEME_NAME_UPPER)
|
|
|
|
option(CMLIB_USE_DEVELOPMENT_INSTALL_PREFIX "Auto-generated output prefix for development installation" OFF)
|
|
if (CMLIB_USE_DEVELOPMENT_INSTALL_PREFIX)
|
|
if (CMLIB_THEME_NAME_LOWER STREQUAL "default")
|
|
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/_output" CACHE PATH "" FORCE)
|
|
else()
|
|
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/_output/${CMLIB_THEME_NAME_LOWER}" CACHE PATH "" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
# CMLIB_MODULE_DIR
|
|
foreach(_m ${CMAKE_MODULE_PATH})
|
|
if(EXISTS ${_m}/CMLibCommon.cmake)
|
|
get_filename_component(CMLIB_MODULE_DIR ${_m}/CMLibCommon.cmake DIRECTORY)
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
if(IS_DIRECTORY "${CMLIB_MODULE_DIR}")
|
|
if(NOT DEFINED CMLIB_THIRDPARTY_DIR)
|
|
set(CMLIB_THIRDPARTY_DIR "${CMLIB_MODULE_DIR}/thirdparty")
|
|
list(APPEND CMAKE_MODULE_PATH ${CMLIB_THIRDPARTY_DIR})
|
|
endif()
|
|
else()
|
|
message(FATAL_ERROR "CMLib directory not found.")
|
|
endif()
|