mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Initialize CMAKE_EXPORT_COMPILE_COMMANDS only if not set already
Also de-duplicate its initialization code. Fixes: #16588
This commit is contained in:
@@ -50,15 +50,9 @@ if(CMAKE_GENERATOR MATCHES "Make")
|
||||
if(DEFINED CMAKE_TARGET_MESSAGES)
|
||||
set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES})
|
||||
endif()
|
||||
if(CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
|
||||
CACHE BOOL "Enable/Disable output of compile commands during generation."
|
||||
)
|
||||
mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Ninja")
|
||||
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS AND CMAKE_GENERATOR MATCHES "Ninja|Unix Makefiles")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
|
||||
CACHE BOOL "Enable/Disable output of compile commands during generation."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user