diff --git a/3rdparty/mexplus/CMakeLists.txt b/3rdparty/mexplus/CMakeLists.txt
index 785624ea26..b2685d889a 100644
--- a/3rdparty/mexplus/CMakeLists.txt
+++ b/3rdparty/mexplus/CMakeLists.txt
@@ -2,6 +2,6 @@ project( mexplus )
# Code below is just for accessibility issues in IDE editor
# List all files (headers) contained by mexplus library
-file(GLOB_RECURSE all_mexplus_files RELATIVE "${CMAKE_SOURCE_DIR}/3rdparty/mexplus" *.h *.hpp)
+file(GLOB_RECURSE all_mexplus_files RELATIVE "${MRPT_SOURCE_DIR}/3rdparty/mexplus" *.h *.hpp)
# Visualize the files of this directory in IDE creating an custom empty target
add_custom_target(mexplus DEPENDS ${all_mexplus_files} SOURCES ${all_mexplus_files})
diff --git a/cmakemodules/DeclareMRPTLib.cmake b/cmakemodules/DeclareMRPTLib.cmake
index 43af29c3fc..ee06849a74 100644
--- a/cmakemodules/DeclareMRPTLib.cmake
+++ b/cmakemodules/DeclareMRPTLib.cmake
@@ -124,13 +124,13 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
#
# For code simplicity, let's use the same list, just adding the default sources there:
list(APPEND ${name}_EXTRA_SRCS
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/*.cpp"
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/*.c"
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/*.cxx"
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/*.h"
- "${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.h"
- "${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.hpp"
- "${CMAKE_SOURCE_DIR}/doc/doxygen-pages/lib_mrpt_${name}.h"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/*.cpp"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/*.c"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/*.cxx"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/*.h"
+ "${MRPT_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.h"
+ "${MRPT_SOURCE_DIR}/libs/${name}/include/mrpt/${name}/*.hpp"
+ "${MRPT_SOURCE_DIR}/doc/doxygen-pages/lib_mrpt_${name}.h"
)
list(APPEND ${name}_EXTRA_SRCS_NAME
"${name}"
@@ -144,7 +144,7 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
# Only add these ones for "normal" libraries:
if (NOT ${headers_only})
list(APPEND ${name}_EXTRA_SRCS
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/registerAllClasses.cpp"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/registerAllClasses.cpp"
)
list(APPEND ${name}_EXTRA_SRCS_NAME
"Class register"
@@ -214,8 +214,8 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
set(all_${name}_srcs ${${name}_srcs})
# Add main lib header (may not exist in meta-libs only):
- if (EXISTS "${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}.h")
- set(all_${name}_srcs ${all_${name}_srcs} "${CMAKE_SOURCE_DIR}/libs/${name}/include/mrpt/${name}.h")
+ if (EXISTS "${MRPT_SOURCE_DIR}/libs/${name}/include/mrpt/${name}.h")
+ set(all_${name}_srcs ${all_${name}_srcs} "${MRPT_SOURCE_DIR}/libs/${name}/include/mrpt/${name}.h")
endif ()
if (NOT ${headers_only})
@@ -227,7 +227,7 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
# private include dirs for this lib:
target_include_directories(${name} PRIVATE
- $ # To include ${name}-precomp.h
+ $ # To include ${name}-precomp.h
)
if(MSVC) # Define math constants if built with MSVC
target_compile_definitions(${name} PUBLIC _USE_MATH_DEFINES)
@@ -358,7 +358,7 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
COMPILE_FLAGS "/Yu${name}-precomp.h")
# But for the file used to build the precomp. header:
- set_source_files_properties("${CMAKE_SOURCE_DIR}/libs/${name}/src/${name}-precomp.cpp"
+ set_source_files_properties("${MRPT_SOURCE_DIR}/libs/${name}/src/${name}-precomp.cpp"
PROPERTIES
COMPILE_FLAGS "/Yc${name}-precomp.h")
else()
@@ -371,7 +371,7 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
set_target_properties(${name} PROPERTIES
COTIRE_PREFIX_HEADER_IGNORE_PATH "${COTIRE_PREFIX_HEADER_IGNORE_PATH}"
)
- set_target_properties(${name} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${CMAKE_SOURCE_DIR}/libs/${name}/src/${name}-precomp.h")
+ set_target_properties(${name} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${MRPT_SOURCE_DIR}/libs/${name}/src/${name}-precomp.h")
cotire(${name})
if($ENV{VERBOSE})
@@ -385,8 +385,8 @@ macro(internal_define_mrpt_lib name headers_only is_metalib)
endif()
source_group("Precompiled headers" FILES
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/${name}-precomp.cpp"
- "${CMAKE_SOURCE_DIR}/libs/${name}/src/${name}-precomp.h"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/${name}-precomp.cpp"
+ "${MRPT_SOURCE_DIR}/libs/${name}/src/${name}-precomp.h"
)
endif()
diff --git a/cmakemodules/script_create_config_h.cmake b/cmakemodules/script_create_config_h.cmake
index 04c72bc050..d0ae177aab 100644
--- a/cmakemodules/script_create_config_h.cmake
+++ b/cmakemodules/script_create_config_h.cmake
@@ -13,4 +13,4 @@ set(MRPT_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/mrpt-configuration
file(MAKE_DIRECTORY "${MRPT_CONFIG_FILE_INCLUDE_DIR}")
file(MAKE_DIRECTORY "${MRPT_CONFIG_FILE_INCLUDE_DIR}/mrpt")
-configure_file("${CMAKE_SOURCE_DIR}/parse-files/config.h.in" "${MRPT_CONFIG_FILE_INCLUDE_DIR}/mrpt/config.h")
+configure_file("${MRPT_SOURCE_DIR}/parse-files/config.h.in" "${MRPT_CONFIG_FILE_INCLUDE_DIR}/mrpt/config.h")
diff --git a/cmakemodules/script_create_version_h.cmake b/cmakemodules/script_create_version_h.cmake
index 2307bae8df..f2ddbbfb3a 100644
--- a/cmakemodules/script_create_version_h.cmake
+++ b/cmakemodules/script_create_version_h.cmake
@@ -46,7 +46,7 @@ if ("" STREQUAL "${CMAKE_SOURCE_DATE_EPOCH}")
endif()
-configure_file("${CMAKE_SOURCE_DIR}/parse-files/version.h.in" "${MRPT_CONFIG_FILE_INCLUDE_DIR}/mrpt/version.h")
+configure_file("${MRPT_SOURCE_DIR}/parse-files/version.h.in" "${MRPT_CONFIG_FILE_INCLUDE_DIR}/mrpt/version.h")
# Prepare version.rc for Windows apps:
diff --git a/cmakemodules/script_matlab.cmake b/cmakemodules/script_matlab.cmake
index a1065bb8d3..53be7e7622 100644
--- a/cmakemodules/script_matlab.cmake
+++ b/cmakemodules/script_matlab.cmake
@@ -73,11 +73,11 @@ endif(NOT CMAKE_MRPT_HAS_MATLAB)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Copy all .m files (classes, samples, helpers...) to the build directory
-file(COPY ${CMAKE_SOURCE_DIR}/mex/+mrpt DESTINATION ${CMAKE_BINARY_DIR}/mex)
-file(COPY ${CMAKE_SOURCE_DIR}/mex/samples DESTINATION ${CMAKE_BINARY_DIR}/mex)
+file(COPY ${MRPT_SOURCE_DIR}/mex/+mrpt DESTINATION ${CMAKE_BINARY_DIR}/mex)
+file(COPY ${MRPT_SOURCE_DIR}/mex/samples DESTINATION ${CMAKE_BINARY_DIR}/mex)
# Copy setup file and README
-file(COPY ${CMAKE_SOURCE_DIR}/mex/mrpt_setup.m DESTINATION ${CMAKE_BINARY_DIR}/mex)
-file(COPY ${CMAKE_SOURCE_DIR}/mex/README.txt DESTINATION ${CMAKE_BINARY_DIR}/mex)
+file(COPY ${MRPT_SOURCE_DIR}/mex/mrpt_setup.m DESTINATION ${CMAKE_BINARY_DIR}/mex)
+file(COPY ${MRPT_SOURCE_DIR}/mex/README.txt DESTINATION ${CMAKE_BINARY_DIR}/mex)
endif(NOT DISABLE_MATLAB)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 7aae05ebc4..5eba4f3026 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -4,11 +4,11 @@ project(documentation)
# Dummy documentation target for showing grouped files in IDEs:
# ----------------------------------------------------------------------------
-file(GLOB_RECURSE RST_FILES "${CMAKE_SOURCE_DIR}/doc/*.rst")
-file(GLOB_RECURSE MD_FILES "${CMAKE_SOURCE_DIR}/doc/*.md")
-file(GLOB_RECURSE H_FILES "${CMAKE_SOURCE_DIR}/doc/sources/*.h")
+file(GLOB_RECURSE RST_FILES "${MRPT_SOURCE_DIR}/doc/*.rst")
+file(GLOB_RECURSE MD_FILES "${MRPT_SOURCE_DIR}/doc/*.md")
+file(GLOB_RECURSE H_FILES "${MRPT_SOURCE_DIR}/doc/sources/*.h")
set(DOC_INDIV_FILES
- "${CMAKE_SOURCE_DIR}/README.md"
+ "${MRPT_SOURCE_DIR}/README.md"
)
set(all_docs_files ${RST_FILES} ${H_FILES} ${DOC_INDIV_FILES} ${MD_FILES})
add_custom_target(DocumentationFiles DEPENDS ${all_docs_files} SOURCES ${all_docs_files})
diff --git a/libs/math/CMakeLists.txt b/libs/math/CMakeLists.txt
index be60fbd59d..63b613083d 100644
--- a/libs/math/CMakeLists.txt
+++ b/libs/math/CMakeLists.txt
@@ -15,7 +15,7 @@ list(APPEND math_EXTRA_SRCS_NAME "math/kmeans" "math/kmeans")
# debug visualizer for Eigen matrices
if (MSVC AND MSVC_VERSION GREATER 1800) # VS>= 2013
- list(APPEND math_EXTRA_SRCS "${CMAKE_SOURCE_DIR}/debug/*.natvis")
+ list(APPEND math_EXTRA_SRCS "${MRPT_SOURCE_DIR}/debug/*.natvis")
list(APPEND math_EXTRA_SRCS_NAME "MSVC debug natvis")
endif()
diff --git a/libs/system/include/mrpt/system/filesystem.h b/libs/system/include/mrpt/system/filesystem.h
index f7f734b6fa..cb30362edf 100644
--- a/libs/system/include/mrpt/system/filesystem.h
+++ b/libs/system/include/mrpt/system/filesystem.h
@@ -40,7 +40,7 @@ std::string getcwd();
/** Attempts to find the directory `[PREFIX/]share/mrpt/` and returns its
* absolute path, or empty string if not found.
* Example return paths: Linux after installing = `/usr/share/mrpt/`;
- * manually-built system = `[CMAKE_SOURCE_DIR]/share/mrpt/`, etc. */
+ * manually-built system = `[MRPT_SOURCE_DIR]/share/mrpt/`, etc. */
std::string getShareMRPTDir();
/** Creates a directory
diff --git a/parse-files/mrpt_paths_config.h.in b/parse-files/mrpt_paths_config.h.in
index fe030ba9bd..e60c12864e 100644
--- a/parse-files/mrpt_paths_config.h.in
+++ b/parse-files/mrpt_paths_config.h.in
@@ -13,6 +13,6 @@
#pragma once
-#define MRPT_SOURCE_BASE_DIRECTORY "${CMAKE_SOURCE_DIR}"
+#define MRPT_SOURCE_BASE_DIRECTORY "${MRPT_SOURCE_DIR}"
#define MRPT_INSTALL_PREFIX_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
diff --git a/parse-files/version.h.in b/parse-files/version.h.in
index 3e943ce45b..b722517700 100644
--- a/parse-files/version.h.in
+++ b/parse-files/version.h.in
@@ -13,7 +13,7 @@ const char MRPT_version_str[] = "${CMAKE_MRPT_COMPLETE_NAME}";
// See specs: https://reproducible-builds.org/specs/source-date-epoch/
const char MRPT_SOURCE_DATE_EPOCH[] = "${CMAKE_SOURCE_DATE_EPOCH}";
-const char MRPT_CMAKE_SOURCE_DIR[] = "${CMAKE_SOURCE_DIR}";
+const char MRPT_CMAKE_SOURCE_DIR[] = "${MRPT_SOURCE_DIR}";
const char MRPT_CMAKE_INSTALL_PREFIX[] = "${CMAKE_INSTALL_PREFIX}";
#endif