Skip to content

Commit

Permalink
add BUILD_SHRED_LIBS instead of depreacted build of static and dynami…
Browse files Browse the repository at this point in the history
…c lib in one config
  • Loading branch information
gittiver committed Nov 5, 2024
1 parent 4678c56 commit 68068cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ Module.symvers
Mkfile.old
dkms.conf
build
/.vs
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ enable_language(C)
include(ExternalProject)

option(SQLITE3_WITH_SHELL "build sqlite3 executable" OFF)
option(SQLITE3_STATIC_LIB "build sqlite3 static library" ON)
option(SQLITE3_SHARED_LIB "build sqlite3 shared library" OFF)
option(BUILD_SHARED_LIBS "build sqlite3 shared or static library" OFF)
option(SQLITE3_USE_SHARED_CRT "use shared crt library" ON)
option(SQLITE3_ENABLE_MATH_FUNCTIONS "enable SQL math functions" ON)

Expand Down Expand Up @@ -64,22 +63,13 @@ add_custom_command(
DEPENDS sqlite3-src
)

add_library(sqlite3 STATIC ${SQLITE3_SOURCES})
add_library(sqlite3 ${SQLITE3_SOURCES})
target_include_directories(sqlite3 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite3)
set_property(TARGET sqlite3 PROPERTY POSITION_INDEPENDENT_CODE ON)
if (SQLITE3_ENABLE_MATH_FUNCTIONS)
target_compile_definitions(sqlite3 PUBLIC SQLITE_ENABLE_MATH_FUNCTIONS)
endif (SQLITE3_ENABLE_MATH_FUNCTIONS)

add_library(sqlite3-shared SHARED ${SQLITE3_SOURCES})
if (SQLITE3_ENABLE_MATH_FUNCTIONS)
target_compile_definitions(sqlite3-shared PUBLIC SQLITE_ENABLE_MATH_FUNCTIONS)
endif (SQLITE3_ENABLE_MATH_FUNCTIONS)

set_target_properties(sqlite3-shared
PROPERTIES OUTPUT_NAME sqlite3)
target_include_directories(sqlite3-shared INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlite3)

if(SQLITE3_WITH_SHELL)
add_executable(sqlite3-bin ${SQLITE3_SHELL_SOURCES})
target_link_libraries(sqlite3-bin sqlite3)
Expand All @@ -95,5 +85,4 @@ install(TARGETS sqlite3
INCLUDES DESTINATION include
)
export(TARGETS sqlite3 FILE sqlite3.cmake)
export(TARGETS sqlite3-shared FILE sqlite3-shared.cmake)
export(PACKAGE sqlite3)

0 comments on commit 68068cb

Please sign in to comment.