首页 > 解决方案 > Building a library while maintaining file structure with cmake and conan

问题描述

I'm building a library containing multiple .h files and 1 .cpp file, in a structure such as this

/include/A/B/f.h
/include/A/B/C/d.h
/include/G/h.h
/src/K/l.h
/src/K/l.cpp

I want to keep the relative path between each of the files after building locally, but they're all placed in a single folder /output/include without retaining any folder structure whatsoever :

/build/output/include/f.h
/build/output/include/d.h
/build/output/include/h.h
/build/output/include/l.h

This is what my install looks like :

install(TARGETS ${CMAKE_PROJECT_NAME}
       RUNTIME DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/output/bin"
       LIBRARY DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/output/lib"
       PUBLIC_HEADER DESTINATION "${CMAKE_CURENT_BINARY_DIR}/output/include"
       }

I don't know exactly where to look as there is also the conanbuildinfo.cmake and cmake_install.cmake files generated by the cmake script I'm using (not done by me). If you need any more info please tell me because I'm pretty much new to cmake and conan and don't know which information is essential.

标签: c++cmakeconan

解决方案


推荐阅读