
# Google Mock unfortunately has to be compiled from source
include(FindGMock)

@if "%ContentType%".substring(0, "network".length) === "network"
# We need process-cpp to launch the python test server
pkg_check_modules(
  TEST
  process-cpp
  REQUIRED
)
@endif

# Include our test library headers
include_directories(
  ${GTEST_INCLUDE_DIRS}
  ${GMOCK_INCLUDE_DIRS}
  ${TEST_INCLUDE_DIRS}
)

# Where to find the scope ini file and .so
set(TEST_SCOPE_DIRECTORY "${CMAKE_BINARY_DIR}/src")

file(GLOB_RECURSE
  TEST_FIXTURES
@if "%ContentType%" == "empty"
  "unit/*.py"
@elsif "%ContentType%" == "network-netcpp-json"
  "server/*.json"
  "*.py"
@elsif "%ContentType%" == "network-netcpp-qjson"
  "server/*.json"
  "*.py"
@elsif "%ContentType%" == "network-netcpp-qxml"
  "server/*.xml"
  "*.py"
@endif
)

# Make this file show up in QtCreator
add_custom_target(hidden_test_fixtures ALL
  SOURCES ${TEST_FIXTURES}
)

@if "%ContentType%".substring(0, "network".length) === "network"
# Where to find the test server binary
set(FAKE_SERVER "${CMAKE_CURRENT_SOURCE_DIR}/server/server.py")
@endif

# Add the unit tests
add_subdirectory(unit)
