aboutsummaryrefslogtreecommitdiff
path: root/test/CMakeLists.txt
blob: 60ebec3fd63224fca9209808aaf6c2d522333764 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# nanowasm, a tiny WebAssembly/Wasm interpreter
# Copyright (C) 2023-2024  Xavier Del Campo Romero
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

cmake_minimum_required(VERSION 3.18)
project(test C)
add_executable(${PROJECT_NAME} main.c)
target_link_libraries(${PROJECT_NAME} PRIVATE nanowasm)

include(CheckLinkerFlag)
set(ldflags -Wl,--gc-sections)

foreach(f ${ldflags})
    string(REPLACE "-" "_" var supported_${f})
    string(REPLACE "," "_" var ${var})
    check_linker_flag(C ${f} ${var})

    if(${var})
        target_link_options(${PROJECT_NAME} PRIVATE ${f})
    endif()
endforeach()