Check for backtrace symbol and link to execinfo if needed
Check execinfo is needed on Unix instead of only checking on FreeBSD.
# See the License for the specific language governing permissions and
# limitations under the License.
+include(CheckFunctionExists)
+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(${MODULE_PREFIX}_COLLECTIONS_SRCS
@@ -137,11 +139,17 @@ endif()
if(UNIX)
winpr_library_add_private(m)
-endif()
-if((FREEBSD) AND (NOT KFREEBSD))
+ set(CMAKE_REQUIRED_INCLUDES backtrace.h)
+ check_function_exists(backtrace BACKTRACE)
+ if (NOT BACKTRACE)
+ set(CMAKE_REQUIRED_LIBRARIES execinfo)
+ check_function_exists(backtrace EXECINFO)
+ if (EXECINFO)
winpr_library_add_private(execinfo)
endif()
+ endif()
+endif()
if(WIN32)
winpr_library_add_public(dbghelp)
