Allow passing libraries to qt_config_compile_test
Fixes cxx11_future and ipc_posix tests Change-Id: I0f3a7b1a0452724c07198a87c2fc25344e7451eb Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
parent
bb0deccf19
commit
2ce3f440f9
@ -385,9 +385,12 @@ function(qt_feature_module_end target)
|
||||
endfunction()
|
||||
|
||||
function(qt_config_compile_test name)
|
||||
cmake_parse_arguments(arg "" "LABEL" "" ${ARGN})
|
||||
cmake_parse_arguments(arg "" "LABEL" "LIBRARIES;CODE" ${ARGN})
|
||||
|
||||
check_cxx_source_compiles("${arg_UNPARSED_ARGUMENTS}" HAVE_${name})
|
||||
set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${arg_LIBRARIES}")
|
||||
check_cxx_source_compiles("${arg_UNPARSED_ARGUMENTS} ${arg_CODE}" HAVE_${name})
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${_save_CMAKE_REQUIRED_LIBRARIES}")
|
||||
set(TEST_${name} "${HAVE_${name}}" CACHE INTERNAL "${arg_LABEL}")
|
||||
endfunction()
|
||||
|
||||
|
@ -112,8 +112,13 @@ int pipes[2];
|
||||
")
|
||||
|
||||
# cxx11_future
|
||||
if (UNIX)
|
||||
set(CXX11_FUTURE_TEST_LIBRARIES pthread)
|
||||
endif()
|
||||
qt_config_compile_test(cxx11_future
|
||||
LABEL "C++11 <future>"
|
||||
LIBRARIES ${CXX11_FUTURE_TEST_LIBRARIES}
|
||||
CODE
|
||||
"
|
||||
#include <future>
|
||||
|
||||
@ -126,7 +131,7 @@ std::future<int> f = std::async([]() { return 42; });
|
||||
/* END TEST: */
|
||||
return 0;
|
||||
}
|
||||
"# FIXME: qmake: unix:LIBS += -lpthread
|
||||
"
|
||||
)
|
||||
|
||||
# eventfd
|
||||
@ -190,8 +195,13 @@ shmctl(0, 0, (struct shmid_ds *)(0));
|
||||
")
|
||||
|
||||
# ipc_posix
|
||||
if (LINUX)
|
||||
set(IPC_POSIX_TEST_LIBRARIES pthread rt)
|
||||
endif()
|
||||
qt_config_compile_test(ipc_posix
|
||||
LABEL "POSIX IPC"
|
||||
LIBRARIES ${IPC_POSIX_TEST_LIBRARIES}
|
||||
CODE
|
||||
"
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
@ -208,7 +218,7 @@ shm_unlink(\"test\");
|
||||
/* END TEST: */
|
||||
return 0;
|
||||
}
|
||||
"# FIXME: qmake: linux: LIBS += -lpthread -lrt
|
||||
"
|
||||
)
|
||||
|
||||
# linkat
|
||||
|
Loading…
x
Reference in New Issue
Block a user