File: CheckEnv.cmake

package info (click to toggle)
swi-prolog 9.2.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 84,456 kB
  • sloc: ansic: 401,705; perl: 374,799; lisp: 9,080; cpp: 8,920; java: 5,525; sh: 3,282; javascript: 2,690; python: 2,655; ruby: 1,594; yacc: 845; makefile: 440; xml: 317; sed: 12; sql: 6
file content (44 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download | duplicates (3)
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
44
function(conflicting_var name)
  message(WARNING
	  "-- Environment variable ${name} is set to $ENV{${name}}\n"
	  "This suggests that the variable is referring to a existing installation of SWI-Prolog. "
	  "This may conflict with building SWI-Prolog as this may cause the "
	  "build process to use components from such (older) installed version "
	  "of SWI-Prolog.  Make sure to remove this environment from the "
	  "environment before building the system.")
endfunction()

if(CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF" AND
   DEFINED ENV{LD_PRELOAD} AND
   "$ENV{LD_PRELOAD}" MATCHES swipl|swi-prolog)
  conflicting_var(LD_PRELOAD)
endif()

if(UNIX)
  if(APPLE)
    if(DEFINED ENV{DYLD_LIBRARY_PATH} AND
       "$ENV{DYLD_LIBRARY_PATH}" MATCHES swipl|swi-prolog)
      conflicting_var(DYLD_LIBRARY_PATH)
    endif()
  else()
    if( DEFINED ENV{LD_LIBRARY_PATH} AND
	"$ENV{LD_LIBRARY_PATH}" MATCHES swipl|swi-prolog AND
	NOT "$ENV{LD_LIBRARY_PATH}" MATCHES /root/parts/swi-prolog )
      conflicting_var(LD_LIBRARY_PATH)
    endif()
  endif()
elseif(WIN32)
  if(DEFINED ENV{PATH} AND
     "$ENV{PATH}" MATCHES swipl|swi-prolog)
    conflicting_var(PATH)
  endif()
endif()

if(DEFINED ENV{SWI_HOME_DIR} AND
   IS_DIRECTORY "$ENV{SWI_HOME_DIR}")
  conflicting_var(SWI_HOME_DIR)
endif()
if(DEFINED ENV{SWIPL} AND
   IS_DIRECTORY "$ENV{SWIPL}")
  conflicting_var(SWIPL)
endif()