FindCPPUNIT.cmake 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ################################################################################
  16. # - Try to find the CppUnit unit testing library
  17. # Once done this will define
  18. #
  19. # CPPUNIT_FOUND - system has the CppUnit library
  20. # CPPUNIT_INCLUDE_DIR - the CppUnit include directory
  21. # CPPUNIT_LIBRARIES - The libraries needed to use CppUnit
  22. IF (NOT CPPUNIT_FOUND)
  23. IF (WIN32)
  24. SET (cppunit_dll "cppunit_dll")
  25. ELSE()
  26. SET (cppunit_dll "cppunit")
  27. ENDIF()
  28. IF (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
  29. IF (UNIX)
  30. IF (${ARCH64BIT} EQUAL 1)
  31. SET (osdir "linux64_gcc4.1.1")
  32. ELSE()
  33. SET (osdir "linux32_gcc4.1.1")
  34. ENDIF()
  35. ELSEIF(WIN32)
  36. IF (${ARCH64BIT} EQUAL 1)
  37. SET (osdir "win64")
  38. ELSE()
  39. SET (osdir "win32")
  40. ENDIF()
  41. ELSE()
  42. SET (osdir "unknown")
  43. ENDIF()
  44. IF (NOT ("${osdir}" STREQUAL "unknown"))
  45. FIND_PATH (CPPUNIT_INCLUDE_DIR NAMES cppunit/TestFixture.h PATHS "${EXTERNALS_DIRECTORY}/cppunit/include" NO_DEFAULT_PATH)
  46. FIND_LIBRARY (CPPUNIT_LIBRARIES NAMES ${cppunit_dll} PATHS "${EXTERNALS_DIRECTORY}/cppunit/lib/${osdir}" NO_DEFAULT_PATH)
  47. ENDIF()
  48. ENDIF()
  49. # if we didn't find in externals, look in system include path
  50. if (USE_NATIVE_LIBRARIES)
  51. FIND_PATH (CPPUNIT_INCLUDE_DIR NAMES cppunit/TestFixture.h)
  52. FIND_LIBRARY (CPPUNIT_LIBRARIES NAMES ${cppunit_dll})
  53. endif()
  54. include(FindPackageHandleStandardArgs)
  55. find_package_handle_standard_args(CppUnit DEFAULT_MSG
  56. CPPUNIT_LIBRARIES
  57. CPPUNIT_INCLUDE_DIR
  58. )
  59. IF (CPPUNIT_FOUND AND WIN32)
  60. STRING(REPLACE "cppunit_dll" "cppunitd_dll" CPPUNIT_DEBUG_LIBRARIES "${CPPUNIT_LIBRARIES}")
  61. set (CPPUNIT_LIBRARIES optimized ${CPPUNIT_LIBRARIES} debug ${CPPUNIT_DEBUG_LIBRARIES})
  62. ENDIF()
  63. MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARIES)
  64. ENDIF()