Levi Morrison
2018-07-19 04:34:57 UTC
I have an issue in CMake 3.12 with using transitive OBJECT
libraries.The basic skeleton is:
cmake_minimum_required(VERSION 3.12)
project(objectlib LANGUAGES CXX)
add_library(box OBJECT box.cc box.hh)
add_library(make_box OBJECT make_box.cc make_box.hh)
target_link_libraries(make_box PUBLIC box)
add_executable(main main.cc)
target_link_libraries(main PUBLIC make_box)
Note that `main` depends on `make_box`, not `box`, which should be
transitive (correct?). The full files can be seen in this gist:
https://gist.github.com/morrisonlevi/b1508531b1464921664ca06c0fd889bb
The issue is that when building`main` it does not include `box.o` in
the link line.
Given how new this feature is, I'm not sure if it's an issue with my
expectations or with CMake. The issue happens in debug builds and goes
away in release mode, presumably because the compiler inlines it.
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers
libraries.The basic skeleton is:
cmake_minimum_required(VERSION 3.12)
project(objectlib LANGUAGES CXX)
add_library(box OBJECT box.cc box.hh)
add_library(make_box OBJECT make_box.cc make_box.hh)
target_link_libraries(make_box PUBLIC box)
add_executable(main main.cc)
target_link_libraries(main PUBLIC make_box)
Note that `main` depends on `make_box`, not `box`, which should be
transitive (correct?). The full files can be seen in this gist:
https://gist.github.com/morrisonlevi/b1508531b1464921664ca06c0fd889bb
The issue is that when building`main` it does not include `box.o` in
the link line.
Given how new this feature is, I'm not sure if it's an issue with my
expectations or with CMake. The issue happens in debug builds and goes
away in release mode, presumably because the compiler inlines it.
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers