Created
November 12, 2024 13:17
-
-
Save kopp/a98a803ff2eff5738815f6cfa8e88f91 to your computer and use it in GitHub Desktop.
cmake: Selecting a generator within CMakeLists.txt (SO https://stackoverflow.com/q/11269833)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.31.0) | |
project(build_with_ninja CXX) | |
set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE) | |
message("generator is set to ${CMAKE_GENERATOR}") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir source | |
mv CMakeLists.txt source/ | |
mkdir build | |
cmake -S source -B build | |
ls build/Makefile build/build.ninja |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok, interesting. So I cannot confirm, but glad that it works for you :)