Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

c++ - 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.

question from:https://stackoverflow.com/questions/65905689/building-a-library-while-maintaining-file-structure-with-cmake-and-conan

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...