mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore(cmake): Lookup toxcore's static dependencies
This commit is contained in:
parent
11f263ffc3
commit
3f0372b2c5
|
@ -35,7 +35,7 @@ include(CMakeParseArguments)
|
||||||
include(Qt5CorePatches)
|
include(Qt5CorePatches)
|
||||||
|
|
||||||
function(search_dependency pkg)
|
function(search_dependency pkg)
|
||||||
set(options OPTIONAL)
|
set(options OPTIONAL STATIC_PACKAGE)
|
||||||
set(oneValueArgs PACKAGE LIBRARY FRAMEWORK HEADER)
|
set(oneValueArgs PACKAGE LIBRARY FRAMEWORK HEADER)
|
||||||
set(multiValueArgs)
|
set(multiValueArgs)
|
||||||
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
@ -76,19 +76,25 @@ function(search_dependency pkg)
|
||||||
message(STATUS "${pkg} not found")
|
message(STATUS "${pkg} not found")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS ${pkg} " LIBRARY_DIRS: " "${${pkg}_LIBRARY_DIRS}" )
|
if(arg_STATIC_PACKAGE)
|
||||||
message(STATUS ${pkg} " INCLUDE_DIRS: " "${${pkg}_INCLUDE_DIRS}" )
|
set(maybe_static _STATIC)
|
||||||
message(STATUS ${pkg} " CFLAGS_OTHER: " "${${pkg}_CFLAGS_OTHER}" )
|
else()
|
||||||
message(STATUS ${pkg} " LIBRARIES: " "${${pkg}_LIBRARIES}" )
|
set(maybe_static "")
|
||||||
|
endif()
|
||||||
|
|
||||||
link_directories(${${pkg}_LIBRARY_DIRS})
|
message(STATUS ${pkg} " LIBRARY_DIRS: " "${${pkg}${maybe_static}_LIBRARY_DIRS}" )
|
||||||
include_directories(${${pkg}_INCLUDE_DIRS})
|
message(STATUS ${pkg} " INCLUDE_DIRS: " "${${pkg}${maybe_static}_INCLUDE_DIRS}" )
|
||||||
|
message(STATUS ${pkg} " CFLAGS_OTHER: " "${${pkg}${maybe_static}_CFLAGS_OTHER}" )
|
||||||
|
message(STATUS ${pkg} " LIBRARIES: " "${${pkg}${maybe_static}_LIBRARIES}" )
|
||||||
|
|
||||||
foreach(flag ${${pkg}_CFLAGS_OTHER})
|
link_directories(${${pkg}${maybe_static}_LIBRARY_DIRS})
|
||||||
|
include_directories(${${pkg}${maybe_static}_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
foreach(flag ${${pkg}${maybe_static}_CFLAGS_OTHER})
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${pkg}_LIBRARIES} PARENT_SCOPE)
|
set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${pkg}${maybe_static}_LIBRARIES} PARENT_SCOPE)
|
||||||
message(STATUS "${pkg} found")
|
message(STATUS "${pkg} found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -107,9 +113,15 @@ search_dependency(SQLCIPHER PACKAGE sqlcipher)
|
||||||
search_dependency(VPX PACKAGE vpx)
|
search_dependency(VPX PACKAGE vpx)
|
||||||
|
|
||||||
# Try to find cmake toxcore libraries
|
# Try to find cmake toxcore libraries
|
||||||
|
if(WIN32)
|
||||||
|
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL STATIC_PACKAGE)
|
||||||
|
search_dependency(TOXAV PACKAGE toxav OPTIONAL STATIC_PACKAGE)
|
||||||
|
search_dependency(TOXENCRYPTSAVE PACKAGE toxencryptsave OPTIONAL STATIC_PACKAGE)
|
||||||
|
else()
|
||||||
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL)
|
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL)
|
||||||
search_dependency(TOXAV PACKAGE toxav OPTIONAL)
|
search_dependency(TOXAV PACKAGE toxav OPTIONAL)
|
||||||
search_dependency(TOXENCRYPTSAVE PACKAGE toxencryptsave OPTIONAL)
|
search_dependency(TOXENCRYPTSAVE PACKAGE toxencryptsave OPTIONAL)
|
||||||
|
endif()
|
||||||
|
|
||||||
# If not found, use automake toxcore libraries
|
# If not found, use automake toxcore libraries
|
||||||
# We only check for TOXCORE, because the other two are gone in 0.2.0.
|
# We only check for TOXCORE, because the other two are gone in 0.2.0.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user