Remove redundant PROJECT_SOURCE_DIR usage from CMake config.

Inspired by https://github.com/google/crc32c/pull/32

PiperOrigin-RevId: 278718367
This commit is contained in:
Victor Costan 2019-11-05 15:13:05 -08:00 committed by Victor Costan
parent f48c38f91a
commit 6617df53fa
1 changed files with 16 additions and 16 deletions

View File

@ -103,7 +103,7 @@ if(GFLAGS_FOUND)
endif(GFLAGS_FOUND) endif(GFLAGS_FOUND)
configure_file( configure_file(
"${PROJECT_SOURCE_DIR}/cmake/config.h.in" "cmake/config.h.in"
"${PROJECT_BINARY_DIR}/config.h" "${PROJECT_BINARY_DIR}/config.h"
) )
@ -130,18 +130,18 @@ if (SNAPPY_FUZZING_BUILD)
endif (SNAPPY_FUZZING_BUILD) endif (SNAPPY_FUZZING_BUILD)
configure_file( configure_file(
"${PROJECT_SOURCE_DIR}/snappy-stubs-public.h.in" "snappy-stubs-public.h.in"
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h") "${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
add_library(snappy "") add_library(snappy "")
target_sources(snappy target_sources(snappy
PRIVATE PRIVATE
"${PROJECT_SOURCE_DIR}/snappy-internal.h" "snappy-internal.h"
"${PROJECT_SOURCE_DIR}/snappy-stubs-internal.h" "snappy-stubs-internal.h"
"${PROJECT_SOURCE_DIR}/snappy-c.cc" "snappy-c.cc"
"${PROJECT_SOURCE_DIR}/snappy-sinksource.cc" "snappy-sinksource.cc"
"${PROJECT_SOURCE_DIR}/snappy-stubs-internal.cc" "snappy-stubs-internal.cc"
"${PROJECT_SOURCE_DIR}/snappy.cc" "snappy.cc"
"${PROJECT_BINARY_DIR}/config.h" "${PROJECT_BINARY_DIR}/config.h"
# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install". # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
@ -175,8 +175,8 @@ if(SNAPPY_BUILD_TESTS)
add_executable(snappy_unittest "") add_executable(snappy_unittest "")
target_sources(snappy_unittest target_sources(snappy_unittest
PRIVATE PRIVATE
"${PROJECT_SOURCE_DIR}/snappy_unittest.cc" "snappy_unittest.cc"
"${PROJECT_SOURCE_DIR}/snappy-test.cc" "snappy-test.cc"
) )
target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H) target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES}) target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})
@ -204,7 +204,7 @@ endif(SNAPPY_BUILD_TESTS)
if(SNAPPY_FUZZING_BUILD) if(SNAPPY_FUZZING_BUILD)
add_executable(snappy_compress_fuzzer "") add_executable(snappy_compress_fuzzer "")
target_sources(snappy_compress_fuzzer target_sources(snappy_compress_fuzzer
PRIVATE "${PROJECT_SOURCE_DIR}/snappy_compress_fuzzer.cc" PRIVATE "snappy_compress_fuzzer.cc"
) )
target_link_libraries(snappy_compress_fuzzer snappy) target_link_libraries(snappy_compress_fuzzer snappy)
set_target_properties(snappy_compress_fuzzer set_target_properties(snappy_compress_fuzzer
@ -213,7 +213,7 @@ if(SNAPPY_FUZZING_BUILD)
add_executable(snappy_uncompress_fuzzer "") add_executable(snappy_uncompress_fuzzer "")
target_sources(snappy_uncompress_fuzzer target_sources(snappy_uncompress_fuzzer
PRIVATE "${PROJECT_SOURCE_DIR}/snappy_uncompress_fuzzer.cc" PRIVATE "snappy_uncompress_fuzzer.cc"
) )
target_link_libraries(snappy_uncompress_fuzzer snappy) target_link_libraries(snappy_uncompress_fuzzer snappy)
set_target_properties(snappy_uncompress_fuzzer set_target_properties(snappy_uncompress_fuzzer
@ -230,9 +230,9 @@ install(TARGETS snappy
) )
install( install(
FILES FILES
"${PROJECT_SOURCE_DIR}/snappy-c.h" "snappy-c.h"
"${PROJECT_SOURCE_DIR}/snappy-sinksource.h" "snappy-sinksource.h"
"${PROJECT_SOURCE_DIR}/snappy.h" "snappy.h"
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h" "${PROJECT_BINARY_DIR}/snappy-stubs-public.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
) )
@ -249,7 +249,7 @@ install(
) )
install( install(
FILES FILES
"${PROJECT_SOURCE_DIR}/cmake/SnappyConfig.cmake" "cmake/SnappyConfig.cmake"
"${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake" "${PROJECT_BINARY_DIR}/SnappyConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Snappy"
) )