Skip to content

Commit

Permalink
CMake: Use PROJECT_SOURCE_DIR to improve using mosquitto as subdirectory
Browse files Browse the repository at this point in the history
When mosquitto is included as subdirectory, `CMAKE_SOURCE_DIR` does not refer to the mosquitto top level CMake file, but to the whole project top level CMake.
Use `PROJECT_SOURCE_DIR` instead to refer to the right CMake in both contextes.

Signed-off-by: Pierre Hallot <[email protected]>
  • Loading branch information
Hallot committed Apr 5, 2022
1 parent 74814cc commit 8504f6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cmake_policy(SET CMP0042 NEW)
project(mosquitto)
set (VERSION 2.0.14)

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

add_definitions (-DCMAKE -DVERSION=\"${VERSION}\")

Expand Down
8 changes: 4 additions & 4 deletions man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ if(NOT WIN32)
find_program(XSLTPROC xsltproc OPTIONAL)
if(XSLTPROC)
function(compile_manpage page)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/man/${page}
COMMAND xsltproc ${CMAKE_SOURCE_DIR}/man/${page}.xml -o ${CMAKE_SOURCE_DIR}/man/
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/man/${page}.xml)
add_custom_target(${page} ALL DEPENDS ${CMAKE_SOURCE_DIR}/man/${page})
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/man/${page}
COMMAND xsltproc ${PROJECT_SOURCE_DIR}/man/${page}.xml -o ${PROJECT_SOURCE_DIR}/man/
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/man/${page}.xml)
add_custom_target(${page} ALL DEPENDS ${PROJECT_SOURCE_DIR}/man/${page})
endfunction()

compile_manpage("mosquitto_ctrl.1")
Expand Down

0 comments on commit 8504f6b

Please sign in to comment.