Ninja Multi-Config generator works not really intuitive

IMHO in general, a Ninja Multi-Config project works not really intuitive:

bash-3.2$ cmake -G "Ninja Multi-Config" -B ../build -S .
# ...
bash-3.2$ cmake --build ../build --target all
ninja: no work to do.

bash-3.2$ cmake --build ../build --target package:all
ninja: error: 'all:Release', needed by 'CMakeFiles/Release/package.util', missing and no known rule to make it

bash-3.2$ cmake --build ../build --target install:all
ninja: error: 'all:Release', needed by 'CMakeFiles/Release/install.util', missing and no known rule to make it

bash-3.2$ cmake --build ../build --target help
[1/1] All primary targets available:
edit_cache: phony
rebuild_cache: phony
MathFunctions/edit_cache: phony
MathFunctions/rebuild_cache: phony
CMakeFiles/impl-Debug.ninja: RERUN_CMAKE
build-Debug.ninja: RERUN_CMAKE
CMakeFiles/impl-Release.ninja: RERUN_CMAKE
build-Release.ninja: RERUN_CMAKE
CMakeFiles/impl-RelWithDebInfo.ninja: RERUN_CMAKE
build-RelWithDebInfo.ninja: RERUN_CMAKE
build.ninja: RERUN_CMAKE
CMakeFiles/cmake_byproducts_for_clean_target: phony
CMakeFiles/cmake_byproducts_for_clean_target:Debug: phony
CMakeFiles/cmake_byproducts_for_clean_target:Release: phony
CMakeFiles/cmake_byproducts_for_clean_target:RelWithDebInfo: phony
help: HELP
/Users/clausklein/Downloads/cmake/Help/guide/tutorial/build/MathFunctions/Table.h: CUSTOM_COMMAND
MakeTable:Debug: phony
MathFunctions:Debug: phony
SqrtLibrary:Debug: phony
Tutorial:Debug: phony
Tutoriald:Debug: phony
libMathFunctionsd.dylib:Debug: phony
libSqrtLibraryd.a:Debug: phony
package_source: phony
package_source:all: phony
package: phony
package:all: phony
install/local: phony
install/local:all: phony
test: phony
test:all: phony
install/strip: phony
install/strip:all: phony
install: phony
install:all: phony
MathFunctions/install/strip: phony
MathFunctions/install/strip:all: phony
MathFunctions/install: phony
MathFunctions/install:all: phony
MathFunctions/package_source: phony
MathFunctions/package_source:all: phony
MathFunctions/install/local: phony
MathFunctions/install/local:all: phony
MathFunctions/test: phony
MathFunctions/test:all: phony
MathFunctions/package: phony
MathFunctions/package:all: phony
MakeTable: phony
MathFunctions: phony
SqrtLibrary: phony
Tutorial: phony
Tutoriald: phony
libMathFunctionsd.dylib: phony
libSqrtLibraryd.a: phony
all: phony
MathFunctions/all: phony
clean: phony
bash-3.2$ 

Are there some targets missing: i.e. all:all clean:all, … ?

In your first case, you misspelt the name of the generator. It is Ninja Multi-Config, not Ninja MultiConfig (note the missing hyphen.

1 Like

Oops, thank you!