From 152eba5c1b32bab5fa54875c1ae434383592cd30 Mon Sep 17 00:00:00 2001 From: Thilina Ratnayaka Date: Fri, 25 Oct 2024 17:19:35 -0500 Subject: [PATCH] Replace CMAKE_SOURCE_DIR by PROJECT_SOURCE_DIR --- CMakeLists.txt | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 112f00a1..8db85605 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,10 +120,10 @@ endif() find_program(CLANG_FORMAT NAMES clang-format) if (CLANG_FORMAT) add_custom_target(format - COMMAND ${CLANG_FORMAT} -i ${CMAKE_SOURCE_DIR}/*/*.[ch] + COMMAND ${CLANG_FORMAT} -i ${PROJECT_SOURCE_DIR}/*/*.[ch] COMMENT "Running clang-format ...") add_custom_target(format-check - COMMAND ${CLANG_FORMAT} --dry-run --Werror -i ${CMAKE_SOURCE_DIR}/*/*.[ch] + COMMAND ${CLANG_FORMAT} --dry-run --Werror -i ${PROJECT_SOURCE_DIR}/*/*.[ch] COMMENT "Running clang-format check ...") endif() @@ -131,7 +131,7 @@ endif() find_program(CLANG_TIDY NAMES clang-tidy) if (CLANG_TIDY) add_custom_target(tidy - COMMAND ${CLANG_TIDY} -p ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/*/*.[ch] + COMMAND ${CLANG_TIDY} -p ${CMAKE_BINARY_DIR} ${PROJECT_SOURCE_DIR}/*/*.[ch] COMMENT "Running clang-tidy ...") endif() @@ -139,18 +139,17 @@ endif() find_program(PYLINT NAMES pylint) if (PYLINT) add_custom_target(pylint - COMMAND ${PYLINT} ${CMAKE_SOURCE_DIR} --recursive yes --rcfile=${CMAKE_SOURCE_DIR}/pyproject.toml + COMMAND ${PYLINT} ${PROJECT_SOURCE_DIR} --recursive yes + --rcfile=${PROJECT_SOURCE_DIR}/pyproject.toml COMMENT "Running pylint ...") endif() # Add black as a custom target if available. find_program(BLACK NAMES black) if (BLACK) - add_custom_target(black - COMMAND ${BLACK} ${CMAKE_CURRENT_SOURCE_DIR}/ + add_custom_target(black COMMAND ${BLACK} ${PROJECT_SOURCE_DIR}/ COMMENT "Running black ...") - add_custom_target(black-check - COMMAND ${BLACK} --check ${CMAKE_CURRENT_SOURCE_DIR}/ + add_custom_target(black-check COMMAND ${BLACK} --check ${PROJECT_SOURCE_DIR}/ COMMENT "Running black check ...") endif() @@ -158,10 +157,10 @@ endif() find_program(ISORT NAMES isort) if (ISORT) add_custom_target(isort - COMMAND ${ISORT} ${CMAKE_CURRENT_SOURCE_DIR}/ + COMMAND ${ISORT} ${PROJECT_SOURCE_DIR}/ COMMENT "Running isort ...") add_custom_target(isort-check - COMMAND ${ISORT} --check-only ${CMAKE_CURRENT_SOURCE_DIR}/ + COMMAND ${ISORT} --check-only ${PROJECT_SOURCE_DIR}/ COMMENT "Running isort check ...") endif() @@ -169,7 +168,7 @@ endif() find_program(FLAKE8 NAMES flake8) if (FLAKE8) add_custom_target(flake8 - COMMAND ${FLAKE8} ${CMAKE_CURRENT_SOURCE_DIR}/ + COMMAND ${FLAKE8} ${PROJECT_SOURCE_DIR}/ COMMENT "Running flake8 ...") endif() @@ -180,13 +179,13 @@ install(TARGETS nomp EXPORT nomp-targets install(EXPORT nomp-targets FILE nomp-targets.cmake NAMESPACE nomp:: DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/nomp) include(CMakePackageConfigHelpers) -configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nomp-config.cmake.in +configure_package_config_file(cmake/nomp-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/nomp-config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/nomp) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/nomp-config.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/nomp) -install(DIRECTORY ${CMAKE_SOURCE_DIR}/python DESTINATION ${CMAKE_INSTALL_PREFIX}) +install(DIRECTORY python DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY scripts/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE