diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a779900..0808f1fef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,14 @@ set(STK_INSTALL_BINARY_DIR "bin" CACHE set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX") +# These variables enable MSVC to find libraries located in "dependencies" +if(WIN32) + set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include") + set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib) + set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) + add_definitions(-D_IRR_STATIC_LIB_) +endif() + # Build the Bullet physics library add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet") include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src") @@ -63,30 +71,30 @@ include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include") add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew") include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include") -if(WIN32) -# Build zlib library -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/zlib") -include_directories("${PROJECT_SOURCE_DIR}/lib/zlib") +if(WIN32 AND NOT MINGW) + # Build zlib library + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/zlib") + include_directories("${PROJECT_SOURCE_DIR}/lib/zlib") -set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/zlib" "${PROJECT_BINARY_DIR}/lib/zlib/") -set(ZLIB_LIBRARY zlibstatic) + set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/zlib" "${PROJECT_BINARY_DIR}/lib/zlib/") + set(ZLIB_LIBRARY zlibstatic) -# Build png library -set (SKIP_INSTALL_ALL TRUE) -set (PNG_STATIC TRUE) -set (PNG_TESTS FALSE) -set (PNG_SHARED FALSE) -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libpng") -include_directories("${PROJECT_SOURCE_DIR}/lib/libpng") + # Build png library + set (SKIP_INSTALL_ALL TRUE) + set (PNG_STATIC TRUE) + set (PNG_TESTS FALSE) + set (PNG_SHARED FALSE) + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libpng") + include_directories("${PROJECT_SOURCE_DIR}/lib/libpng") -#build jpeg library -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/jpeglib") -include_directories("${PROJECT_SOURCE_DIR}/lib/jpeglib") + #build jpeg library + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/jpeglib") + include_directories("${PROJECT_SOURCE_DIR}/lib/jpeglib") -set(PNG_PNG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/libpng/") -set(PNG_LIBRARY png15_static) -set(JPEG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/jpeglib/") -set(JPEG_LIBRARY jpeglib) + set(PNG_PNG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/libpng/") + set(PNG_LIBRARY png15_static) + set(JPEG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/jpeglib/") + set(JPEG_LIBRARY jpeglib) endif() # Build the irrlicht library add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht") @@ -106,15 +114,6 @@ endif() # Set include paths include_directories(${STK_SOURCE_DIR}) -# These variables enable MSVC to find libraries located in "dependencies" -if(WIN32) - set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include") - set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib) - set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) - add_definitions(-D_IRR_STATIC_LIB_) -endif() - - if(APPLE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")