Skip to content

Commit

Permalink
Replace CMAKE_SOURCE_DIR by PROJECT_SOURCE_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinarmtb committed Oct 25, 2024
1 parent 2e2d68c commit fc956af
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,56 +120,55 @@ 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()

# Add clang-tidy as a custom target if available.
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()

# Add pylint as a custom target if available.
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()

# Add isort as a custom target if available.
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()

# Add flake8 as a custom target if available.
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()

Expand All @@ -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
Expand Down

0 comments on commit fc956af

Please sign in to comment.