I'm trying to learn CMake and am struggling to achieve the project layout that I'm used to making with visual studio.
I want to achieve something like the following directory structure, where the .vcxproj and .sln are generated by CMake
Root
CMakeLists.txt
MySolution.sln
ProjectOne
CMakeLists.txt
ProjectOne.vcxproj
someSourceFile1.h
someSourceFile1.cpp
ProjectTwo
CMakeLists.txt
ProjectTwo.vcxproj
someSourceFile2.h
someSourceFile2.cpp
Binaries
Platform
Debug
ProjectOne.exe
ProjectTwo.dll
Release
ProjectOne.exe
ProjectTwo.dll
All the tutorials I seem to find seem to give an Examples where the structure turns out something like this:
Root
Source
CMakeLists.txt
ProjectOne
CMakeLists.txt
someSourceFile1.h
someSourceFile1.cpp
ProjectTwo
CMakeLists.txt
someSourceFile2.h
someSourceFile2.cpp
Build
MySolution.sln
ProjectTwo.vcxproj
ProjectOne.vcxproj
Platform
Debug
ProjectOne.exe
ProjectTwo.dll
Release
ProjectOne.exe
ProjectTwo.dll
Using commands like
mkdir Build
cd build
CMake ..\Source
CMake --Build .
Notable I have not added ALL_BUILD.vcxproj and ZERO_CHECK.vcxproj that get generated, which I am yet to understand my need for.
- Is there just a command I'm missing in the CMakeList.txt to do this?
- Is there a reason I shouldn't lay my project out the way I want to?