forked from townforge/townforge
clean up some cmake skullduggery
This commit is contained in:
parent
e77cd6023c
commit
e92b9ebe21
@ -444,12 +444,34 @@ if(STATIC AND NOT IOS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cmake sucks every fucking time, doesn't use C_INCLUDE_PATH (because why bother),
|
||||
# does't seem to like ENV{C_INCLUDE_PATH} (I think because there's a : because
|
||||
# I have more than one path in it), it basically sucks, it's made to piss off people
|
||||
# even more than autotools. Fuck cmake.
|
||||
# But at least we can make a function to hide the gross.
|
||||
function (find_static_header_and_library var_header header var_library library)
|
||||
find_library(${var_library} ${library})
|
||||
message(STATUS "Normal: ${${var_header}} ${${var_library}}")
|
||||
if (${var_library})
|
||||
if (header)
|
||||
find_path(${var_header} ${header})
|
||||
endif()
|
||||
else()
|
||||
find_library(${var_library} ${library} PATHS /home/user/lib NO_DEFAULT_PATH)
|
||||
if (header)
|
||||
find_path(${var_header} ${header} PATHS /home/user/include NO_DEFAULT_PATH)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function (find_static_library var_library library)
|
||||
find_static_header_and_library("" "" ${var_library} ${library})
|
||||
endfunction()
|
||||
|
||||
if (STATIC AND NOT WIN32)
|
||||
# Fuck cmake
|
||||
find_path(HIDAPI_INCLUDE_DIR hidapi/hidapi.h PATHS /home/user/include /usr/include NO_DEFAULT_PATH)
|
||||
find_library(HIDAPI_LIBRARIES libhidapi-libusb.a PATHS /home/user/lib /usr/lib64 /usr/lib NO_DEFAULT_PATH)
|
||||
find_library(USB_LIBRARIES libusb-1.0.a PATHS /home/user/lib /usr/lib64 /usr/lib NO_DEFAULT_PATH)
|
||||
find_library(UDEV_LIBRARIES udev)
|
||||
find_static_header_and_library(HIDAPI_INCLUDE_DIR hidapi/hidapi.h HIDAPI_LIBRARIES libhidapi-libusb.a)
|
||||
find_static_library(USB_LIBRARIES libusb-1.0.a)
|
||||
find_static_library(UDEV_LIBRARIES udev)
|
||||
if (HIDAPI_LIBRARIES AND USB_LIBRARIES AND UDEV_LIBRARIES)
|
||||
set(HIDAPI_FOUND ON)
|
||||
set(HIDAPI_LIBRARIES ${HIDAPI_LIBRARIES} ${USB_LIBRARIES} ${UDEV_LIBRARIES})
|
||||
@ -951,14 +973,17 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS AN
|
||||
endif()
|
||||
|
||||
if (STATIC AND NOT WIN32)
|
||||
# cmake sucks every fucking time, doesn't use C_INCLUDE_PATH (because why bother),
|
||||
# does't seem to like ENV{C_INCLUDE_PATH} (I think because there's a : because
|
||||
# I have more than one path in it), it basically sucks, it's made to piss off people
|
||||
# even more than autotools. Fuck cmake.
|
||||
find_path(ZMQ_INCLUDE_PATH zmq.h PATHS /home/user/include /usr/include NO_DEFAULT_PATH)
|
||||
find_library(ZMQ_LIB libzmq.a PATHS /home/user/lib /usr/lib64 /usr/lib NO_DEFAULT_PATH)
|
||||
find_library(SODIUM_LIBRARY libsodium.a)
|
||||
find_library(Z_LIBRARY libz.a)
|
||||
find_static_header_and_library(ZMQ_INCLUDE_PATH zmq.h ZMQ_LIB libzmq.a)
|
||||
find_static_library(SODIUM_LIBRARY libsodium.a)
|
||||
find_static_library(Z_LIBRARY libz.a)
|
||||
find_static_library(PGM_LIBRARY libpgm.a)
|
||||
if (NOT PGM_LIBRARY)
|
||||
find_library(PGM_LIBRARY pgm)
|
||||
endif()
|
||||
find_static_library(NORM_LIBRARY libnorm.a)
|
||||
if (NOT NORM_LIBRARY)
|
||||
find_library(NORM_LIBRARY pgm)
|
||||
endif()
|
||||
else()
|
||||
find_path(ZMQ_INCLUDE_PATH zmq.h)
|
||||
find_library(ZMQ_LIB zmq)
|
||||
@ -988,6 +1013,8 @@ if(SODIUM_LIBRARY)
|
||||
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set(EXTRA_LIBRARIES "${EXTRA_LIBRARIES};${Z_LIBRARY}")
|
||||
|
||||
add_subdirectory(contrib)
|
||||
add_subdirectory(src)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user