# CMake script to build tandemng (X!Tandem fork)
# Author: Olivier Langella
# Created: 27/06/2023


#configure_file(${CMAKE_SOURCE_DIR}/src/config.h.cmake ${CMAKE_SOURCE_DIR}/src/config.h)

# prepare for next change to :
# merge ../src/saxtandeminputhandler.h ../src/2015/saxtandeminputhandler.h
# and merge ../src/saxtandeminputhandler.cpp ../src/2015/saxtandeminputhandler.cpp
# => same file between tandem versions


# File list
file(GLOB CPP_FILES ${CMAKE_SOURCE_DIR}/src/lib/*.cpp ${CMAKE_SOURCE_DIR}/src/*.cpp)

#message("i2MassChroQ_SRCS:  ${i2MassChroQ_SRCS}")
configure_file(${CMAKE_SOURCE_DIR}/src/common.h.cmake ${CMAKE_SOURCE_DIR}/src/common.h)


if(UNIX AND NOT APPLE)

  add_executable(tandemng ${CPP_FILES})

elseif(APPLE)

elseif(MXE)

  add_executable(tandemng ${CPP_FILES})

  target_compile_options(${TARGET} PRIVATE -mwindows)
  set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "-Wl,--subsystem,windows ${CMAKE_EXE_LINKER_FLAGS}")
  target_compile_options(tandemng PRIVATE -mwindows)
  set_target_properties(tandemng PROPERTIES LINK_FLAGS "-Wl,--subsystem,windows ${CMAKE_EXE_LINKER_FLAGS}")

endif()

target_compile_definitions(tandemng PUBLIC HEADER2017)
#-lpthread -L/usr/lib -lm -lexpat
target_link_libraries(tandemng
  Threads::Threads
  EXPAT::EXPAT
  Qt6::Core
  Qt6::Xml
  Qt6::Sql
  Qt6::Qml
  PappsoMSpp::Core
)

target_include_directories(tandemng PUBLIC
  $<INSTALL_INTERFACE:include/>
)



install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET} DESTINATION bin)
