Check for backtrace symbol and link to execinfo if needed

Check execinfo is needed on Unix instead of only checking on FreeBSD.
This commit is contained in:
Danilo Spinella 2020-12-04 13:21:50 +01:00 committed by akallabeth
parent ad93ff3f0d
commit 13df840d23

View File

@ -15,6 +15,8 @@
# 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,10 +139,16 @@ endif()
if(UNIX)
winpr_library_add_private(m)
endif()
if((FREEBSD) AND (NOT KFREEBSD))
winpr_library_add_private(execinfo)
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)