1set(HAIKU 1) 2set(UNIX 1) 3 4set(CMAKE_DL_LIBS "") 5set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") 6set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") 7set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") 8set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") 9set(CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN "\$ORIGIN") 10set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") 11set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") 12set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") 13 14# Determine, if the C or C++ compiler is configured for a secondary 15# architecture. If so, that will change the search paths we set below. We check 16# whether the compiler's library search paths contain a 17# "/boot/system/develop/lib/<subdir>/", which we assume to be the secondary 18# architecture specific subdirectory and extract the name of the architecture 19# accordingly. 20 21# First of all, find a C or C++ compiler we can run. The "arg1" is necessary 22# here for compilers such as "distcc gcc-x86" or "ccache gcc-x86" 23# TODO See CMakeDetermineCompilerId.cmake for some more things we may want to do. 24if(CMAKE_C_COMPILER) 25 set(__HAIKU_COMPILER ${CMAKE_C_COMPILER}) 26 string (STRIP "${CMAKE_C_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) 27else() 28 set(__HAIKU_COMPILER ${CMAKE_CXX_COMPILER}) 29 string (STRIP "${CMAKE_CXX_COMPILER_ARG1}" __HAIKU_COMPILER_FLAGS) 30endif() 31 32 33execute_process( 34 COMMAND ${__HAIKU_COMPILER} ${__HAIKU_COMPILER_FLAGS} -print-search-dirs 35 OUTPUT_VARIABLE _HAIKU_SEARCH_DIRS 36 RESULT_VARIABLE _HAIKU_SEARCH_DIRS_FOUND 37 OUTPUT_STRIP_TRAILING_WHITESPACE) 38 39string(REGEX MATCH "libraries: =?([^\n]*:)?/boot/system/develop/lib/([^/]*)/?(:?\n+)" _dummy "${_HAIKU_SEARCH_DIRS}\n") 40set(CMAKE_HAIKU_SECONDARY_ARCH "${CMAKE_MATCH_2}") 41 42if(NOT CMAKE_HAIKU_SECONDARY_ARCH) 43 set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "") 44 unset(CMAKE_HAIKU_SECONDARY_ARCH) 45else() 46 set(CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR "/${CMAKE_HAIKU_SECONDARY_ARCH}") 47 48 # Override CMAKE_*LIBRARY_ARCHITECTURE. This will cause FIND_LIBRARY to search 49 # the libraries in the correct subdirectory first. It still isn't completely 50 # correct, since the parent directories shouldn't be searched at all. The 51 # primary architecture library might still be found, if there isn't one 52 # installed for the secondary architecture or it is installed in a less 53 # specific location. 54 set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) 55 set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) 56 set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_HAIKU_SECONDARY_ARCH}) 57endif() 58 59list(APPEND CMAKE_SYSTEM_PREFIX_PATH 60 /boot/system/non-packaged 61 /boot/system 62 ) 63 64LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES 65 /boot/system/non-packaged/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} 66 /boot/system/develop/headers/os 67 /boot/system/develop/headers/os/app 68 /boot/system/develop/headers/os/device 69 /boot/system/develop/headers/os/drivers 70 /boot/system/develop/headers/os/game 71 /boot/system/develop/headers/os/interface 72 /boot/system/develop/headers/os/kernel 73 /boot/system/develop/headers/os/locale 74 /boot/system/develop/headers/os/mail 75 /boot/system/develop/headers/os/media 76 /boot/system/develop/headers/os/midi 77 /boot/system/develop/headers/os/midi2 78 /boot/system/develop/headers/os/net 79 /boot/system/develop/headers/os/opengl 80 /boot/system/develop/headers/os/storage 81 /boot/system/develop/headers/os/support 82 /boot/system/develop/headers/os/translation 83 /boot/system/develop/headers/os/add-ons/graphics 84 /boot/system/develop/headers/os/add-ons/input_server 85 /boot/system/develop/headers/os/add-ons/screen_saver 86 /boot/system/develop/headers/os/add-ons/tracker 87 /boot/system/develop/headers/os/be_apps/Deskbar 88 /boot/system/develop/headers/os/be_apps/NetPositive 89 /boot/system/develop/headers/os/be_apps/Tracker 90 /boot/system/develop/headers/3rdparty 91 /boot/system/develop/headers/bsd 92 /boot/system/develop/headers/glibc 93 /boot/system/develop/headers/gnu 94 /boot/system/develop/headers/posix 95 /boot/system/develop/headers${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} 96 ) 97IF (CMAKE_HAIKU_SECONDARY_ARCH) 98 LIST(APPEND CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES 99 /boot/system/develop/headers 100 ) 101ENDIF (CMAKE_HAIKU_SECONDARY_ARCH) 102 103LIST(APPEND CMAKE_HAIKU_C_INCLUDE_DIRECTORIES 104 ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES} 105 ) 106 107LIST(APPEND CMAKE_HAIKU_CXX_INCLUDE_DIRECTORIES 108 ${CMAKE_HAIKU_COMMON_INCLUDE_DIRECTORIES}) 109 110LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${CMAKE_HAIKU_C_INCLUDE_DIRECTORIES}) 111 112LIST(APPEND CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES 113 /boot/system/non-packaged/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} 114 /boot/system/develop/lib${CMAKE_HAIKU_SECONDARY_ARCH_SUBDIR} 115 ) 116 117LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 118 ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES} 119 ) 120 121LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${CMAKE_HAIKU_DEVELOP_LIB_DIRECTORIES}) 122 123if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 124 set(CMAKE_INSTALL_PREFIX "/boot/system" CACHE PATH 125 "Install path prefix, prepended onto install directories." FORCE) 126endif() 127