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

CMake issue when using this project as dependency #115

Open
GuillaumeDua opened this issue Sep 21, 2020 · 2 comments · Fixed by #118
Open

CMake issue when using this project as dependency #115

GuillaumeDua opened this issue Sep 21, 2020 · 2 comments · Fixed by #118

Comments

@GuillaumeDua
Copy link

In the top-level CMakeLists, line 24 :

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")

Should be instead :

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")

With this quickfix, the current project can be now use with FetchContent or git submodules as a dependency ;)

@GuillaumeDua
Copy link
Author

Also, about includes directories, some are missing (still when using this project as dependency using FetchContent/ExternalProject_add/git-submodules/etc.)

Quick fix in the building section : add target_include_directories

################################################################################
# Building                                                                     #
################################################################################

build_module(NAME zkpp-tests
             PATH src/zk/tests
             LINK_LIBRARIES
               ${gtest_LIBRARIES}
            )
target_include_directories(zkpp-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) # <--- here

build_module(NAME zkpp
             PATH src/zk
             NO_RECURSE
             LINK_LIBRARIES
               ${zookeeper_LIBRARIES}
            )
target_include_directories(zkpp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) # <--- here

build_module(NAME zkpp-server
             PATH src/zk/server
             LINK_LIBRARIES
               zkpp
            )
target_include_directories(zkpp-server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) # <--- here

Also, it might be cleaner to split .cpp and .hpp files. So .cpp files won't be part of the include interface

@tgockel
Copy link
Owner

tgockel commented Sep 22, 2020

I'm going to write some better testing around this.

@tgockel tgockel reopened this Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants