[waffle] [PATCH 8/8] cmake: misc fixes and cleanups

Emil Velikov emil.l.velikov at gmail.com
Mon Aug 4 07:34:23 PDT 2014


 - Windows libraries (DLLs) are runtime. Set RUNTIME_OUTPUT_DIRECTORY,
in order for Windows to pick up the DLL when running gl_basic_test.
 - gl_basic_test - add OUTPUT_DIRECTORY otherwise we end up with missing
DLL and cannot run it.
 - Execute the target rather than constructing the path/binary name, drop
unneeded DEPENDS as well.
 - Use target_link_libraries over depreciated link_libraries.

With these changes 'make check' and 'make check-func' no longer blows up
for Windows platforms and it even passes everything but
test_wcore_error_thread_local.

The test most likely fails as we create a new thread rather than fork()
the process. The latter does not have any straight-forward equivalent
and most of the current implementations use undocumented Win32 API.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/waffle/CMakeLists.txt       |  6 +++---
 tests/functional/CMakeLists.txt | 20 +++++++++++++-------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/waffle/CMakeLists.txt b/src/waffle/CMakeLists.txt
index be3d5e4..06fd64a 100644
--- a/src/waffle/CMakeLists.txt
+++ b/src/waffle/CMakeLists.txt
@@ -196,7 +196,8 @@ target_link_libraries(${waffle_libname} ${waffle_libdeps})
 set_target_properties(${waffle_libname}
     PROPERTIES
     PREFIX "lib"
-    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
+    LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
     SOVERSION ${waffle_soversion}
     VERSION ${waffle_soversion}.${waffle_minor_version}.${waffle_patch_version}
     )
@@ -259,8 +260,7 @@ function(add_unittest unittest_name)
         waffle_static
     )
     add_custom_target(${unittest_name}_run
-        DEPENDS ${unittest_name}
-        COMMAND "${CMAKE_BINARY_DIR}/tests/${unittest_name}"
+        COMMAND "${unittest_name}"
     )
     add_dependencies(check ${unittest_name}_run)
 endfunction()
diff --git a/tests/functional/CMakeLists.txt b/tests/functional/CMakeLists.txt
index 23618fc..d8928f0 100644
--- a/tests/functional/CMakeLists.txt
+++ b/tests/functional/CMakeLists.txt
@@ -1,8 +1,3 @@
-link_libraries(
-    ${waffle_libname}
-    waffle_test
-    )
-
 set(gl_basic_test_sources
     gl_basic_test.c
     )
@@ -34,9 +29,20 @@ add_executable(gl_basic_test
     ${gl_basic_test_sources}
     )
 
+# Ensure that the executable is in the same folder as the library it's linke
+# against. Otherwise Windows will fail to load the DLL, and the test will fa
+set_target_properties(gl_basic_test
+    PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+)
+
+target_link_libraries(gl_basic_test
+    ${waffle_libname}
+    waffle_test
+    )
+
 add_custom_target(gl_basic_test_run
-    DEPENDS gl_basic_test
-    COMMAND ${CMAKE_BINARY_DIR}/tests/functional/gl_basic_test
+    COMMAND gl_basic_test
     )
 
 add_dependencies(check-func gl_basic_test_run)
-- 
2.0.2



More information about the waffle mailing list