]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CMake: Don't build unit tests if private symbols are hidden
authorJakub Zakrzewski <slither.jz@gmail.com>
Sun, 4 Sep 2016 10:58:35 +0000 (12:58 +0200)
committerJakub Zakrzewski <slither.jz@gmail.com>
Fri, 9 Sep 2016 22:35:38 +0000 (00:35 +0200)
This only excludes building unit tests from default build ( 'all' Make
target or "Build Solution" in VisualStudio). The projects and Make
targets will still be generated and shown in supporting IDEs.

Fixes https://github.com/curl/curl/issues/981
Reported-by: Randy Armstrong
Closes https://github.com/curl/curl/pull/990

tests/unit/CMakeLists.txt

index e66679882858e47b5f4e8e8031c532830182d04c..14589d68da489804fd7cc31bcbb194e1f72961f2 100644 (file)
@@ -40,7 +40,15 @@ foreach(_testfile ${UT_SRC})
   set_target_properties(${_testname}
       PROPERTIES COMPILE_DEFINITIONS "UNITTESTS")
 
-  add_test(NAME ${_testname}
-           COMMAND ${_testname} "http://www.google.com"
-           )
+  if(HIDES_CURL_PRIVATE_SYMBOLS)
+    set_target_properties(${_testname}
+         PROPERTIES
+               EXCLUDE_FROM_ALL TRUE
+               EXCLUDE_FROM_DEFAULT_BUILD TRUE
+       )
+  else()
+    add_test(NAME ${_testname}
+             COMMAND ${_testname} "http://www.google.com"
+    )
+  endif()
 endforeach()