Including directories in Clion

前端 未结 2 1464
迷失自我
迷失自我 2020-12-17 02:05

Whenever I wanted to include a directory that was located outside of my project with Clion I would use the -I somedir flag. This time however, what I want to do

2条回答
  •  一整个雨季
    2020-12-17 02:21

    Command INCLUDE_DIRECTORIES doesn't add any source file for compile!

    Instead, this command defines directories for search header files.

    You need to list all source files in add_executable() call in any case:

    include_directories(src)
    set(SOURCE_FILES
        src/Dijkstra/Dijkstra.cpp
        src/Graph/Graph.cpp)
    add_executable(someprojectname ${SOURCE_FILES})
    

提交回复
热议问题