find_package(Threads REQUIRED)

add_library(hmap STATIC
  src/bsp.cpp
  src/capi.cpp
  src/compile.cpp
  src/entdefs.cpp
  src/fbx.cpp
  src/geometry.cpp
  src/io.cpp
  src/map.cpp
  src/sample.cpp)
add_library(hmap::hmap ALIAS hmap)

target_include_directories(hmap PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)
target_compile_features(hmap PUBLIC cxx_std_17)
target_link_libraries(hmap PUBLIC Threads::Threads)
if(MSVC)
  target_compile_options(hmap PRIVATE /W3 /utf-8)
else()
  target_compile_options(hmap PRIVATE -Wall -Wextra)
endif()

install(TARGETS hmap EXPORT hmapTargets ARCHIVE DESTINATION lib)
install(DIRECTORY include/ DESTINATION include)
