aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-02-12 09:14:10 +0100
committerAndreas Schneider <asn@cryptomilk.org>2015-02-12 16:59:22 +0100
commit8798b43ea565927b3dbdc387cd0649dc422cdcd8 (patch)
treee5e79218939830df73cb520d742ffa04c4fe247f /src/CMakeLists.txt
parentc180601e564bcbf2ec2d143963ca22a3effdb9fe (diff)
downloadcmocka-8798b43ea565927b3dbdc387cd0649dc422cdcd8.tar.gz
cmocka-8798b43ea565927b3dbdc387cd0649dc422cdcd8.tar.xz
cmocka-8798b43ea565927b3dbdc387cd0649dc422cdcd8.zip
cmake: Fix executing test examples on Windows.
The executable need the path to dll set so they can be run successfully. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4ab084e..6aa2741 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -54,18 +54,20 @@ add_library(${CMOCKA_SHARED_LIBRARY} SHARED ${cmocka_SRCS})
target_link_libraries(${CMOCKA_SHARED_LIBRARY} ${CMOCKA_LINK_LIBRARIES})
-set_target_properties(
- ${CMOCKA_SHARED_LIBRARY}
- PROPERTIES
- VERSION
- ${LIBRARY_VERSION}
- SOVERSION
- ${LIBRARY_SOVERSION}
- OUTPUT_NAME
- cmocka
- DEFINE_SYMBOL
- CMOCKA_EXPORTS
-)
+if (NOT WIN32)
+ set_target_properties(
+ ${CMOCKA_SHARED_LIBRARY}
+ PROPERTIES
+ VERSION
+ ${LIBRARY_VERSION}
+ SOVERSION
+ ${LIBRARY_SOVERSION}
+ OUTPUT_NAME
+ cmocka
+ DEFINE_SYMBOL
+ CMOCKA_EXPORTS
+ )
+endif (NOT WIN32)
install(
TARGETS ${CMOCKA_SHARED_LIBRARY}
@@ -96,3 +98,17 @@ if (WITH_STATIC_LIB)
)
endif (WITH_STATIC_LIB)
+if (POLICY CMP0026)
+ cmake_policy(SET CMP0026 OLD)
+endif()
+
+#
+# In order to run tests we will need to set the approriate environment
+# variable so that the test program can locate its dependent DLL's. First
+# we want to know what directory our dependent DLL was installed into:
+#
+get_target_property(_cmocka_dir cmocka_shared LOCATION_${CMOCKA_BUILD_TYPE})
+get_filename_component(_cmocka_path "${_cmocka_dir}" PATH)
+file(TO_NATIVE_PATH "${_cmocka_path}" _cmocka_path_native)
+
+set(CMOCKA_DLL_PATH "${_cmocka_path_native}" PARENT_SCOPE)