Skip to content

Commit

Permalink
Install and include MinGW library dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Deamon87 committed May 29, 2022
1 parent a554c78 commit 4036762
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ if (MSVC)
endif()

set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "")
if (WIN32 AND NOT MSVC)
add_compile_options(-fstack-protector)
endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/3rdparty/SQLiteCpp)

Expand All @@ -40,20 +43,17 @@ if (NOT MSVC)
else()
find_library(SSP_EXISTS ssp)
message("SSP_EXISTS = ${SSP_EXISTS}")
if (DL_EXISTS STREQUAL "SSP_EXISTS-NOTFOUND")
if (SSP_EXISTS STREQUAL "SSP_EXISTS-NOTFOUND")
error( "Neither DL nor SSP was found" )
endif()

message("Linking against SSP")

target_link_libraries(DBImporter ssp)

endif()
endif(NOT MSVC)





target_link_libraries(DBImporter
SQLiteCpp
sqlite3
Expand All @@ -65,3 +65,33 @@ if (NOT MSVC)
target_link_libraries(DBImporter stdc++fs)
endif()
endif()

#add_custom_command(TARGET DBImporter POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:DBImporter> $<TARGET_FILE_DIR:DBImporter>
# COMMAND_EXPAND_LISTS
# )

install(TARGETS DBImporter
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)

INSTALL(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT Libraries)

if( MINGW )
message( STATUS " Installing system-libraries: MinGW DLLs." )
get_filename_component( Mingw_Path ${CMAKE_CXX_COMPILER} PATH )
set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${Mingw_Path}/libgcc_s_seh-1.dll ${Mingw_Path}/libstdc++-6.dll ${Mingw_Path}/libssp-0.dll ${Mingw_Path}/libwinpthread-1.dll)
endif( MINGW )
include( InstallRequiredSystemLibraries )


# Actually install it when make install is called.
# Note, this works with CPack
if( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )
install( PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION bin COMPONENT System )
endif( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS )

include(CPack)

0 comments on commit 4036762

Please sign in to comment.