summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2015-09-23 07:03:55 (GMT)
committerTony Theodore <tonyt@logyst.com>2015-09-23 07:03:55 (GMT)
commitfd257c1335663f9452a9f360a3fcc72108053da9 (patch)
tree25cfd575a1e77a5d25f91e7e07bd44175d6135b7
parent960a7ac57e394ce49fc8deeee47ca08725125abe (diff)
downloadmxe-fd257c1335663f9452a9f360a3fcc72108053da9.zip
mxe-fd257c1335663f9452a9f360a3fcc72108053da9.tar.gz
mxe-fd257c1335663f9452a9f360a3fcc72108053da9.tar.bz2
pthreads: test cmake find_package(Threads REQUIRED)
-rw-r--r--src/pthreads.mk22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/pthreads.mk b/src/pthreads.mk
index 60d070b..a15fe15 100644
--- a/src/pthreads.mk
+++ b/src/pthreads.mk
@@ -14,14 +14,28 @@ define $(PKG)_UPDATE
echo $(pthreads_VERSION)
endef
-PTHREADS_TEST = \
- $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig' && \
+define PTHREADS_TEST
+ # install and test pkg-config
+ $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig'
(echo 'Name: pthreads'; \
echo 'Version: $($(PKG)_VERSION)'; \
echo 'Description: Posix Threads ($(PKG))'; \
- echo 'Libs: -lpthread -lws2_32';) \
- > '$(PREFIX)/$(TARGET)/lib/pkgconfig/pthreads.pc' && \
+ echo 'Libs: -lpthread'; \
+ ) > '$(PREFIX)/$(TARGET)/lib/pkgconfig/pthreads.pc'
+
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic \
'$(TOP_DIR)/src/pthreads-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-pthreads.exe' \
`'$(TARGET)-pkg-config' --libs pthreads`
+
+ # test cmake
+ mkdir '$(1).cmake'
+ (echo 'find_package(Threads REQUIRED)'; \
+ echo 'add_executable(test-pthreads-cmake $(PREFIX)/../src/pthreads-test.c)'; \
+ echo 'target_link_libraries(test-pthreads-cmake $${CMAKE_THREAD_LIBS_INIT})'; \
+ echo 'install(TARGETS test-pthreads-cmake DESTINATION bin)'; \
+ ) > '$(1).cmake/CMakeLists.txt'
+
+ cd '$(1).cmake' && '$(TARGET)-cmake' .
+ $(MAKE) -C '$(1).cmake' -j 1 install
+endef