diff --git a/CMakeLists.txt b/CMakeLists.txt index 2657c087..d5df1afe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,33 +262,37 @@ foreach(TARGET_NAME ${ACTIVE_TARGETS}) endif() endforeach() -add_executable(test src/test.c src/luv.c) -if(WIN32 OR CYGWIN) - if (LUA) - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) - else (LUA) +if(LUAJIT_LIBRARIES OR LUA_LIBRARIES) + add_executable(test src/test.c src/luv.c) + if(WIN32 OR CYGWIN) + if (LUA) + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) + else (LUA) + if (USE_LUAJIT) + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES}) + else (USE_LUAJIT) + if (LUA_BUILD_TYPE STREQUAL System) + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) + else (LUA_BUILD_TYPE STREQUAL System) + target_link_libraries(test ${LIBUV_LIBRARIES} lualib) + endif (LUA_BUILD_TYPE STREQUAL System) + endif (USE_LUAJIT) + endif (LUA) + elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") + if (USE_LUAJIT) + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES} rt) + else () + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES} rt) + endif () + else() if (USE_LUAJIT) target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES}) - else (USE_LUAJIT) - if (LUA_BUILD_TYPE STREQUAL System) - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) - else (LUA_BUILD_TYPE STREQUAL System) - target_link_libraries(test ${LIBUV_LIBRARIES} lualib) - endif (LUA_BUILD_TYPE STREQUAL System) - endif (USE_LUAJIT) - endif (LUA) -elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - if (USE_LUAJIT) - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES} rt) - else () - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES} rt) - endif () + else () + target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) + endif () + endif() else() - if (USE_LUAJIT) - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUAJIT_LIBRARIES}) - else () - target_link_libraries(test ${LIBUV_LIBRARIES} ${LUA_LIBRARIES}) - endif () + message(STATUS "Lua/LuaJIT libraries not found, test not built.") endif() if (NOT LUA) diff --git a/Makefile b/Makefile index 820f902d..ddd20c07 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,10 @@ clean: test: luv ${LUABIN} tests/run.lua - build/test tests/manual-test-external-loop.lua + @if [ -f $(BUILD_DIR)/test ]; then \ + echo "$(BUILD_DIR)/test exists."; \ + $(BUILD_DIR)/test tests/manual-test-external-loop.lua; \ + fi reset: git submodule update --init --recursive && \