Hash :
cf64370e
Author :
Date :
2021-02-27T11:00:21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
cmake_minimum_required(VERSION 2.8.11...3.2)
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()
project (dlfcn-win32 C)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
include(Macros)
option(BUILD_SHARED_LIBS "shared/static libs" ON)
option(BUILD_TESTS "tests?" OFF)
if(WIN32 AND NOT CMAKE_HOST_WIN32 AND CMAKE_CROSSCOMPILING AND BUILD_TESTS)
add_auto_option(ENABLE_WINE "Enable running tests with wine" AUTO)
find_program(WINE_EXECUTABLE wine)
check_auto_option(ENABLE_WINE "wine support" WINE_EXECUTABLE "wine executable")
if(ENABLE_WINE AND WINE_EXECUTABLE)
set(WRAPPER ${WINE_EXECUTABLE})
set(RUN_TESTS 1)
message(STATUS "Support to run cross compiled tests - enabled")
endif()
elseif(BUILD_TESTS)
set(RUN_TESTS 1)
endif()
if(RUN_TESTS)
enable_testing()
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if (MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall)
endif()
if(WIN32)
add_subdirectory(src)
endif()
if (BUILD_TESTS)
add_subdirectory(tests)
endif()