### labnh library ###
add_library(labnh SHARED liblabnh.c)
set_target_properties(labnh PROPERTIES VERSION "1.0.0")
target_include_directories(labnh PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${EXT_INCLUDE_DIRS})
target_link_directories(labnh PUBLIC
        ${EXT_LIBRARY_DIRS})
target_link_libraries(labnh PUBLIC
        compiler_flags posstring
        ${EXT_LIBRARIES})
add_dependencies(labnh wcslib_simput)
add_dependencies(labnh posstring)

install(TARGETS labnh)
install(FILES labnh.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})


### posstring library ###
add_library(posstring SHARED libposstring.c)
set_target_properties(posstring PROPERTIES VERSION "1.0.0")
target_include_directories(posstring PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${EXT_INCLUDE_DIRS})
target_link_directories(posstring PUBLIC
        ${EXT_LIBRARY_DIRS})
target_link_libraries(posstring PUBLIC
        compiler_flags
        ${EXT_LIBRARIES})
add_dependencies(posstring wcslib_simput)

install(TARGETS posstring)
install(FILES posstring.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})


### labnh tool ###
add_executable(labnh_tool labnh.c labnh.h)
set_property(TARGET labnh_tool PROPERTY OUTPUT_NAME labnh)
target_include_directories(labnh_tool PUBLIC
        ${EXT_INCLUDE_DIRS})
target_link_directories(labnh_tool PUBLIC
        ${EXT_LIBRARY_DIRS})
target_link_libraries(labnh_tool PUBLIC
        compiler_flags
        ${EXT_LIBRARIES}
        simput labnh posstring)
add_dependencies(labnh_tool wcslib_simput)

install(TARGETS labnh_tool)
install(FILES labnh.par DESTINATION share/simput/pfiles)
