X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=CMakeLists.txt;h=ea3fda39c37d39400be03626d203068248555a26;hp=4f00395fd60be8e726251724309f2b75f9d54f3e;hb=339fa95661531e66d74e5f8dec3199bd7691efb9;hpb=068db0bdb8039add959e5553686e1ac9867f6920 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f00395fd60..ea3fda39c37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,23 @@ # See docs/CMake.html for instructions about how to build LLVM with CMake. -cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 2.8.12.2) -# FIXME: It may be removed when we use 2.8.12. -if(CMAKE_VERSION VERSION_LESS 2.8.12) - # Invalidate a couple of keywords. - set(cmake_2_8_12_INTERFACE) - set(cmake_2_8_12_PRIVATE) -else() - # Use ${cmake_2_8_12_KEYWORD} intead of KEYWORD in target_link_libraries(). - set(cmake_2_8_12_INTERFACE INTERFACE) - set(cmake_2_8_12_PRIVATE PRIVATE) - if(POLICY CMP0022) - cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required - endif() +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "No build type selected, default to Debug") + set(CMAKE_BUILD_TYPE "Debug") +endif() + +if(POLICY CMP0022) + cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required +endif() + +if (POLICY CMP0051) + # CMake 3.1 and higher include generator expressions of the form + # $ in the SOURCES property. These need to be + # stripped everywhere that access the SOURCES property, so we just + # defer to the OLD behavior of not including generator expressions + # in the output for now. + cmake_policy(SET CMP0051 OLD) endif() if(CMAKE_VERSION VERSION_LESS 3.1.20141117) @@ -24,10 +28,6 @@ endif() project(LLVM) -if (MSVC AND MSVC_VERSION LESS 1800) - message(FATAL_ERROR "Minimum required MSVC version is 2013!") -endif () - # The following only works with the Ninja generator in CMake >= 3.0. set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING "Define the maximum number of concurrent compilation jobs.") @@ -53,9 +53,11 @@ set(CMAKE_MODULE_PATH set(LLVM_VERSION_MAJOR 3) set(LLVM_VERSION_MINOR 7) set(LLVM_VERSION_PATCH 0) +set(LLVM_VERSION_SUFFIX svn) if (NOT PACKAGE_VERSION) - set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}svn") + set(PACKAGE_VERSION + "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}") endif() option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) @@ -240,6 +242,7 @@ endif() option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF) option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF) option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF) +option(LLVM_ENABLE_LIBCXXABI "Use libc++abi when using libc++." OFF) option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF) @@ -337,6 +340,11 @@ if(LLVM_DISABLE_LLVM_DYLIB_ATEXIT) set(DISABLE_LLVM_DYLIB_ATEXIT 1) endif() +option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF) +if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND LLVM_ENABLE_ASSERTIONS)) + set(LLVM_USE_HOST_TOOLS ON) +endif() + # All options referred to from HandleLLVMOptions have to be specified # BEFORE this include, otherwise options will not be correctly set on # first cmake run @@ -523,9 +531,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) # when crosscompiling import the executable targets from a file -if(CMAKE_CROSSCOMPILING) +if(LLVM_USE_HOST_TOOLS) include(CrossCompile) -endif(CMAKE_CROSSCOMPILING) +endif(LLVM_USE_HOST_TOOLS) if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD ) # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM @@ -539,7 +547,7 @@ if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) # Make sure we don't get -rdynamic in every binary. For those that need it, -# use set_target_properties(target PROPERTIES ENABLE_EXPORTS 1) +# use export_executable_symbols(target). set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") include(AddLLVM) @@ -623,6 +631,11 @@ if( LLVM_INCLUDE_TESTS ) DEPENDS ${LLVM_LIT_DEPENDS} ARGS ${LLVM_LIT_EXTRA_ARGS} ) + + add_lit_testsuites(LLVM ${CMAKE_SOURCE_DIR}/test + PARAMS ${LLVM_LIT_PARAMS} + DEPENDS ${LLVM_LIT_DEPENDS} + ARGS ${LLVM_LIT_EXTRA_ARGS}) endif() if (LLVM_INCLUDE_DOCS) @@ -634,6 +647,7 @@ add_subdirectory(cmake/modules) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c DESTINATION include + COMPONENT llvm-headers FILES_MATCHING PATTERN "*.def" PATTERN "*.h" @@ -645,6 +659,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm DESTINATION include + COMPONENT llvm-headers FILES_MATCHING PATTERN "*.def" PATTERN "*.h" @@ -655,4 +670,12 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) PATTERN "config.h" EXCLUDE PATTERN ".svn" EXCLUDE ) + + if (NOT CMAKE_CONFIGURATION_TYPES) + add_custom_target(installhdrs + DEPENDS ${name} + COMMAND "${CMAKE_COMMAND}" + -DCMAKE_INSTALL_COMPONENT=llvm-headers + -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") + endif() endif()