File: run_source_test.cmake

package info (click to toggle)
cppad 2025.00.00.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,552 kB
  • sloc: cpp: 112,594; sh: 5,972; ansic: 179; python: 71; sed: 12; makefile: 10
file content (43 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
# run_source_test(source variable)
#
# source: (in)
# contains the source for the program that will be run.
#
# variable: (out)
# This variable must not be defined when this macro is called.
# Upon return, the value of this variable is 1 if the program runs and
# returns a zero status. Otherwise its value is 0.
# Note that this is the reverse of the status flag returned by the program.
#
# CMAKE_REQUORED_name (out)
# For name equal to DEFINITIONS, INCLUDES, LIBRARIES, FLAGS, the variable
# CMAKE_REQUIRED_name is set to the empty string.
#
MACRO(run_source_test source variable)
   IF( DEFINED ${variable} )
      MESSAGE(ERROR
         "run_source_test: ${variable} is defined before expected"
      )
   ENDIF( DEFINED ${variable} )
   SET(CMAKE_REQUIRED_DEFINITIONS "" )
   SET(CMAKE_REQUIRED_INCLUDES    "" )
   SET(CMAKE_REQUIRED_LIBRARIES   "" )
   IF( cppad_cxx_flags )
      SET(CMAKE_REQUIRED_FLAGS   "${cppad_cxx_flags} ${CMAKE_CXX_FLAGS}" )
   ELSE( cppad_cxx_flags )
      SET(CMAKE_REQUIRED_FLAGS   "" )
   ENDIF( cppad_cxx_flags )
   CHECK_CXX_SOURCE_RUNS("${source}" ${variable} )
   IF( ${variable} )
      SET(${variable} 1)
   ELSE( ${variable} )
      SET(${variable} 0)
   ENDIF( ${variable} )
   MESSAGE(STATUS "${variable} = ${${variable}}" )
   #
   SET(CMAKE_REQUIRED_FLAGS        "" )
ENDMACRO( run_source_test )