diff options
author | Philip Balister <philip@balister.org> | 2021-12-03 06:55:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 06:55:42 -0500 |
commit | f37a98b95af12603c4564f61707672570b3cce06 (patch) | |
tree | 29d9e2b28f31f5ddfcbb904b4af1fec44ab7eaee /cmake | |
parent | 76cdd1ce10c20d9b67801b23874257aff9616535 (diff) |
cmake: change how test files are build when cross compiling
* When cross compiling gnuradio, change how the test files are built.
Normally, the gnuradio QA code expects to run in the build tree. For the
cross compilng case, we cannot run the QA code during the build process.
The changes here allow the creation of an additional package that can be
installed on a target that will run the QA code against the installed
libraries.
Major changes are not using full paths to test files (since they include
paths that only exist on the build machine) and not setting environment
variables in the shell files to force the QA code to use code in the
build tree.
This patch disables the C++ only tests, these need some work and then they
can be added back for the cross compile case.
Signed-off-by: Philip Balister <philip@balister.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/GrTest.cmake | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake index 7be65492ee..9d75ece646 100644 --- a/cmake/Modules/GrTest.cmake +++ b/cmake/Modules/GrTest.cmake @@ -98,11 +98,13 @@ function(GR_ADD_TEST test_name) endif(CMAKE_CROSSCOMPILING) set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) file(WRITE ${sh_file} "#!${SHELL}\n") - #each line sets an environment variable - foreach(environ ${environs}) - file(APPEND ${sh_file} "export ${environ}\n") - endforeach(environ) - #load the command to run with its arguments + if (NOT CMAKE_CROSSCOMPILING) + #each line sets an environment variable + foreach(environ ${environs}) + file(APPEND ${sh_file} "export ${environ}\n") + endforeach(environ) + #load the command to run with its arguments + endif(CMAKE_CROSSCOMPILING) foreach(arg ${ARGN}) file(APPEND ${sh_file} "${arg} ") endforeach(arg) @@ -111,7 +113,7 @@ function(GR_ADD_TEST test_name) #make the shell file executable execute_process(COMMAND chmod +x ${sh_file}) - add_test(${test_name} ${SHELL} ${sh_file}) + add_test(${test_name} ${SHELL} ${test_name}_test.sh) endif(UNIX) if(WIN32) @@ -161,5 +163,7 @@ function(GR_ADD_CPP_TEST test_name test_source) set_target_properties(${test_name} PROPERTIES COMPILE_DEFINITIONS "BOOST_TEST_DYN_LINK;BOOST_TEST_MAIN" ) - GR_ADD_TEST(${test_name} ${test_name}) + IF (NOT CMAKE_CROSSCOMPILING) + GR_ADD_TEST(${test_name} ${test_name}) + ENDIF(CMAKE_CROSSCOMPILING) endfunction(GR_ADD_CPP_TEST) |