Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Additional C flags required for static-std.cmake to fix behaviour change in CMake #204

Closed
oliverdaniell opened this issue Nov 23, 2017 · 1 comment

Comments

@oliverdaniell
Copy link
Contributor

CMake behavior has changed from version 3.7 to 3.9 with respect to the handling of static libgcc flags.

Building the example below with a toolchain that include /flags/static-std.cmake will cause cmake to add an additional -lgcc_s -lgcc_s to the link line.

cmake_minimum_required(VERSION 3.0)

# Project
project(static_test C CXX)

add_library(mylib::mylib STATIC IMPORTED)

set_target_properties(mylib::mylib PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  IMPORTED_LOCATION "/path/to/mylib.a"
  )

add_executable(static_test main.cpp)
target_link_libraries(static_test mylib::mylib)

The fix is to add the following line to /flags/static-std.cmake

polly_add_cache_flag(CMAKE_C_FLAGS "-static-libgcc")
@oliverdaniell oliverdaniell changed the title Additional C flags required for static-sdk.cmake to fix behaviour change in CMake Additional C flags required for static-std.cmake to fix behaviour change in CMake Nov 23, 2017
@ruslo
Copy link
Owner

ruslo commented Nov 23, 2017

polly_add_cache_flag(CMAKE_C_FLAGS "-static-libgcc")

d5e9165

@ruslo ruslo closed this as completed Nov 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants