Skip to content

Static library also requires target_include_directories #3

Closed

Description

@TheDoubleB

While trying to link against SQLite::sqlite3-static target, I came across a problem of my application not finding sqlite3.h header file. The issue is that sqlite3-static library in CMakeLists.txt target does not get assigned target_include_directories like sqlite3-shared does, and, subsequently, SQLite::sqlite3-static target in sqlite3Config.cmake does not get assigned INTERFACE_INCLUDE_DIRECTORIES. The fix is simple:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 405d654..611e921 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -506,6 +506,7 @@ if(ENABLE_STATIC)
     endif()
 
     add_library(sqlite3-static STATIC ${SQLITE3_LIB_SRC})
+    target_include_directories(sqlite3-static PUBLIC ${CMAKE_INSTALL_PREFIX}/include)
     set_target_properties(sqlite3-static PROPERTIES
         OUTPUT_NAME ${PROJECT_NAME}${NAME_FIX_DECORATOR})

Activity

  1. rhuijben commented on Apr 10, 2024

    @rhuijben
    Owner

    @TheDoubleB

    Can you turn this into a PR?

    That way I can properly record your fix

    // cc: @nono303

  2. rhuijben commented on May 29, 2024

    @rhuijben
    Owner

    Thanks. Sorry for the delay. Now merged to master, so should be in future tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions