1

Here with more CMake questions! I'm in the process of moving a project to CMake, and the project has dependencies on external projects which my company owns but which my team does not work on, and I'm trying to find a way to configure + build my project with CMake and to include these external dependencies in the mix.

Until now, my project has been based on solutions + vcxproj's on Windows. The project solution includes the vcxproj files for our external dependencies. For example:

/Path/To/Common/Root
|-- MyProject
|   |-- SomeDirectory
|   |-- OtherDirectory
|   `-- SourceDirectory
|       |-- SourceDir1
|       |   |-- my_file.cpp
|       |   `-- my_file.h
|       |
|       |-- my_proj.sln
|       |-- my_proj.vcxproj
|       |-- my_main.cpp
|       `-- my_main.h
|
`-- ExternalProj
    |-- external_proj.sln
    `-- external_proj.vcxproj

I can add a CMakeLists.txt for MyProject but not for ExternalProj, but my_proj.sln includes external_proj.vcxproj. If I specify the -G "Visual Studio <version>" in my CMake command, then it will generate the sln for MyProject:

# After calling CMake with '-G "Visual Studio <version>"'
/Path/To/Common/Root
|-- MyProject
|   |-- cmake_build_dir
|   |   |-- ALL_BUILD.vcxproj
|   |   |-- MyProject.sln
|   |   |-- MyProject.vcxproj
|   |   `-- ZERO_CHECK.vcxproj
|   |
|   |-- SomeDirectory
|   |
|   |-- OtherDirectory
|   |
|   `-- SourceDirectory
|       |-- SourceDir1
|       |   |-- my_file.cpp
|       |   `-- my_file.h
|       |
|       |-- my_proj.sln
|       |-- my_proj.vcxproj
|       |-- my_main.cpp
|       `-- my_main.h
|
`-- ExternalProj
    |-- external_proj.sln
    `-- external_proj.vcxproj

However, MyProject.sln will only have ALL_BUILD.vcxproj, MyProject.vcxproj, and ZERO_CHECK.vcxproj as part of it.

What I'm asking is if it's possible to use CMake to add external_proj.vcxproj and configure it as a dependency of MyProject.vcxproj without adding a CMakeLists.txt to ExternalProj.

0 Answers0