aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules/UHDUnitTest.cmake
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2015-08-13 13:24:11 -0700
committerMartin Braun <martin.braun@ettus.com>2015-08-13 14:39:06 -0700
commit5c9fbf9d60677ed9fb5705e71bf845b727184efe (patch)
tree98dc6aef4265fac43dfd023d10c3e8950727663c /host/cmake/Modules/UHDUnitTest.cmake
parent2e4138d82a4ad33183a6cbff868b9e6c0d82f239 (diff)
downloaduhd-5c9fbf9d60677ed9fb5705e71bf845b727184efe.tar.gz
uhd-5c9fbf9d60677ed9fb5705e71bf845b727184efe.tar.bz2
uhd-5c9fbf9d60677ed9fb5705e71bf845b727184efe.zip
Remove CMake 3.0+ warnings
Diffstat (limited to 'host/cmake/Modules/UHDUnitTest.cmake')
-rw-r--r--host/cmake/Modules/UHDUnitTest.cmake39
1 files changed, 19 insertions, 20 deletions
diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake
index 76fec14b8..f3e848906 100644
--- a/host/cmake/Modules/UHDUnitTest.cmake
+++ b/host/cmake/Modules/UHDUnitTest.cmake
@@ -1,5 +1,5 @@
#
-# Copyright 2010-2012 Ettus Research LLC
+# Copyright 2010-2012,2015 Ettus Research LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,31 +18,30 @@
########################################################################
# Add a unit test and setup the environment for a unit test.
# Takes the same arguments as the ADD_TEST function.
-#
-# Before calling set the following variables:
-# UHD_TEST_TARGET_DEPS - built targets for the library path
-# UHD_TEST_LIBRARY_DIRS - directories for the library path
########################################################################
function(UHD_ADD_TEST test_name)
#Ensure that the build exe also appears in the PATH.
list(APPEND UHD_TEST_TARGET_DEPS ${ARGN})
- #In the land of windows, all libraries must be in the PATH.
- #Since the dependent libraries are not yet installed,
- #we must manually set them in the PATH to run tests.
- #The following appends the path of a target dependency.
- foreach(target ${UHD_TEST_TARGET_DEPS})
- get_target_property(location ${target} LOCATION)
- if(location)
- get_filename_component(path ${location} PATH)
- string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path})
- list(APPEND UHD_TEST_LIBRARY_DIRS ${path})
- endif(location)
- endforeach(target)
-
- file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir)
- file(TO_NATIVE_PATH "${UHD_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list?
+ #We need to put the directory with the .so/.dll file in the
+ #appropriate environment variable, as well as the test
+ #directory itself.
+ if(WIN32)
+ set(UHD_TEST_LIBRARY_DIRS
+ "${Boost_LIBRARY_DIRS}"
+ "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}"
+ "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}"
+ )
+ else()
+ set(UHD_TEST_LIBRARY_DIRS
+ "${Boost_LIBRARY_DIRS}"
+ "${CMAKE_BINARY_DIR}/lib"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ )
+ endif(WIN32)
+
+ file(TO_NATIVE_PATH "${UHD_TEST_LIBRARY_DIRS}" libpath)
#http://www.cmake.org/pipermail/cmake/2009-May/029464.html
#Replaced this add test + set environs code with the shell script generation.