Skip to content

Instantly share code, notes, and snippets.

@seven332
Last active June 14, 2016 12:12
Show Gist options
  • Save seven332/bd1e5c5aab223a8e51c33946a9809241 to your computer and use it in GitHub Desktop.
Save seven332/bd1e5c5aab223a8e51c33946a9809241 to your computer and use it in GitHub Desktop.
Some CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(libogg C)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
include_directories(include)
set(SOURCE_FILES
src/bitwise.c
src/framing.c
)
set(PUBLIC_HDRS
include/ogg/ogg.h
include/ogg/os_types.h
)
add_library(ogg SHARED ${SOURCE_FILES})
add_library(ogg-static STATIC ${SOURCE_FILES})
install(TARGETS ogg ogg-static
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}")
install(FILES ${PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}/ogg")
cmake_minimum_required(VERSION 2.8)
project(SDL2_image C)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
include_directories(${SDL2_INCLUDE_DIR2} ${PNG_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
add_definitions(-DLOAD_BMP -DLOAD_JPG -DLOAD_PNG -DLOAD_GIF)
set(SOURCE_FILES
IMG.c
IMG_bmp.c
IMG_gif.c
IMG_jpg.c
IMG_lbm.c
IMG_pcx.c
IMG_png.c
IMG_pnm.c
IMG_tga.c
IMG_tif.c
IMG_xcf.c
IMG_xpm.c
IMG_xv.c
IMG_webp.c
)
set(PUBLIC_HDRS
SDL_image.h
)
message(${SDL2_LIBRARY})
add_library(SDL2_image SHARED ${SOURCE_FILES})
target_link_libraries(SDL2_image ${SDL2_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY})
add_library(SDL2_image-static STATIC ${SOURCE_FILES})
target_link_libraries(SDL2_image-static ${SDL2_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY})
install(TARGETS SDL2_image SDL2_image-static
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
install(FILES ${PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}/SDL2")
cmake_minimum_required(VERSION 2.8)
project(SDL2_ttf C)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
find_package(SDL2 REQUIRED)
find_package(Freetype REQUIRED)
find_package(PNG REQUIRED)
find_package(BZip2 REQUIRED)
find_package(ZLIB REQUIRED)
include_directories(${SDL2_INCLUDE_DIR2} ${FREETYPE_INCLUDE_DIR_freetype2} ${FREETYPE_INCLUDE_DIR_ft2build})
set(SOURCE_FILES
SDL_ttf.c
)
set(PUBLIC_HDRS
SDL_ttf.h
)
add_library(SDL2_ttf SHARED ${SOURCE_FILES})
target_link_libraries(SDL2_ttf ${SDL2_LIBRARY} ${FREETYPE_LIBRARY} ${PNG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES})
add_library(SDL2_ttf-static STATIC ${SOURCE_FILES})
target_link_libraries(SDL2_ttf-static ${SDL2_LIBRARY} ${FREETYPE_LIBRARY} ${PNG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES})
install(TARGETS SDL2_ttf SDL2_ttf-static
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
install(FILES ${PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}/SDL2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment