Changed: #915 NeL fails to build with --as-needed

This commit is contained in:
kervala 2010-09-09 14:20:18 +02:00
parent 4b1fcc8726
commit 8db652391b
3 changed files with 21 additions and 8 deletions

View file

@ -97,7 +97,8 @@ FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Jpeg) FIND_PACKAGE(Jpeg)
IF(WITH_STATIC) IF(WITH_STATIC)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) # libxml2 could need winsock2 library
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} ${WINSOCK2_LIB} -DLIBXML_STATIC)
ENDIF(WITH_STATIC) ENDIF(WITH_STATIC)
NL_SETUP_BUILD() NL_SETUP_BUILD()

View file

@ -274,10 +274,7 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_COVERAGE) IF(WITH_COVERAGE)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
ENDIF(WITH_COVERAGE) ENDIF(WITH_COVERAGE)
SET(PLATFORM_LINKFLAGS "${CMAKE_THREAD_LIBS_INIT} -lc -lm -lstdc++") SET(PLATFORM_LINKFLAGS "-Wl,--no-undefined -Wl,--as-needed")
IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lrt")
ENDIF(NOT APPLE)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g") SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g")
SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ") SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ")

View file

@ -16,14 +16,29 @@ IF(JPEG_FOUND)
TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY}) TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY})
ENDIF(JPEG_FOUND) ENDIF(JPEG_FOUND)
IF(WITH_STATIC OR WIN32)
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARIES})
ELSE(WITH_STATIC OR WIN32)
# Link only with libpng shared library
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY})
ENDIF(WITH_STATIC OR WIN32)
# For DirectInput (di_event_emitter) # For DirectInput (di_event_emitter)
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ENDIF(WIN32) ENDIF(WIN32)
IF(UNIX)
SET(LIBC_LIBRARY -lc)
IF(NOT APPLE)
SET(LIBRT_LIBRARY -lrt)
ENDIF(NOT APPLE)
ENDIF(UNIX)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file)
TARGET_LINK_LIBRARIES(nelmisc ${LIBXML2_LIBRARIES} ${PNG_LIBRARIES} ${WINSOCK2_LIB}) TARGET_LINK_LIBRARIES(nelmisc ${CMAKE_THREAD_LIBS_INIT} ${LIBC_LIBRARY} ${LIBRT_LIBRARY} ${LIBXML2_LIBRARIES})
SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "") SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc") NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc")