cmake_minimum_required(VERSION 3.10) project(simple_object_storage) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # --- Static Linking & Musl Flags --- # Prioritize static libraries (.a) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # General flags often used for static musl builds set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static") # Also for shared libs if any were built # Optional: Force PIC for static libs if needed, though often handled by toolchain # set(CMAKE_POSITION_INDEPENDENT_CODE ON) # --- End Static Linking & Musl Flags --- # Find required packages (will now prefer .a files) find_package(SQLite3 REQUIRED) # Find all source files in src directory file(GLOB_RECURSE SOURCES "src/*.cpp" ) # Find all header files in src directory file(GLOB_RECURSE HEADERS "src/*.hpp" ) # Add include directories include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src ) # Create executable add_executable(simple_object_storage ${SOURCES}) # Link libraries (CMake should find static versions now) target_link_libraries(simple_object_storage SQLite::SQLite3 ) # Install target install(TARGETS simple_object_storage RUNTIME DESTINATION bin )