简体   繁体   中英

correspondence between muti cmakelists.txt file and vs project structure that created by cmake vs geneator?

I'm trying to build a visual studio c++ project under windows by cmake, there are two cmakelists.txt file in my source, and they are't parent-child relationship, main cmakelists.txt link library and add executable, the other one is only responsible for collating the dependent path to the global variable and passing to main cmakelists.txt file use.

At the beginning of executing cmake script, i pass the build dir path by command line parameter "-B".

Final i got the output file, but the structure of result direcotry puzzled me.Main-cmakelists.txt generate configuration file to build folder that was specified by earlier. But the other one cmakelists.txt, which generate configuration file outside, and one level heigher than specified build folder, and the folder with same name as the folder where sub-cmakelists.txt located.

I tried to find answer in offical documents and book like cmakecookbook, currently, no relevant entry found.

How can i specify the path for the generator ouput of sub-cmakelists.txt? I want to unify same build root folder for all cmakelists.

Is there have some professional tutorial introduction about correspondence between cmake file and vs project file? Thanks.

enter image description here

The second parameter of add_subdirectory() command, can specify the binary_dir path to place the output file for sub-cmakelist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM