Cleanup: Fix build warning on windows

MSBuild on windows currently spews a warning about
buildinfo.h_fake not being generated.

For build info we use a non existing file to trigger a
custom_command on every build, which has worked well for
years now, however in recent versions of MSBuild it has
started issuing warnings about files that should be
generated but are not.

CMake is actually aware of this being a problem and states
in the documentation that "If the output of the custom command
is not actually created as a file on disk it should be marked
with the SYMBOLIC source file property."

This change fixes the build warning by properly marking the
buildinfo.h_fake as symbolic resolving the warning.
This commit is contained in:
Ray Molenkamp
2020-08-27 08:10:37 -06:00
parent e51c721315
commit 8a984ddd0f

View File

@@ -191,6 +191,12 @@ if(WITH_BUILDINFO)
message(FATAL_ERROR "File \"${buildinfo_h_fake}\" found, this should never be created, remove!")
endif()
# From the cmake documentation "If the output of the custom command is not actually created as a
# file on disk it should be marked with the SYMBOLIC source file property."
#
# Not doing this leads to build warnings for the not generated file on windows when using msbuild
SET_SOURCE_FILES_PROPERTIES(${buildinfo_h_fake} PROPERTIES SYMBOLIC TRUE)
# a custom target that is always built
add_custom_target(buildinfo ALL
DEPENDS ${buildinfo_h_fake})