1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-14 04:25:22 +02:00
jami-client-qt/extras/build/cmake/extra_tools.cmake
Andreas Traczyk 50ce16e0ab misc: fix automated tests
Broken by https://review.jami.net/c/jami-client-qt/+/26560.
This moves some logic that has been previously duplicated between the app and tests into a common routine.

Change-Id: I40f1af38893cfcef751578d3e4db7d7ba040505b
2024-01-31 18:22:45 -05:00

38 lines
1.5 KiB
CMake

# Copyright (C) 2024 Savoir-faire Linux Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Function to define a macro with a specific value or default to 0 if not already set.
# This is useful to if within the code we don't want to use #ifdef but rather use the
# value of the macro.
function(define_macro_with_value MACRO_NAME)
if(DEFINED ${MACRO_NAME})
# Convert ON/OFF to 1/0
if(${${MACRO_NAME}} STREQUAL "ON")
set(MACRO_VALUE "1")
elseif(${${MACRO_NAME}} STREQUAL "OFF")
set(MACRO_VALUE "0")
# If the macro is defined and its value is neither "ON" nor "OFF",
# set MACRO_VALUE to the macro's current value
else()
set(MACRO_VALUE "${${MACRO_NAME}}")
endif()
else()
set(MACRO_VALUE "0")
endif()
# Add the macro definition to the compiler command line
add_definitions("-D${MACRO_NAME}=${MACRO_VALUE}")
endfunction()