project(read-and-write-resource-manager-state)
cmake_minimum_required(VERSION 3.8.2)

if (POLICY CMP0042)
  cmake_policy(SET CMP0042 NEW)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS False)
set(CMAKE_MODULE_PATH
  "${SMTK_DIR}"
  ${CMAKE_MODULE_PATH}
)

#Add our Cmake directory to the module search path
list(APPEND CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)

# Find smtk
find_package(smtk REQUIRED)

# this is probably not the right way to do this, but we need the path to SMTK's
# include directory so EncodeStringFunctions.cmake finds things.
get_target_property(SMTK_INCLUDE_DIR smtkCore INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(SMTK_LIB_DIR smtkCore LOCATION)
get_filename_component(SMTK_LIB_DIR ${SMTK_LIB_DIR} DIRECTORY)

# smtk's included CMake macros
include(SMTKMacros)
include(SMTKOperationXML)

# Find ParaView
find_package(ParaView)

# ParaView's included CMake macros
include(${PARAVIEW_USE_FILE})
include(ParaViewPlugins)

# Find boost
find_package(Boost 1.64.0 REQUIRED COMPONENTS filesystem)

# Find Qt5 and its components
find_package(Qt5 REQUIRED COMPONENTS Core)

# Header locations
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

# Build the library containing the state I/O operations
add_subdirectory(operators)

# Build the plugin containing the File menu items
add_subdirectory(plugin)

#Setup up the option to enable the testing directory
option(ENABLE_TESTING "Enable Testing" OFF)

if (ENABLE_TESTING)
  enable_testing()
  include(TestingMacros)
  add_subdirectory(testing)
endif()
