Merge pull request #789 from myd7349/fix-cmake-for-win32

Fix CMake support on Win32
This commit is contained in:
Ray 2019-04-22 19:32:15 +02:00 committed by GitHub
commit e41cb774c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 8 deletions

View File

@ -41,7 +41,7 @@ if (ENABLE_MSAN AND ENABLE_ASAN)
MESSAGE(WARNING "Compiling with both AddressSanitizer and MemorySanitizer is not recommended")
endif()
add_subdirectory(src release)
add_subdirectory(src)
if (${BUILD_EXAMPLES})
add_subdirectory(examples)

View File

@ -16,8 +16,8 @@ if (raylib_USE_STATIC_LIBS)
set(XPREFIX ${XPREFIX}_STATIC)
endif()
find_package(PkgConfig)
pkg_check_modules(${XPREFIX} REQUIRED raylib)
find_package(PkgConfig QUIET)
pkg_check_modules(${XPREFIX} QUIET raylib)
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
find_path(raylib_INCLUDE_DIR
@ -25,10 +25,17 @@ find_path(raylib_INCLUDE_DIR
HINTS ${${XPREFIX}_INCLUDE_DIRS}
)
find_library(raylib_LIBRARY
NAMES raylib
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
if (raylib_USE_STATIC_LIBS)
find_library(raylib_LIBRARY
NAMES raylib_static
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
else ()
find_library(raylib_LIBRARY
NAMES raylib
HINTS ${${XPREFIX}_LIBRARY_DIRS}
)
endif ()
set(raylib_LIBRARIES ${raylib_LIBRARY})
set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})

View File

@ -188,6 +188,13 @@ if(SHARED)
PUBLIC ${GRAPHICS}
)
if(MSVC)
target_compile_definitions(raylib
PRIVATE $<BUILD_INTERFACE:BUILD_LIBTYPE_SHARED>
INTERFACE $<INSTALL_INTERFACE:USE_LIBTYPE_SHARED>
)
endif()
set(PKG_CONFIG_LIBS_EXTRA "")
set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON)
@ -214,7 +221,9 @@ if(SHARED)
if (WIN32)
install(
TARGETS raylib
RUNTIME DESTINATION "lib"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
PUBLIC_HEADER DESTINATION "include"
)
else()