22 lines
753 B
CMake
22 lines
753 B
CMake
# read file cmake/etc/organization.txt and set global property ORGANIZATION_NAME
|
|
|
|
function(set_organization_name)
|
|
set(_organization_file "${CMAKE_SOURCE_DIR}/cmake/etc/organization.txt")
|
|
if(NOT EXISTS "${_organization_file}")
|
|
message(FATAL_ERROR "File ${ORGANIZATION_FILE} doesn't exist")
|
|
endif()
|
|
file(READ "${_organization_file}" _org)
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_organization_file})
|
|
|
|
if(NOT "${_org}" MATCHES "^([0-9A-Za-z ,.]+)\n")
|
|
message(FATAL_ERROR "File ${_organization_file} has wrong format")
|
|
endif()
|
|
|
|
string(REGEX MATCH
|
|
"^([0-9A-Za-z ,.]+)\n"
|
|
_
|
|
${_org})
|
|
|
|
set_property(GLOBAL PROPERTY ORGANIZATION_NAME ${CMAKE_MATCH_1})
|
|
endfunction()
|