Kaynağa Gözat

Only offer the compile command output feature on unix systems

Manuel Klimek 14 yıl önce
ebeveyn
işleme
8346a28a0a

+ 6 - 3
Modules/CMakeGenericSystem.cmake

@@ -50,9 +50,12 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
   IF(DEFINED CMAKE_RULE_MESSAGES)
     SET_PROPERTY(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
   ENDIF(DEFINED CMAKE_RULE_MESSAGES)
-  SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
-    "Enable/Disable output of compile commands during generation."
-    )
+  IF(CMAKE_GENERATOR MATCHES "Unix Makefiles")
+    SET(CMAKE_EXPORT_COMPILE_COMMANDS OFF CACHE BOOL
+      "Enable/Disable output of compile commands during generation."
+      )
+    MARK_AS_ADVANCED(CMAKE_EXPORT_COMPILE_COMMANDS)
+  ENDIF(CMAKE_GENERATOR MATCHES "Unix Makefiles")
 ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
 
 

+ 4 - 2
Tests/CMakeLib/CMakeLists.txt

@@ -31,5 +31,7 @@ foreach(test ${CMakeLib_TESTS})
   add_test(CMakeLib.${test} CMakeLibTests ${test})
 endforeach()
 
-ADD_EXECUTABLE(runcompilecommands run_compile_commands.cxx)
-TARGET_LINK_LIBRARIES(runcompilecommands CMakeLib)
+if(TEST_CompileCommandOutput)
+  add_executable(runcompilecommands run_compile_commands.cxx)
+  target_link_libraries(runcompilecommands CMakeLib)
+endif()

+ 8 - 2
Tests/CMakeLists.txt

@@ -39,6 +39,10 @@ CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
 
 # Testing
 IF(BUILD_TESTING)
+  IF("${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
+    SET(TEST_CompileCommandOutput 1)
+  ENDIF()
+
   ADD_SUBDIRECTORY(CMakeLib)
 
   # Collect a list of all test build directories.
@@ -2032,8 +2036,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
     SET_TESTS_PROPERTIES(Contracts.${project} PROPERTIES TIMEOUT ${timeout})
   ENDFOREACH()
 
-  ADD_TEST_MACRO(CompileCommandOutput
-    "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
+  IF(TEST_CompileCommandOutput)
+    ADD_TEST_MACRO(CompileCommandOutput
+      "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
+  ENDIF()
 ENDIF(BUILD_TESTING)
 
 SUBDIRS(CMakeTests)