mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
simplify integration as a third-party lib in cmake projects
The CMAKE_SOURCE_DIR variable points to the top-level directory of a project while we want to point to the top-level directory of the lib. This change simplifies the integration as a third-party lib. We can use CMAKE_CURRENT_SOURCE_DIR or simply "nothing" ('.') to point to the directory where the CMakeLists.txt file resides.
This commit is contained in:
parent
a096c71db8
commit
4b32658d56
|
@ -10,7 +10,7 @@ set(PROJECT_VERSION_PATCH "2")
|
||||||
set(PROJECT_VERSION
|
set(PROJECT_VERSION
|
||||||
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${toxcore_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
@ -389,8 +389,8 @@ option(FORMAT_TEST "Require the format_test to be executed; fail cmake if it can
|
||||||
if(APIDSL AND ASTYLE)
|
if(APIDSL AND ASTYLE)
|
||||||
add_test(
|
add_test(
|
||||||
NAME format_test
|
NAME format_test
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/other/astyle/format-source
|
COMMAND ${toxcore_SOURCE_DIR}/other/astyle/format-source
|
||||||
"${CMAKE_SOURCE_DIR}"
|
"${toxcore_SOURCE_DIR}"
|
||||||
"${APIDSL}"
|
"${APIDSL}"
|
||||||
"${ASTYLE}")
|
"${ASTYLE}")
|
||||||
set_tests_properties(format_test PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}")
|
set_tests_properties(format_test PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}")
|
||||||
|
@ -531,38 +531,38 @@ string(REPLACE ";" " " toxcore_PKGCONFIG_LIBS "${toxcore_PKGCONFIG_LIBS}")
|
||||||
|
|
||||||
if(BUILD_TOXAV)
|
if(BUILD_TOXAV)
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/toxav.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/toxav.pc"
|
"${CMAKE_BINARY_DIR}/toxav.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/toxcore.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/toxcore.pc"
|
"${CMAKE_BINARY_DIR}/toxcore.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxdns.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/toxdns.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/toxdns.pc"
|
"${CMAKE_BINARY_DIR}/toxdns.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/toxencryptsave.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/toxencryptsave.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/toxencryptsave.pc"
|
"${CMAKE_BINARY_DIR}/toxencryptsave.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/libtoxcore.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/libtoxcore.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/libtoxcore.pc"
|
"${CMAKE_BINARY_DIR}/libtoxcore.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/other/pkgconfig/libtoxav.pc.in"
|
"${toxcore_SOURCE_DIR}/other/pkgconfig/libtoxav.pc.in"
|
||||||
"${CMAKE_BINARY_DIR}/libtoxav.pc"
|
"${CMAKE_BINARY_DIR}/libtoxav.pc"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
@ -599,8 +599,8 @@ find_program(SH NAMES sh dash bash zsh)
|
||||||
|
|
||||||
if(SH)
|
if(SH)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${SH} ${CMAKE_SOURCE_DIR}/other/version-sync
|
COMMAND ${SH} ${toxcore_SOURCE_DIR}/other/version-sync
|
||||||
${CMAKE_SOURCE_DIR}
|
${toxcore_SOURCE_DIR}
|
||||||
${PROJECT_VERSION_MAJOR}
|
${PROJECT_VERSION_MAJOR}
|
||||||
${PROJECT_VERSION_MINOR}
|
${PROJECT_VERSION_MINOR}
|
||||||
${PROJECT_VERSION_PATCH})
|
${PROJECT_VERSION_PATCH})
|
||||||
|
@ -642,7 +642,7 @@ endif()
|
||||||
|
|
||||||
if(STRICT_ABI AND SH)
|
if(STRICT_ABI AND SH)
|
||||||
if(BUILD_TOXAV)
|
if(BUILD_TOXAV)
|
||||||
make_version_script(${CMAKE_SOURCE_DIR}/toxav/toxav.h toxav toxav)
|
make_version_script(${toxcore_SOURCE_DIR}/toxav/toxav.h toxav toxav)
|
||||||
endif()
|
endif()
|
||||||
make_version_script(${CMAKE_SOURCE_DIR}/toxcore/tox.h tox toxcore)
|
make_version_script(${toxcore_SOURCE_DIR}/toxcore/tox.h tox toxcore)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user