Skip to content

CMake issue when compiling redis3m as submodule (use CMake add_subdirectory) #49

Description

@zyy17

I use redis3m as git submodule in my project:

$ tree -L 1 ch1/
ch1/
├── build
├── CMakeCache.txt
├── CMakeFiles
├── cmake_install.cmake
├── CMakeLists.txt
├── gtest/
├── main.cc
├── Makefile
├── redis3m/
└── test

I add CMake add_subdirectory to compile redis3m:

add_subdirectory(redis3m)

Then I got the following error message:

[ 41%] Built target redis3m
make[2]: *** No rule to make target `Doxyfile', needed by `redis3m/docs'.  Stop.
make[1]: *** [redis3m/CMakeFiles/apidoc.dir/all] Error 2
make: *** [all] Error 2

I fix the error by changing CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR:

 FIND_PACKAGE(Doxygen QUIET)
 IF (DOXYGEN_FOUND)
-        SET(DOXYGEN_INPUT "${CMAKE_SOURCE_DIR}/Doxyfile")
+      SET(DOXYGEN_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile")
   SET(DOXYGEN_OUTPUT "docs")

I think CMAKE_CURRENT_SOURCE_DIR better than CMAKE_SOURCE_DIR when compiling redis3m in a project with multiple dependencies (When compiling redis3m alone, the two variable is same).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions