From f6437cfaed1dd0acd1ec63e1c282d0e7edfa4522 Mon Sep 17 00:00:00 2001
From: davidwed <davidwe@posteo.de>
Date: 周六, 07 9月 2019 21:54:13 +0800
Subject: [PATCH] Fix a compilier error with msys2-mingw64 ( ld.exe: cannot find -ldl ) (#35)

---
 CMakeLists.txt |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 904dc52..d8f75ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
 #TODO guess address_model 64 in boost
 #fix shared libraries activation
 
-#cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
 cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
 
 #version variables, major and minor must be 1 character only
@@ -14,7 +13,7 @@
 
 SET(CMAKE_DISABLE_SOURCE_CHANGES ON)
 SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
-SET(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "CMake verbose" FORCE)
+SET(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "CMake verbose")
 
 project (license++ C CXX)
 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
@@ -68,7 +67,7 @@
 endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
 
 set( Boost_USE_STATIC_LIBS ON )
-find_package(Boost 1.55.0 COMPONENTS date_time unit_test_framework program_options system filesystem)
+find_package(Boost REQUIRED COMPONENTS date_time unit_test_framework program_options system filesystem)
 #set below in case of dynamic linking in debug.
 #set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:BOOST_TEST_DYN_LINK>)
 add_definitions(-DBOOST_ALL_NO_LIB) #Disable Boost Microsoft magic, all dependencies are handled by cmake
@@ -97,7 +96,9 @@
 	    include_directories(${DBUS_ARCH_INCLUDE_DIR})
 	    list(APPEND EXTERNAL_LIBS ${DBUS_LIBRARIES})
 	endif(USE_DBUS_IDENTIFIER)    
-	list(APPEND EXTERNAL_LIBS dl)
+	if(NOT MINGW)
+	    list(APPEND EXTERNAL_LIBS dl)
+	endif(NOT MINGW)
 	list(APPEND EXTERNAL_LIBS "-Wl,-Bdynamic")
 endif(NOT MSVC)
 

--
Gitblit v1.9.1