added CMake script which builds and links bundled libraries

This commit is contained in:
Radegast 2012-06-09 20:00:11 +01:00
parent aaf2571ee4
commit e5742f9621

45
CMakeLists.txt Normal file
View file

@ -0,0 +1,45 @@
if(WIN32)
message(FATAL_ERROR "Sorry, building bundled libs is not yet supported on Windows.")
elseif(UNIX)
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
COMMAND CFLAGS=-m32 LDFLAGS=-m32 ./configure --enable-shared=no --enable-static=yes --without-libssh2 --enable-http --enable-ftp --disable-gopher --enable-file --disable-ldap --disable-dict --disable-telnet --disable-manual --enable-libgcc --disable-ipv6 --disable-ares --without-ssl --without-zlib --without-libidn && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
)
add_custom_target(bundled_curl
DEPENDS ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
)
#-----------------------------------------------------------------
# Build bundled JPEG library
#-----------------------------------------------------------------
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
COMMAND CFLAGS=-m32 LDFLAGS=-m32 ./configure && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
)
add_custom_target(bundled_jpeg
DEPENDS ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
)
#-----------------------------------------------------------------
# Build bundled SDL library
#-----------------------------------------------------------------
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
COMMAND CFLAGS=-m32 LDFLAGS=-m32 ./configure && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/sdl
)
add_custom_target(bundled_sdl
DEPENDS ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
)
# return compiled libs to the parent CMakeLists.txt
set(BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a"
"${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a"
"${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a"
PARENT_SCOPE)
endif()