######################################################################
# Automatically generated by cppiniter {{{date_time}}}
######################################################################

{{#is_exe}}
add_executable({{{project_name}}})
{{/is_exe}}
{{^is_exe}}
add_library({{{project_name}}})

if(BUILD_SHARED_LIBS)
    target_compile_definitions({{{project_name}}} PRIVATE {{{project_name_uppercase}}}_DLL {{{project_name_uppercase}}}_DLL_EXPORTS)
endif()
{{/is_exe}}

target_include_directories({{{project_name}}} PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_BINARY_DIR})

{{#is_exe}}
configure_file(${CMAKE_CURRENT_LIST_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
{{/is_exe}}
{{^is_exe}}
configure_file(${CMAKE_CURRENT_LIST_DIR}/{{{project_name}}}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
{{/is_exe}}

file(GLOB_RECURSE SRC "*.h" "*.hpp" "*.cpp")
target_sources({{{project_name}}} PRIVATE ${SRC})

find_package(fmt REQUIRED CONFIG)

target_link_libraries({{{project_name}}} fmt::fmt)

{{#is_exe}}
if(LINUX)
    set_target_properties({{{project_name}}} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
elseif(APPLE)
    set_target_properties({{{project_name}}} PROPERTIES INSTALL_RPATH "@executable_path/../lib")
endif()
{{/is_exe}}
{{^is_exe}}
if(LINUX)
    set_target_properties({{{project_name}}} PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
{{/is_exe}}
INSTALL(TARGETS {{{project_name}}}
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib)

if(MSVC AND BUILD_SHARED_LIBS)
    install(FILES $<TARGET_PDB_FILE:{{{project_name}}}> DESTINATION lib)
endif()
