Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cmake variables to make submoduling the project easier #281

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

abelmul
Copy link

@abelmul abelmul commented May 31, 2020

That explains it

@abelmul abelmul changed the title Added cmake variables to make submoduleing the project easier Added cmake variables to make submoduling the project easier May 31, 2020
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ce44286 on abelmul:master into f0cd9e3 on SRombauts:master.

@SRombauts SRombauts self-assigned this Jun 1, 2020
@SRombauts
Copy link
Owner

SRombauts commented Jun 1, 2020

Hello, thanks for this proposal.

I think that what you should do here is use the provided Find SQLiteCpp cmake file instead, no?
find_package(SQLiteCpp 3 REQUIRED)

Cheers

@abelmul
Copy link
Author

abelmul commented Jun 1, 2020

To quote the readme file in order to submodule and add this library you have to do

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/thirdparty/SQLiteCpp)

include_directories(
  ${CMAKE_CURRENT_LIST_DIR}/thirdparty/SQLiteCpp/include
)

add_executable(main src/main.cpp)
target_link_libraries(main
  SQLiteCpp
  sqlite3
  pthread
  dl
  )

With this pull request you can do

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/thirdparty/SQLiteCpp)

include_directories(${SQLITECPP_INCLUDE_DIRS})
add_executable(main src/main.cpp)
target_link_libraries(main ${SQLITECPP_LIBRARIES)

I think it keeps application code clean.

@ChrisThrasher
Copy link

If linking multiple libraries is required then that hints at the fact that the SQLiteCpp target is missing some PUBLIC dependencies. That's the modern CMake solution and is preferable to the old school approach of having LIBNAME_INCLUDE_DIRS and LIBNAME_LIBRARIES variables.

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

Successfully merging this pull request may close these issues.

4 participants