projectheader.cmake 1.16 KB
# @brief Defines the project name, version and binary dir.
# @param CURRENT_PROJECT_NAME The name of the project to define.
# @param CURRENT_PROJECT_BINARY_DIR [optional] Override for the default project binary dir (PROJECT_BINARY_DIR for executables, CMAKE_BINARY_DIR for libraries).
macro ( project_header CURRENT_PROJECT_NAME )

message( STATUS "" )
message( STATUS "================================================================" )
message( STATUS "Creating Makefile of ${CURRENT_PROJECT_NAME}" )
message( STATUS "================================================================" )
message( STATUS "CURRENT_PROJECT_VERSION: ${CURRENT_PROJECT_VERSION}" )

project(${CURRENT_PROJECT_NAME} VERSION ${CURRENT_PROJECT_VERSION})
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES 1)

set ( optional_macro_args ${ARGN} )
list ( LENGTH optional_macro_args num_optional_args )
if ( ${num_optional_args} GREATER 0 )
    # Set project binary dir override to the specified value
    list ( GET optional_macro_args 0 CURRENT_PROJECT_BINARY_DIR )
    set ( ${PROJECT_NAME}_CURRENT_BINARY_DIR ${CURRENT_PROJECT_BINARY_DIR} CACHE STRING "${PROJECT_NAME} binary dir" FORCE )
endif()

endmacro()