PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/test/CMakeLists.txt

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 136 lines | 112 code | 19 blank | 5 comment | 3 complexity | fed3c4425e8ed254a642b2ad7ac0cefe MD5 | raw file
  1# -*- cmake -*-
  2
  3project (test)
  4
  5include(00-Common)
  6include(LLCommon)
  7include(LLInventory)
  8include(LLMath)
  9include(LLMessage)
 10include(LLVFS)
 11include(LLXML)
 12include(LScript)
 13include(Linking)
 14include(Tut)
 15include(LLAddBuildTest)
 16
 17include(GoogleMock)
 18
 19include_directories(
 20    ${LLCOMMON_INCLUDE_DIRS}
 21    ${LLDATABASE_INCLUDE_DIRS}
 22    ${LLMATH_INCLUDE_DIRS}
 23    ${LLMESSAGE_INCLUDE_DIRS}
 24    ${LLINVENTORY_INCLUDE_DIRS}
 25    ${LLVFS_INCLUDE_DIRS}
 26    ${LLXML_INCLUDE_DIRS}
 27    ${LSCRIPT_INCLUDE_DIRS}
 28    ${GOOGLEMOCK_INCLUDE_DIRS}
 29    ${TUT_INCLUDE_DIR}
 30    )
 31
 32set(test_SOURCE_FILES
 33    io.cpp
 34    llapp_tut.cpp
 35    llblowfish_tut.cpp
 36    llbuffer_tut.cpp
 37    lldoubledispatch_tut.cpp
 38    llevents_tut.cpp
 39    llhttpdate_tut.cpp
 40    llhttpclient_tut.cpp
 41    llhttpnode_tut.cpp
 42    lliohttpserver_tut.cpp
 43    llmessageconfig_tut.cpp
 44    llpermissions_tut.cpp
 45    llpipeutil.cpp
 46    llsaleinfo_tut.cpp
 47    llscriptresource_tut.cpp
 48    llsdmessagebuilder_tut.cpp
 49    llsdmessagereader_tut.cpp
 50    llsd_new_tut.cpp
 51    llsdutil_tut.cpp
 52    llservicebuilder_tut.cpp
 53    llstreamtools_tut.cpp
 54    lltemplatemessagebuilder_tut.cpp
 55    lltut.cpp
 56    lluuidhashmap_tut.cpp
 57    message_tut.cpp
 58    test.cpp
 59    )
 60
 61set(test_HEADER_FILES
 62    CMakeLists.txt
 63
 64    debug.h
 65    llpipeutil.h
 66    llsdtraits.h
 67    lltut.h
 68    )
 69
 70if (NOT WINDOWS)
 71  list(APPEND test_SOURCE_FILES
 72       llmessagetemplateparser_tut.cpp
 73       )
 74endif (NOT WINDOWS)
 75
 76set_source_files_properties(${test_HEADER_FILES}
 77                            PROPERTIES HEADER_FILE_ONLY TRUE)
 78
 79list(APPEND test_SOURCE_FILES ${test_HEADER_FILES})
 80
 81add_executable(test ${test_SOURCE_FILES})
 82
 83target_link_libraries(test
 84    ${LLDATABASE_LIBRARIES}
 85    ${LLINVENTORY_LIBRARIES}
 86    ${LLMESSAGE_LIBRARIES}
 87    ${LLMATH_LIBRARIES}
 88    ${LLVFS_LIBRARIES}
 89    ${LLXML_LIBRARIES}
 90    ${LSCRIPT_LIBRARIES}
 91    ${LLCOMMON_LIBRARIES}
 92    ${EXPAT_LIBRARIES}
 93    ${GOOGLEMOCK_LIBRARIES}
 94    ${PTHREAD_LIBRARY}
 95    ${WINDOWS_LIBRARIES}
 96    ${BOOST_PROGRAM_OPTIONS_LIBRARY}
 97    ${BOOST_REGEX_LIBRARY}
 98    ${DL_LIBRARY}
 99    ${GOOGLE_PERFTOOLS_LIBRARIES}
100    )
101
102if (WINDOWS)
103  set_target_properties(test
104          PROPERTIES 
105          LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
106          LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
107          )
108endif (WINDOWS)
109
110get_target_property(TEST_EXE test LOCATION)
111
112SET_TEST_PATH(DYLD_LIBRARY_PATH)
113
114LL_TEST_COMMAND(command 
115  "${DYLD_LIBRARY_PATH}"
116  "${TEST_EXE}"
117  "--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt" 
118  "--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt")
119
120ADD_CUSTOM_COMMAND(
121  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
122  COMMAND ${command}
123  DEPENDS test
124  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
125  COMMENT "C++ unit tests"
126  )
127
128set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)
129
130# This should cause the test executable to be built, but not 
131# run if LL_TESTS is disabled. This will hopefully keep the
132# tests up to date with any code changes changes even if 
133# developers choose to disable LL_TESTS.
134if (LL_TESTS)  
135    add_custom_target(tests_ok ALL DEPENDS ${test_results})
136endif (LL_TESTS)