DefaultLibrary.cmake 971 Bytes
Newer Older
Bastian Krayer's avatar
Bastian Krayer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cmake_minimum_required(VERSION 3.16)

get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId})

# Enables the CMake policy to use environment variables {LIBNAME}_ROOT to search for libraries
EnableCmakeLibEnvironmentRoot()

# Creates a library from all source and header files in the current directory
# This will also find all dependencies specified in the depdencies.txt and
# link them publicly
# If it is a header only library, an interface library is created so that cmake
# can process it correctly. In that case IS_INTERFACE is set to true. Further
# linking can use that information accordingly
CreateLibrary(${ProjectId} IS_INTERFACE)

# Add default dependencies. Visibility is set whether we are dealing with a
# normal or a header only library
IF (${IS_INTERFACE})
    AddDefaultDependencies(${ProjectId} INTERFACE)
ELSE ()
    AddDefaultDependencies(${ProjectId} PRIVATE)
ENDIF ()