With cmake, I am trying to create two Visual Studio 2022 solution that each support its own platform for an exe and lib. The first platform being x64, and the second being a second platform called “tools”.
The approach for doing this that I read has said to create a CMakeLists.txt, then make a CMakeLists for each project per platform. However, when attempting that approach, it is not possible due to them having the same exe name from add_executable (or same library name, through add_library). However, I would want them to have the same name. What I would like to know, how can I support two different platforms inside of a solution while maintaining the same exe or lib name?
As an example, here is my current setup
CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(GlobalProject)
add_subdirectory(Testing-tools)
add_subdirectory(Testing-x64)
Testing-toolsCMakeLists.txt
cmake_minimum_required(VERSION 3.28)
set(CMAKE_GENERATOR_PLATFORM tools)
project(Testing-tools CXX)
add_executable(TestFlags ../main.cpp)
Testing-x64CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
set(CMAKE_GENERATOR_PLATFORM x64tools)
project(Testing-x64 CXX)
add_executable(TestFlags ../main.cpp)