llvm.org GIT mirror llvm / 11b69c2
[CMake] Use LLVM_ENABLE_IDE instead of CMAKE_CONFIGURATION_TYPES There are several places where we use CMAKE_CONFIGURATION_TYPES to determine if we are using an IDE generator and in turn decide not to generate some of the convenience targets (like all the install-* and check-llvm-* targets). This decision is made because IDEs don't always deal well with the thousands of targets LLVM can generate. This approach does not work for Visual Studio 15's new CMake integration. Because VS15 uses a Ninja generator, it isn't a multi-configuration build, and generating all these extra targets mucks up the UI and adds little value. With this change we still don't generate these targets by default for Visual Studio and Xcode generators, and LLVM_ENABLE_IDE becomes a switch that can be enabled on the VS15 CMake builds, to improve the IDE experience. This is a re-land of r340435, with a few minor fix-ups. The issues causing the revert were addressed in r344218, r344219, and r344553. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344555 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 10 months ago
4 changed file(s) with 11 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
973973 add_custom_target(llvm-headers DEPENDS intrinsics_gen)
974974 set_target_properties(llvm-headers PROPERTIES FOLDER "Misc")
975975
976 if (NOT CMAKE_CONFIGURATION_TYPES)
976 if (NOT LLVM_ENABLE_IDE)
977977 add_llvm_install_targets(install-llvm-headers
978978 DEPENDS llvm-headers
979979 COMPONENT llvm-headers)
983983 add_custom_target(llvm-libraries)
984984 set_target_properties(llvm-libraries PROPERTIES FOLDER "Misc")
985985
986 if (NOT CMAKE_CONFIGURATION_TYPES)
986 if (NOT LLVM_ENABLE_IDE)
987987 add_llvm_install_targets(install-llvm-libraries
988988 DEPENDS llvm-libraries
989989 COMPONENT llvm-libraries)
10041004 # This must be at the end of the LLVM root CMakeLists file because it must run
10051005 # after all targets are created.
10061006 if(LLVM_DISTRIBUTION_COMPONENTS)
1007 if(CMAKE_CONFIGURATION_TYPES)
1007 if(LLVM_ENABLE_IDE)
10081008 message(FATAL_ERROR "LLVM_DISTRIBUTION_COMPONENTS cannot be specified with multi-configuration generators (i.e. Xcode or Visual Studio)")
10091009 endif()
10101010
658658 ${install_type} DESTINATION ${install_dir}
659659 COMPONENT ${name})
660660
661 if (NOT CMAKE_CONFIGURATION_TYPES)
661 if (NOT LLVM_ENABLE_IDE)
662662 add_llvm_install_targets(install-${name}
663663 DEPENDS ${name}
664664 COMPONENT ${name})
889889 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
890890 COMPONENT ${name})
891891
892 if (NOT CMAKE_CONFIGURATION_TYPES)
892 if (NOT LLVM_ENABLE_IDE)
893893 add_llvm_install_targets(install-${name}
894894 DEPENDS ${name}
895895 COMPONENT ${name})
927927 install (TARGETS ${name}
928928 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
929929 COMPONENT ${name})
930 if (NOT CMAKE_CONFIGURATION_TYPES)
930 if (NOT LLVM_ENABLE_IDE)
931931 add_llvm_install_targets(install-${name}
932932 DEPENDS ${name}
933933 COMPONENT ${name})
14081408 endfunction()
14091409
14101410 function(add_lit_testsuites project directory)
1411 if (NOT CMAKE_CONFIGURATION_TYPES)
1411 if (NOT LLVM_ENABLE_IDE)
14121412 cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
14131413
14141414 # Search recursively for test directories by assuming anything not
14671467 CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
14681468 COMPONENT ${component})
14691469
1470 if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
1470 if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
14711471 add_llvm_install_targets(install-${name}
14721472 DEPENDS ${name} ${dest} install-${dest}
14731473 COMPONENT ${name})
15001500 CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
15011501 COMPONENT ${component})
15021502
1503 if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
1503 if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
15041504 add_llvm_install_targets(install-${name}
15051505 DEPENDS ${name} ${dest} install-${dest}
15061506 COMPONENT ${name})
131131 PATTERN LLVM-Config.cmake EXCLUDE
132132 PATTERN GetHostTriple.cmake EXCLUDE)
133133
134 if (NOT CMAKE_CONFIGURATION_TYPES)
134 if (NOT LLVM_ENABLE_IDE)
135135 # Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS
136136 add_custom_target(cmake-exports)
137137 add_llvm_install_targets(install-cmake-exports
9999 PREFIX ${LLVMToolchainDir}/usr/)
100100
101101 if(LLVM_DISTRIBUTION_COMPONENTS)
102 if(CMAKE_CONFIGURATION_TYPES)
102 if(LLVM_ENABLE_IDE)
103103 message(FATAL_ERROR "LLVM_DISTRIBUTION_COMPONENTS cannot be specified with multi-configuration generators (i.e. Xcode or Visual Studio)")
104104 endif()
105105