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@
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to