Reputation: 17134
I have a working C project and just added some CPP stuff.
For includes I use include_directories("./src/")
but the resulting commandline that is called from the generated makefile only contains "./src/"
instead of the expected -I"./src/"
Whats going wrong with cmake here? Do I miss any difference between the C and the CPP compiler? Whe I add the -I to the commandline it just compiles as expected.
Upvotes: 1
Views: 75
Reputation: 15020
For me it was skipping -I/usr/local/cuda/include
for .cpp
files compiled with clang++-18
, even though I tried include_directories( ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} )
and target_include_directories
with the same. So I had to just addd a line to CMAkeLists.txt
like this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/cuda/include ")
Upvotes: 0
Reputation: 17134
For everyone who finds the same Symptoms, it has nothing to do with it just missed the CXX
in my project:
Changed
project(my-project C ASM)
to
project(my-project C CXX ASM)
Now it works... I hope it will save someone else the few hours I spend on this.
Upvotes: 2