diff --git a/code/CMakeModules/FindNeL.cmake b/code/CMakeModules/FindNeL.cmake index e75163cce..96dd90b83 100644 --- a/code/CMakeModules/FindNeL.cmake +++ b/code/CMakeModules/FindNeL.cmake @@ -13,7 +13,6 @@ # NELXXX_FOUND # NELXXX_LIBRARIES - INCLUDE(FindHelpers) # Init all variables we'll set @@ -209,6 +208,20 @@ IF(NELMISC_FOUND) LIST(APPEND NELMISC_LIBRARIES ${LIBXML2_LIBRARIES}) ENDIF() + IF(CMAKE_DL_LIBS) + LIST(APPEND NELMISC_LIBRARIES ${CMAKE_DL_LIBS}) + ENDIF() + + FIND_PACKAGE(Threads) + + IF(Threads_FOUND) + LIST(APPEND NELMISC_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + ENDIF() + + IF(UNIX AND NOT APPLE) + LIST(APPEND NELMISC_LIBRARIES rt) + ENDIF() + LIST(REMOVE_ITEM NeL_FIND_COMPONENTS misc) LIST(APPEND NEL_MODULES_FOUND misc) @@ -262,11 +275,17 @@ FOREACH(COMPONENT ${NeL_FIND_COMPONENTS}) FIND_PACKAGE_HELPER(${_NAME} nel/${COMPONENT}/${HEADER_FILE} RELEASE nel${COMPONENT}_r nel${COMPONENT} DEBUG nel${COMPONENT}_d + DIR ${NEL_DIR} QUIET) IF(${_UPNAME}_FOUND) LIST(APPEND NEL_MODULES_FOUND ${COMPONENT}) + # all NeL libraries depend on nelmisc in static + IF(NEL_STATIC) + LIST(APPEND ${_UPNAME}_LIBRARIES ${NELMISC_LIBRARIES}) + ENDIF() + IF(COMPONENT STREQUAL "3d") IF(NEL_STATIC) # 3rd party dependencies @@ -301,7 +320,9 @@ FOREACH(COMPONENT ${NeL_FIND_COMPONENTS}) ELSEIF(COMPONENT STREQUAL "gui") FIND_PACKAGE(Luabind REQUIRED) - LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES}) + IF(LUABIND_FOUND) + LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES}) + ENDIF() FIND_LIBCURL() @@ -323,7 +344,6 @@ FOREACH(COMPONENT ${NeL_FIND_COMPONENTS}) LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) - LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES} ${CURL_LIBRARIES}) LIST(APPEND NEL_DEFINITIONS ${${_UPNAME}_DEFINITIONS}) ELSEIF(COMPONENT STREQUAL "sound") FIND_PACKAGE(Ogg REQUIRED)