[CMake] MSBuild and automatic project file regenation
Bill Hoffman
bill.hoffman at kitware.com
Thu Feb 9 11:35:10 EST 2012
I took a look at this, and it is behaving as expected with VS. VS does
NOT have a depend on compile flags. You can change a .vcproj file and
the flags it uses all you want, and VS will NOT rebuild any files
because of that.
So, as far as VS is concerned your source file has not changed and does
not need to rebuild. I modified your example and --build works
perfectly (I change the NUMBER in the CMakeLists.txt and main is rebuilt
with one invocation of cmake --build .)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(BUILD C)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "#include <stdio.h>
#include <main.h>
int main(void)
{
printf(\"%d\\n\",NUMBER);
return 0;
}
")
include_directories(${CMAKE_BINARY_DIR})
ADD_EXECUTABLE(main main.c)
set(NUMBER 2)
configure_file(main.h.in main.h)
$ cat ../main.h.in
#define NUMBER @NUMBER@
More information about the CMake
mailing list