view Resources/CMake/GoogleTestConfiguration.cmake @ 2276:b85f68a98474

ImportDicomFiles: Look for Python interpreter in PATH Some environments (in particular the official Docker image for Python) use a different path. `env' will lookup the given command in the PATH directories like shells do (though without the overhead), thus making the script more portable (it's conventional to have /usr/bin/env present everywhere).
author Thibault Nélis <tn@osimis.io>
date Wed, 12 Apr 2017 18:01:04 +0200
parents 8b51b133bb8b
children 741bb76634d3
line wrap: on
line source

if (USE_GTEST_DEBIAN_SOURCE_PACKAGE)
  find_path(GTEST_DEBIAN_SOURCES_DIR
    NAMES src/gtest-all.cc
    PATHS
    /usr/src/gtest
    /usr/src/googletest/googletest
    PATH_SUFFIXES src
    )

  find_path(GTEST_DEBIAN_INCLUDE_DIR
    NAMES gtest.h
    PATHS
    /usr/include/gtest
    )

  message("Path to the Debian Google Test sources: ${GTEST_DEBIAN_SOURCES_DIR}")
  message("Path to the Debian Google Test includes: ${GTEST_DEBIAN_INCLUDE_DIR}")

  set(GTEST_SOURCES ${GTEST_DEBIAN_SOURCES_DIR}/src/gtest-all.cc)
  include_directories(${GTEST_DEBIAN_SOURCES_DIR})

  if (NOT EXISTS ${GTEST_SOURCES} OR
      NOT EXISTS ${GTEST_DEBIAN_INCLUDE_DIR}/gtest.h)
    message(FATAL_ERROR "Please install the libgtest-dev package")
  endif()

elseif (STATIC_BUILD OR NOT USE_SYSTEM_GOOGLE_TEST)
  set(GTEST_SOURCES_DIR ${CMAKE_BINARY_DIR}/gtest-1.7.0)
  set(GTEST_URL "http://www.orthanc-server.com/downloads/third-party/gtest-1.7.0.zip")
  set(GTEST_MD5 "2d6ec8ccdf5c46b05ba54a9fd1d130d7")

  DownloadPackage(${GTEST_MD5} ${GTEST_URL} "${GTEST_SOURCES_DIR}")

  include_directories(
    ${GTEST_SOURCES_DIR}/include
    ${GTEST_SOURCES_DIR}
    )

  set(GTEST_SOURCES
    ${GTEST_SOURCES_DIR}/src/gtest-all.cc
    )

  # https://code.google.com/p/googletest/issues/detail?id=412
  if (MSVC) # VS2012 does not support tuples correctly yet
    add_definitions(/D _VARIADIC_MAX=10)
  endif()

  source_group(ThirdParty\\GoogleTest REGULAR_EXPRESSION ${GTEST_SOURCES_DIR}/.*)

else()
  include(FindGTest)
  if (NOT GTEST_FOUND)
    message(FATAL_ERROR "Unable to find GoogleTest")
  endif()

  include_directories(${GTEST_INCLUDE_DIRS})
  link_libraries(${GTEST_LIBRARIES})
endif()