I've recently found this amazing new gem called premake and I was all "FINALLY!"
I'm trying to make a simple "Test" configuration, that works like this: when in Test configuration, exclude source/Main.cpp when not in Test configuration, exclude source/Test.cpp (that contains another main)
This is the premake4.lua code that tries to do this
solution "Foo" configurations {"Debug", "Release", "Test"} location "build"
project "Bar"
targetname "Bar"
language "C++"
kind "WindowedApp"
files {"source/**.h","source/**.cpp","source/**.c"}
flags {"StaticRuntime","ExtraWarnings", "FatalWarnings"}
configuration "Test"
excludes "source/Main.cpp"
targetsuffix "_Test"
defines {"DEBUG", "TEST"}
flags {"Symbols"}
configuration "not Test"
excludes "source/Test.cpp"
-- And so on ...
But when I compile with "make -Cbuild config=test" it will regardless compile and link with "Main.cpp".
What am I doing wrong?