nanowasm/test/CMakeLists.txt

25 lines
752 B
CMake

# 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()