"Fossies" - the Fresh Open Source Software Archive

Member "apt-1.9.4/CMake/CheckCxxTarget.cmake" (19 Sep 2019, 1494 Bytes) of package /linux/misc/apt-1.9.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # CMake support for target-based function multiversioning
    2 #
    3 # Copyright (C) 2019 Canonical Ltd
    4 #
    5 # Author: Julian Andres Klode <jak@debian.org>.
    6 #
    7 # Permission is hereby granted, free of charge, to any person
    8 # obtaining a copy of this software and associated documentation files
    9 # (the "Software"), to deal in the Software without restriction,
   10 # including without limitation the rights to use, copy, modify, merge,
   11 # publish, distribute, sublicense, and/or sell copies of the Software,
   12 # and to permit persons to whom the Software is furnished to do so,
   13 # subject to the following conditions:
   14 #
   15 # The above copyright notice and this permission notice shall be
   16 # included in all copies or substantial portions of the Software.
   17 #
   18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   19 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   20 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   22 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   23 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   24 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   25 # SOFTWARE.
   26 
   27 
   28 function(check_cxx_target var target code)
   29     check_cxx_source_compiles(
   30     "
   31     __attribute__((target(\"${target}\"))) static int foo() { ${code} return 1; }
   32     __attribute__((target(\"default\"))) static int foo() { ${code} return 0; }
   33     int main() { return foo(); }
   34     "  ${var})
   35 endfunction()