[llvm-commits] [llvm] r158896 - in /llvm/trunk: cmake/modules/AddLLVM.cmake unittests/CMakeLists.txt
Alexander Kornienko
alexfh at google.com
Thu Jun 21 10:59:32 PDT 2012
I had the same problem. Updating cmake to 2.8.8 helped to solve it.
On Thu, Jun 21, 2012 at 6:21 PM, Timur Iskhodzhanov <timurrrr at google.com>wrote:
> it has broken my Windows VC9 build too, including our ASan/Win bot
>
> On Thu, Jun 21, 2012 at 3:29 AM, NAKAMURA Takumi <geek4civic at gmail.com>
> wrote:
> > It broke my cmake-linux builders.
> > I guess something version mismatch. IIRC, they use 2.8.3.
> >
> > I will fix tonight.
> >
> > 2012/06/21 14:19 "Chandler Carruth" <chandlerc at gmail.com>:
> >
> >> Author: chandlerc
> >> Date: Thu Jun 21 00:16:58 2012
> >> New Revision: 158896
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=158896&view=rev
> >> Log:
> >> Factor the logic for setting up a GoogleTest unit test executable into
> >> a helper function in CMake. This will allow us to share all of this
> >> logic with Clang, and eventually CompilerRT.
> >>
> >> Modified:
> >> llvm/trunk/cmake/modules/AddLLVM.cmake
> >> llvm/trunk/unittests/CMakeLists.txt
> >>
> >> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=158896&r1=158895&r2=158896&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
> >> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Jun 21 00:16:58 2012
> >> @@ -147,3 +147,53 @@
> >> endif()
> >> endif()
> >> endmacro(add_llvm_external_project)
> >> +
> >> +# Generic support for adding a unittest.
> >> +function(add_unittest test_suite test_dirname)
> >> + string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
> >> + if (CMAKE_BUILD_TYPE)
> >> + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
> >> + ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}/${CMAKE_BUILD_TYPE})
> >> + else()
> >> + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
> >> + ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname})
> >> + endif()
> >> + if( NOT LLVM_BUILD_TESTS )
> >> + set(EXCLUDE_FROM_ALL ON)
> >> + endif()
> >> +
> >> + add_llvm_executable(${test_name} ${ARGN})
> >> + target_link_libraries(${test_name}
> >> + gtest
> >> + gtest_main
> >> + LLVMSupport # gtest needs it for raw_ostream.
> >> + )
> >> +
> >> + add_dependencies(${test_suite} ${test_name})
> >> + get_target_property(test_suite_folder ${test_suite} FOLDER)
> >> + if (NOT ${test_suite_folder} STREQUAL "NOTFOUND")
> >> + set_property(TARGET ${test_name} PROPERTY FOLDER
> >> "${test_suite_folder}")
> >> + endif ()
> >> +
> >> + # Visual Studio 2012 only supports up to 8 template parameters in
> >> + # std::tr1::tuple by default, but gtest requires 10
> >> + if (MSVC AND MSVC_VERSION EQUAL 1700)
> >> + set_property(TARGET ${test_name} APPEND PROPERTY
> COMPILE_DEFINITIONS
> >> _VARIADIC_MAX=10)
> >> + endif ()
> >> +
> >> +
> >>
> include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
> >> + set_property(TARGET ${test_name} APPEND PROPERTY COMPILE_DEFINITIONS
> >> GTEST_HAS_RTTI=0)
> >> + if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
> >> + set_property(TARGET ${test_name} APPEND_STRING PROPERTY
> COMPILE_FLAGS
> >> " -fno-rtti")
> >> + elseif (MSVC)
> >> + set_property(TARGET ${test_name} APPEND_STRING PROPERTY
> COMPILE_FLAGS
> >> " /GR-")
> >> + endif ()
> >> +
> >> + if (NOT LLVM_ENABLE_THREADS)
> >> + set_property(TARGET ${test_name} APPEND PROPERTY
> COMPILE_DEFINITIONS
> >> GTEST_HAS_PTHREAD=0)
> >> + endif ()
> >> +
> >> + if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
> >> + set_property(TARGET ${test_name} APPEND_STRING PROPERTY
> COMPILE_FLAGS
> >> " -Wno-variadic-macros")
> >> + endif ()
> >> +endfunction()
> >>
> >> Modified: llvm/trunk/unittests/CMakeLists.txt
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=158896&r1=158895&r2=158896&view=diff
> >>
> >>
> ==============================================================================
> >> --- llvm/trunk/unittests/CMakeLists.txt (original)
> >> +++ llvm/trunk/unittests/CMakeLists.txt Thu Jun 21 00:16:58 2012
> >> @@ -1,51 +1,9 @@
> >> -function(add_llvm_unittest test_dirname)
> >> - string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
> >> - if (CMAKE_BUILD_TYPE)
> >> - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
> >> - ${LLVM_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
> >> - else()
> >> - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
> >> - ${LLVM_BINARY_DIR}/unittests/${test_dirname})
> >> - endif()
> >> - if( NOT LLVM_BUILD_TESTS )
> >> - set(EXCLUDE_FROM_ALL ON)
> >> - endif()
> >> -
> >> - add_llvm_executable(${test_name} ${ARGN})
> >> - target_link_libraries(${test_name}
> >> - gtest
> >> - gtest_main
> >> - LLVMSupport # gtest needs it for raw_ostream.
> >> - )
> >> -
> >> - add_dependencies(UnitTests ${test_name})
> >> - set_target_properties(${test_name} PROPERTIES FOLDER "Tests")
> >> -endfunction()
> >> -
> >> -# Visual Studio 2012 only supports up to 8 template parameters in
> >> -# std::tr1::tuple by default, but gtest requires 10
> >> -if(MSVC AND MSVC_VERSION EQUAL 1700)
> >> - add_definitions(-D_VARIADIC_MAX=10)
> >> -endif ()
> >> -
> >> add_custom_target(UnitTests)
> >> set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
> >>
> >>
> >>
> -include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
> >> -add_definitions(-DGTEST_HAS_RTTI=0)
> >> -if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
> >> - llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
> >> -elseif( MSVC )
> >> - llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
> >> -endif()
> >> -
> >> -if (NOT LLVM_ENABLE_THREADS)
> >> - add_definitions(-DGTEST_HAS_PTHREAD=0)
> >> -endif()
> >> -
> >> -if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
> >> - add_definitions("-Wno-variadic-macros")
> >> -endif()
> >> +function(add_llvm_unittest test_dirname)
> >> + add_unittest(UnitTests ${test_dirname} ${ARGN})
> >> +endfunction()
> >>
> >> set(LLVM_LINK_COMPONENTS
> >> jit
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Alexander Kornienko | Software Engineer | alexfh at google.com | +49 151 221
77 957
Google Germany GmbH | Dienerstr. 12 | 80331 München
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120621/831d86b1/attachment.html>
More information about the llvm-commits
mailing list