Provide dependency file flags to generator
Causes compiler modules (currently only GNU) to set a CMAKE_DEPFILE_FLAGS_${lang} variable, which communicates to the generator the flags required to cause the compiler to create dependency files.
This commit is contained in:
parent
4468edf12b
commit
7eb8d9036c
|
@ -24,6 +24,15 @@ macro(__compiler_gnu lang)
|
||||||
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
|
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
|
||||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
||||||
|
|
||||||
|
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
|
||||||
|
# header file as a warning if depfiles are enabled, causing check_header_file
|
||||||
|
# tests to always succeed. Work around this by disabling dependency tracking
|
||||||
|
# in try_compile mode.
|
||||||
|
GET_PROPERTY(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
|
||||||
|
if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
|
||||||
|
set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MF <DEPFILE>")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Initial configuration flags.
|
# Initial configuration flags.
|
||||||
set(CMAKE_${lang}_FLAGS_INIT "")
|
set(CMAKE_${lang}_FLAGS_INIT "")
|
||||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
|
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-g")
|
||||||
|
|
|
@ -40,6 +40,8 @@ if("${CMAKE_GENERATOR}" MATCHES "Make")
|
||||||
endif()
|
endif()
|
||||||
list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}")
|
list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}")
|
||||||
|
|
||||||
|
list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1")
|
||||||
|
|
||||||
file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
|
file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
|
||||||
message("Creating Project/foo.cxx")
|
message("Creating Project/foo.cxx")
|
||||||
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
|
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
|
||||||
|
|
Loading…
Reference in New Issue