]> granicus.if.org Git - libevent/commitdiff
cmake: fix building bench/bench_cascade under win32 (missing getopt)
authorAzat Khuzhin <a3at.mail@gmail.com>
Mon, 29 May 2017 13:36:24 +0000 (16:36 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Mon, 29 May 2017 18:59:01 +0000 (21:59 +0300)
Because of typo in cmake, now rewrote to make it less error prone (since even
for non-win32 there are variables overlap).

CMakeLists.txt

index 7075bd47841aef3e96d6a7702b9c1ac90723ccba..bd64b445cef83b34813c0723da899102b6424b6e 100644 (file)
@@ -875,25 +875,23 @@ endif()
 # Benchmarks
 #
 macro(add_bench_prog prog)
-    add_executable(${prog} test/${prog}.c)
-    if (WIN32)
-        list(APPEND BENCH_SRC
-             WIN32-Code/getopt.c
-             WIN32-Code/getopt_long.c)
-    endif()
-    target_link_libraries(${BENCHMARK}
+    add_executable(${prog} ${ARGN})
+    target_link_libraries(${prog}
                           event_extra_static
                           event_core_static
                           ${LIB_APPS}
                           ${LIB_PLATFORM})
-    add_dependencies(${BENCHMARK}
+    add_dependencies(${prog}
                      event_extra_static
                      event_core_static)
 endmacro()
 if (NOT EVENT__DISABLE_BENCHMARK)
-    foreach (BENCHMARK bench bench_cascade bench_http bench_httpclient)
-        add_bench_prog(${BENCHMARK})
+    foreach (BENCHMARK bench_http bench_httpclient)
+        add_bench_prog(${BENCHMARK} test/${BENCHMARK}.c)
     endforeach()
+
+    add_bench_prog(bench test/bench.c ${WIN32_GETOPT})
+    add_bench_prog(bench_cascade test/bench_cascade.c ${WIN32_GETOPT})
 endif()
 
 #