aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2019-01-14 11:42:26 -0500
committerDavid Neto <dneto@google.com>2019-01-15 09:45:13 -0500
commit5ae6e4a82f3e740a4462390e318ada6f680faa9d (patch)
tree4d7fcf1a76f664ece2543dd6e96ee0e6e31f6937 /examples
parent8f0a61dc95e0df18c18e0ac56d83b3fa9d2fe90b (diff)
downloadeffcee-5ae6e4a82f3e740a4462390e318ada6f680faa9d.tar.gz
Fix effcee-example MinGW cross-compile
For MinGW: - Don't try to use pthreads - Statically link the C++ runtime
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 47a326c..32cdd29 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,9 +1,15 @@
add_executable(effcee-example main.cc)
target_link_libraries(effcee-example effcee)
-if(UNIX)
- target_link_libraries(effcee-example -pthread)
-endif(UNIX)
+if(UNIX AND NOT MINGW)
+ set_target_properties(effcee-example PROPERTIES LINK_FLAGS -pthread)
+endif()
+if (WIN32 AND NOT MSVC)
+ # For MinGW cross-compile, statically link to the C++ runtime
+ set_target_properties(effcee-example PROPERTIES
+ LINK_FLAGS "-static -static-libgcc -static-libstdc++")
+endif(WIN32 AND NOT MSVC)
+
if(EFFCEE_BUILD_TESTING)
add_test(NAME effcee-example