cmake-precompiled-header icon indicating copy to clipboard operation
cmake-precompiled-header copied to clipboard

NMake rebuilds everything when used with add_subdirectory()

Open calgray opened this issue 7 years ago • 1 comments

Using the add_subdirectory function in cmake to include a project using a precompiled header will work with VS/MSBuild generators, but the NMake generator will not detect its output binaries and will always do a complete rebuild.

Rebuilding does not happen when you disable precompiled headers.

Maybe this is a problem with the NMake generator itself?

calgray avatar Jun 15 '17 13:06 calgray

I modified function export_all_flags:

if (NOT EXISTS ${_filename})
  message(${_filename} " is not exist, so generate.")
  file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}\n")
endif()

It's work for me.

demon90s avatar Jun 06 '18 10:06 demon90s