MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0014099 | CMake | CMake | public | 2013-04-19 07:05 | 2014-10-06 10:33 |
Reporter | Andrey Kamaev | ||||
Assigned To | Peter Kuemmel | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | OS Version | ||
Product Version | CMake 2.8.10.2 | ||||
Target Version | Fixed in Version | CMake 3.0 | |||
Summary | 0014099: Ninja: CMAKE_${LANG}_FLAGS passed to linker come from incorrect scope | ||||
Description | Library/module linker is always called with same compiler flags. CMake embeds CMAKE_${LANG}_FLAGS from the scope of the first library met by generator into the generic link rule and uses it for all targets of the same type. But CMAKE_${LANG}_FLAGS variables are directory scoped and should be different. Looking into the CMake code I found that any platform having <LANGUAGE_COMPILE_FLAGS> in link command is affected. | ||||
Steps To Reproduce | The minimal reproducer is attached. In short: CMakeLists.txt from the topmost directory: cmake_minimum_required(VERSION 2.8.8) project(level0) set(CMAKE_CXX_FLAGS -msse2 ) # flag itself does not matter add_library(lelve0 SHARED level0.cpp) add_subdirectory(l1) CMakeLists.txt from sub-directory: project(level1) set(CMAKE_CXX_FLAGS -mno-sse2 ) add_library(lelve1 SHARED level1.cpp) Resulting link commands from Ninja: /usr/bin/c++ -fPIC -msse2 -shared -Wl,-soname,liblelve0.so -o liblelve0.so CMakeFiles/lelve0.dir/level0.cpp.o /usr/bin/c++ -fPIC -msse2 -shared -Wl,-soname,liblelve1.so -o l1/liblelve1.so l1/CMakeFiles/lelve1.dir/level1.cpp.o Link commands used by make: /usr/bin/c++ -fPIC -msse2 -shared -Wl,-soname,liblelve0.so -o liblelve0.so CMakeFiles/lelve0.dir/level0.cpp.o /usr/bin/c++ -fPIC -mno-sse2 -shared -Wl,-soname,liblelve1.so -o liblelve1.so CMakeFiles/lelve1.dir/level1.cpp.o | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | repro.tar.bz2 (469) 2013-04-19 07:05 https://public.kitware.com/Bug/file/4747/repro.tar.bz2 | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2013-04-19 07:05 | Andrey Kamaev | New Issue | |||
2013-04-19 07:05 | Andrey Kamaev | File Added: repro.tar.bz2 | |||
2014-04-13 05:00 | Peter Kuemmel | Severity | minor => major | ||
2014-04-13 08:49 | Peter Kuemmel | Assigned To | => Peter Kuemmel | ||
2014-04-13 08:49 | Peter Kuemmel | Status | new => assigned | ||
2014-04-13 08:50 | Peter Kuemmel | Note Added: 0035684 | |||
2014-04-13 08:50 | Peter Kuemmel | Status | assigned => resolved | ||
2014-04-13 08:50 | Peter Kuemmel | Fixed in Version | => CMake 3.0 | ||
2014-04-13 08:50 | Peter Kuemmel | Resolution | open => fixed | ||
2014-10-06 10:33 | Robert Maynard | Note Added: 0036969 | |||
2014-10-06 10:33 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|