<div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>I am trying to understand how to build a subdirectory project that has its own CMakeLists.txt file already setup. In this case, I am using the open source library GLFW to help me with some of my OpenGL applications. Here is a sample directory structure I am working with.</div><div><br></div><div><div>Root</div><div>├── CMakeLists.txt</div><div>├── MainProject</div><div>├── build</div><div>└── glfw-3.3</div></div><div><br></div><div>The folder MainProject is where I will be doing all my own development and has a src, include, and lib folder associated with it. The glfw-3.3 directory was downloaded from online and has its own CMakeLists.txt file as mentioned previously. So if I were to build my project from the current build directory shown here, how should I add the glfw library to it and also change its target outputs?</div><div><br></div><div>Answers online suggest using ExternalProject_Add(), while others say to simply add_subdirectory() and then change some of the properties. I want to be able to have a user run the root CMake file and have the targets be correctly placed (since users might be on different operating systems). Either way I have not been able to find an explicit example, perhaps my Googling skills for CMake are lacking, and any help on this would be appreciated. Thank you for your time.</div><div><br></div><div>Best,</div><div>mlg</div><div><br></div></div></div>