1 include(Platform/NetBSD)
3 # On OpenBSD, the compile time linker does not share it's configuration with
4 # the runtime linker. This will extract the library search paths from the
5 # system's ld.so.hints file which will allow CMake to set the appropriate
7 if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
8 execute_process(COMMAND /sbin/ldconfig -r
9 OUTPUT_VARIABLE LDCONFIG_HINTS
11 string(REGEX REPLACE ".*search\\ directories:\\ ([^\n]*).*" "\\1"
12 LDCONFIG_HINTS "${LDCONFIG_HINTS}")
13 string(REPLACE ":" ";"
14 CMAKE_PLATFORM_RUNTIME_PATH
18 # OpenBSD requires -z origin to enable $ORIGIN expansion in RPATH.
19 # This is not required for NetBSD.
20 set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-z,origin,-rpath,")
22 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
24 # OpenBSD has no multilib
25 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS FALSE)
26 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
28 # OpenBSD policy requires that shared libraries be installed without
29 # executable permission.
30 set(CMAKE_INSTALL_SO_NO_EXE 1)
33 set(OPENBSD_LOCALBASE $ENV{LOCALBASE})
35 set(OPENBSD_LOCALBASE /usr/local)
38 set(OPENBSD_X11BASE $ENV{X11BASE})
40 set(OPENBSD_X11BASE /usr/X11R6)
43 list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${OPENBSD_LOCALBASE})