48 lines
1.8 KiB
CMake
48 lines
1.8 KiB
CMake
if(NOT CMLIB_THEME_NAME)
|
|
set(CMLIB_THEME_NAME "default")
|
|
endif()
|
|
|
|
canonical_string(${CMLIB_ORGANIZATION_NAME} CMLIB_ORGANIZATION_NAME_CANONICAL)
|
|
canonical_string(${PROJECT_NAME} CMLIB_PROJECT_NAME_CANONICAL)
|
|
canonical_string(${CMLIB_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_ADD_THEME_PREFIX "Append theme name to install prefix" OFF)
|
|
if(CMLIB_ADD_THEME_PREFIX AND NOT CMLIB_THEME_PREFIX_APPENDED)
|
|
if(NOT CMLIB_THEME_NAME_LOWER STREQUAL "default")
|
|
set(CMLIB_THEME_PREFIX_APPENDED ON CACHE BOOL "" FORCE)
|
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CMLIB_THEME_NAME}" CACHE PATH "" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
# CMLIB_MODULE_DIR
|
|
foreach(module ${CMAKE_MODULE_PATH})
|
|
if(EXISTS ${module}/CMLibCommon.cmake)
|
|
get_filename_component(CMLIB_MODULE_DIR ${module}/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()
|
|
|
|
if(NOT DEFINED CMLIB_CMAKE_DIR)
|
|
get_filename_component(CMLIB_CMAKE_DIR ${CMLIB_MODULE_DIR} DIRECTORY)
|
|
if(IS_DIRECTORY "${CMLIB_CMAKE_DIR}/find")
|
|
list(APPEND CMAKE_MODULE_PATH "${CMLIB_CMAKE_DIR}/find")
|
|
endif()
|
|
endif()
|