Fix CMake support on Win32

This commit is contained in:
myd7349 2019-04-05 10:56:47 +08:00
parent 94335e30df
commit 61181f2c49
3 changed files with 12 additions and 5 deletions

View File

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

View File

@ -16,8 +16,8 @@ if (raylib_USE_STATIC_LIBS)
set(XPREFIX ${XPREFIX}_STATIC) set(XPREFIX ${XPREFIX}_STATIC)
endif() endif()
find_package(PkgConfig) find_package(PkgConfig QUIET)
pkg_check_modules(${XPREFIX} REQUIRED raylib) pkg_check_modules(${XPREFIX} QUIET raylib)
set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS}) set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
find_path(raylib_INCLUDE_DIR find_path(raylib_INCLUDE_DIR
@ -26,7 +26,7 @@ find_path(raylib_INCLUDE_DIR
) )
find_library(raylib_LIBRARY find_library(raylib_LIBRARY
NAMES raylib NAMES raylib raylib_static
HINTS ${${XPREFIX}_LIBRARY_DIRS} HINTS ${${XPREFIX}_LIBRARY_DIRS}
) )

View File

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