cotire icon indicating copy to clipboard operation
cotire copied to clipboard

Public target properties of library dependencies are not respected by cotire

Open craffael opened this issue 8 years ago • 1 comments

CMake allows you to specify "interface target properties" which are then "inherited" by all dependent targets; this is unfortunately not respected by cotire 1.7.8.

I've constructed a small testcase that demonstrates the problem:

The CMakeLists.txt defines two targets and in the first one (foo) we set the variable INTERFACE_COMPILE_FEATURES by calling target_compile_features. The second target (bla) then depends on foo and should thus inherit the INTERFACE_COMPILE_FEATURES property (which I think should set the COMPILE_FEATURES property):

#CMakeLists.txt
cmake_minimum_required(VERSION 3.1)

include(${CMAKE_SOURCE_DIR}/cotire.cmake)
add_library(foo foo.cpp)
target_compile_features(foo PUBLIC cxx_lambdas)

add_executable(bla main.cpp)
target_link_libraries(bla PUBLIC foo)
set(COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES 0)
cotire(bla)

The files foo.cpp and main.cpp are very simple and #include <chrono> which requires C++11. Now if we turn off cotire (by commenting out the last line in CMakeLists.txt) everything compiles fine. But if cotire is enabled, the precompiled header is not built successfully because -std=c++11 is not passed to the compiler.

// main.cpp
#include <chrono>
int main() {}


// foo.cpp
#include <chrono>

craffael avatar Jul 31 '16 12:07 craffael

I'm experiencing this problem, except in my case its an inherited include path which isn't propagating when cotire is enabled.

JasonDictos avatar Aug 03 '18 05:08 JasonDictos