CMake: fix importing with add_subdirectory command

This commit is contained in:
evpobr 2017-04-25 16:58:46 +05:00 committed by Erik de Castro Lopo
parent 9ebb96ca72
commit 54dc330215
3 changed files with 14 additions and 14 deletions

View File

@ -300,9 +300,9 @@ if (BUILD_STATIC_LIBS)
add_library (${SNDFILE_STATIC_TARGET} STATIC ${libsndfile_SOURCES})
target_include_directories(${SNDFILE_STATIC_TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
if (LIBM_REQUIRED)
target_link_libraries (${SNDFILE_STATIC_TARGET} PUBLIC ${M_LIBRARY})
endif ()
@ -345,9 +345,9 @@ if (BUILD_SHARED_LIBS)
add_library(${SNDFILE_SHARED_TARGET} SHARED ${libsndfile_SOURCES})
target_include_directories(${SNDFILE_SHARED_TARGET}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
if (LIBM_REQUIRED)
target_link_libraries (${SNDFILE_SHARED_TARGET} PRIVATE ${M_LIBRARY})
@ -626,14 +626,14 @@ if (ENABLE_PACKAGE_CONFIG)
write_basic_package_version_file (LibSndFileConfigVersion.cmake COMPATIBILITY SameMajorVersion)
configure_package_config_file (
${CMAKE_SOURCE_DIR}/cmake/LibSndFileConfig.cmake.in
cmake/LibSndFileConfig.cmake.in
LibSndFileConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
install(EXPORT LibSndFileTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
install(FILES
${CMAKE_BINARY_DIR}/LibSndFileConfig.cmake
${CMAKE_BINARY_DIR}/LibSndFileConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_PACKAGEDIR})
@ -716,7 +716,7 @@ if (BUILD_TESTING)
# utils static library
add_library(test_utils STATIC tests/utils.c)
target_link_libraries(test_utils PUBLIC ${SNDFILE_STATIC_TARGET})
target_include_directories(test_utils PUBLIC "${CMAKE_BINARY_DIR}/tests")
target_include_directories(test_utils PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/tests")
### test_main

View File

@ -5,12 +5,12 @@ set(AUTOGEN_SCRIPT "${CMAKE_MODULE_PATH}/CMakeAutoGenScript.cmake")
function(lsf_autogen DIR_REL NAME_WE)
set(EXTS ${ARGN})
set(INPUT "${CMAKE_SOURCE_DIR}/${DIR_REL}/${NAME_WE}.def")
set(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_REL}/${NAME_WE}.def")
set(OUTPUTS)
foreach(EXT ${EXTS})
list(APPEND OUTPUTS "${NAME_WE}.${EXT}")
endforeach()
add_autogen_target("${INPUT}" "${DIR_REL}" ${OUTPUTS})
add_autogen_target("${INPUT}" "${CMAKE_CURRENT_BINARY_DIR}/${DIR_REL}" ${OUTPUTS})
endfunction()
function(add_autogen_target INPUT OUTPUTDIR)

View File

@ -2,7 +2,7 @@ macro (TEST_INLINE)
if (NOT DEFINED INLINE_CODE)
message (STATUS "Checking for inline...")
set (INLINE_KEYWORD "inline")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
try_compile (HAVE_INLINE "${CMAKE_CURRENT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
if (HAVE_INLINE)
@ -12,7 +12,7 @@ macro (TEST_INLINE)
message (STATUS "Checking for __inline...")
set (INLINE_KEYWORD "__inline")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
if (HAVE___INLINE)
@ -22,7 +22,7 @@ macro (TEST_INLINE)
message (STATUS "Checking for __inline__...")
set (INLINE_KEYWORD "__inline__")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
if (HAVE___INLINE)
@ -30,7 +30,7 @@ macro (TEST_INLINE)
message (STATUS "Checking for __inline__...")
set (INLINE_KEYWORD "__inline__")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInline.c.in ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TestInline.c)
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/cmake/TestInline.c)
try_compile (HAVE___INLINE__ "${CMAKE_CURRENT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
else ()