#-------------------------------------------------------------------
# This file is part of the CMake build system for ARToolKit
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------

#######################################################################
# This file takes care of configuring ARToolKit to build with the settings
# given in CMake. It creates the necessary config.h file and will
# also prepare package files for pkg-config and CMake.
#######################################################################

# Create the pkg-config package files on Unix systems
if (UNIX)
  set(ARToolKit_LIB_SUFFIX "")
  set(ARToolKit_PLUGIN_PREFIX "")
  set(ARToolKit_PLUGIN_EXT ".so")
  string(TOLOWER "${CMAKE_BUILD_TYPE}" ARToolKit_BUILD_TYPE)
  #if (ARToolKit_BUILD_TYPE STREQUAL "debug")
  #  set(ARToolKit_LIB_SUFFIX "${ARToolKit_LIB_SUFFIX}_d")
  #endif ()

  set(ARToolKit_ADDITIONAL_LIBS "")
  set(ARToolKit_CFLAGS "")
  set(ARToolKit_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
  configure_file(${ARToolKit_TEMPLATES_DIR}/ARToolKit.pc.in ${ARToolKit_BINARY_DIR}/pkgconfig/ARToolKit${ARToolKit_LIB_SUFFIX}.pc @ONLY)

  install(FILES ${ARToolKit_BINARY_DIR}/pkgconfig/ARToolKit${ARToolKit_LIB_SUFFIX}.pc DESTINATION lib/pkgconfig)
endif ()

if (MSVC)
  # Enable intrinsics on MSVC in debug mode
  # Not actually necessary in release mode since /O2 implies /Oi but can't easily add this per build type?
  add_definitions(/Oi)
endif (MSVC)

# generate artoolkitBuildSettings.h 
#configure_file(${ARToolKit_TEMPLATES_DIR}/artoolkitBuildSettings.h.in ${ARToolKit_BINARY_DIR}/include/artoolkitBuildSettings.h @ONLY)

#install(FILES ${ARToolKit_BINARY_DIR}/include/artoolkitBuildSettings.h DESTINATION include/ARToolKit)

install(FILES ${ARToolKit_INCLUDE_DIRS} DESTINATION include/ARToolKit)