3
0
Fork 0
forked from suyu/suyu

Generic PLATFORM_LIBRARIES var

This both reduces redundancy in add_executable definitions, and makes it easier to link additional libraries. In particular, extra libraries are needed on OSX - see next commit.
This commit is contained in:
Johannes Ekberg 2014-12-24 10:34:25 +01:00
parent d46f650036
commit 7d7ab70279
3 changed files with 8 additions and 19 deletions

View file

@ -108,8 +108,14 @@ endif()
IF (APPLE) IF (APPLE)
# CoreFoundation is required only on OSX # CoreFoundation is required only on OSX
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
SET(PLATFORM_LIBRARIES iconv ${COREFOUNDATION_LIBRARY})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
ELSEIF(WIN32)
set(PLATFORM_LIBRARIES winmm)
ELSE()
set(PLATFORM_LIBRARIES rt)
ENDIF (APPLE) ENDIF (APPLE)
option(ENABLE_QT "Enable the Qt frontend" ON) option(ENABLE_QT "Enable the Qt frontend" ON)

View file

@ -16,20 +16,10 @@ create_directory_groups(${SRCS} ${HEADERS})
add_executable(citra ${SRCS} ${HEADERS}) add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core common video_core) target_link_libraries(citra core common video_core)
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
target_link_libraries(citra ${PLATFORM_LIBRARIES})
if (UNIX) if (UNIX)
target_link_libraries(citra -pthread) target_link_libraries(citra -pthread)
endif() endif()
if (APPLE)
target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
elseif (WIN32)
target_link_libraries(citra winmm wsock32 ws2_32)
if (MINGW) # GCC does not support codecvt, so use iconv instead
target_link_libraries(citra iconv)
endif()
else() # Unix
target_link_libraries(citra rt)
endif()
#install(TARGETS citra RUNTIME DESTINATION ${bindir}) #install(TARGETS citra RUNTIME DESTINATION ${bindir})

View file

@ -60,17 +60,10 @@ endif()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
target_link_libraries(citra-qt core common video_core qhexedit) target_link_libraries(citra-qt core common video_core qhexedit)
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
if (UNIX) if (UNIX)
target_link_libraries(citra-qt -pthread) target_link_libraries(citra-qt -pthread)
endif() endif()
if (APPLE)
target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY})
elseif (WIN32)
target_link_libraries(citra-qt winmm wsock32 ws2_32)
else() # Unix
target_link_libraries(citra-qt rt)
endif()
#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})