cmake-precompiled-header
cmake-precompiled-header copied to clipboard
NMake rebuilds everything when used with add_subdirectory()
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?
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.