Listing include_directories in CMake

前端 未结 3 1339
长发绾君心
长发绾君心 2020-11-29 01:37

I have a cmake build in which I\'m searching for a bunch of dependencies, i.e. I have many instances of:

FIND_PACKAGE(SomePackage)
if(SOMEPACKAGE_FOUND)
  in         


        
3条回答
  •  日久生厌
    2020-11-29 02:23

    Our solution to write include directories added by conan to a file

    function(output_conan_include_dirs)
        set(include_dir_str "")
        foreach(DIR ${CONAN_INCLUDE_DIRS})
            set(include_dir_str "${include_dir_str}${DIR}\n")
        endforeach()
    
        set(pth "${CMAKE_BINARY_DIR}/conan-includes.txt")
        file(WRITE "${pth}" "${include_dir_str}")
        message(STATUS "Conan include directories written to: ${pth}")
    endfunction()
    
    output_conan_include_dirs()
    

提交回复
热议问题