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