Projekt

Allgemein

Profil

Feature #470 » CMakeLists.txt

Maximilian Seesslen, 17.01.2024 14:01

 
1
cmake_minimum_required(VERSION 3.16)
2

    
3
function( dualBoot BL_TYPE )
4
    if( BL_TYPE MATCHES "bootloader" )
5
        target_link_options( ${PROJECT_NAME} PUBLIC "-Wl,--defsym,BL=1" )
6
    elseif( BL_TYPE MATCHES "application" )
7
        target_link_options( ${PROJECT_NAME} PUBLIC "-Wl,--defsym,APP=1" )
8
    else()
9
        message( FATAL_ERROR "### Unknown bootloader type: ${BL_TYPE}" )
10
    endif()
11
endfunction()
12

    
13

    
14
project( foo1 )
15

    
16
add_executable(
17
    ${PROJECT_NAME}
18
    main.cpp
19
)
20

    
21
dualBoot ( application )
22

    
23

    
24
#------------------------------------------------------------------------------
25

    
26
project( foo2 )
27

    
28
add_executable(
29
    ${PROJECT_NAME}
30
    main.cpp
31
)
32

    
33
dualBoot ( bootloader )
34

    
35

    
36
#------------------------------------------------------------------------------
    (1-1/1)