File: CMakeCSharpInformation.cmake

package info (click to toggle)
gdcm 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 32,868 kB
  • sloc: cpp: 188,481; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (92 lines) | stat: -rw-r--r-- 3,428 bytes parent folder | download | duplicates (8)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92

# This file sets the basic flags for the CSharp language in CMake.
# It also loads the available platform file for the system-compiler
# if it exists.

#set(CMAKE_BASE_NAME)
#get_filename_component(CMAKE_BASE_NAME ${CMAKE_CSharp_COMPILER} NAME_WE)
#set(CMAKE_SYSTEM_AND_CSharp_COMPILER_INFO_FILE
#  #${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
#  ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
#message(${CMAKE_SYSTEM_AND_CSharp_COMPILER_INFO_FILE})
#include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)

# This should be included before the _INIT variables are
# used to initialize the cache.  Since the rule variables
# have if blocks on them, users can still define them here.
# But, it should still be after the platform file so changes can
# be made to those values.

if(CMAKE_USER_MAKE_RULES_OVERRIDE)
   include(${CMAKE_USER_MAKE_RULES_OVERRIDE})
endif()

# Copy from CSharp, ref CXX ???
if(CMAKE_USER_MAKE_RULES_OVERRIDE_CSHARP)
   include(${CMAKE_USER_MAKE_RULES_OVERRIDE_CSHARP})
endif()

# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# <LINK_FLAGS>

# this is a place holder if java needed flags for javac they would go here.
if(NOT CMAKE_CSharp_CREATE_STATIC_LIBRARY)
#  if(WIN32)
#    set(class_files_mask "*.class")
#  else()
    set(class_files_mask ".")
#  endif()

  set(CMAKE_CSharp_CREATE_STATIC_LIBRARY
      #"<CMAKE_CSharp_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> <OBJECTS>")
      "<CMAKE_CSharp_COMPILER> <CMAKE_STATIC_LIBRARY_CSharp_FLAGS> <OBJECTS> -out:<TARGET>")
endif()

# compile a CSharp file into an object file
if(NOT CMAKE_CSharp_COMPILE_OBJECT)
  # there is no such thing as intermediate representation (object file) in C#.
  # Instead to avoid multiple recompilation of the same src file, I could use the .dll form, since
  # one can add src / .dll that same way

  # copy src version
  set(CMAKE_CSharp_COMPILE_OBJECT "<CMAKE_COMMAND> -E copy <SOURCE> <OBJECT>")
endif()

if(NOT CMAKE_CSharp_LINK_EXECUTABLE)
  set(CMAKE_CSharp_LINK_EXECUTABLE
    # I could not references 'SOURCES' so I simply copy all source to fake OBJECTS

    # .exe is required otherwise I get:
    #  Unhandled Exception: System.ArgumentException: Module file name
    #  'cmTryCompileExec' must have file extension.
    #"<CMAKE_CSharp_COMPILER> <FLAGS> <OBJECTS> -out:<TARGET>.exe <LINK_FLAGS> <LINK_LIBRARIES>")
    "<CMAKE_CSharp_COMPILER> <FLAGS> <OBJECTS> -out:<TARGET_BASE>.exe <LINK_FLAGS> <LINK_LIBRARIES>")
endif()

if(NOT CMAKE_CSharp_CREATE_SHARED_LIBRARY)
  set(CMAKE_CSharp_CREATE_SHARED_LIBRARY
      #"<CMAKE_CSharp_COMPILER> /target:library <OBJECTS> -out:<TARGET>")
      "<CMAKE_CSharp_COMPILER> <CMAKE_SHARED_LIBRARY_CSharp_FLAGS> <OBJECTS> -out:<TARGET>")
endif()

# set java include flag option and the separator for multiple include paths
#set(CMAKE_INCLUDE_FLAG_CSharp "-classpath ")
#if(WIN32 AND NOT CYGWIN)
#  set(CMAKE_INCLUDE_FLAG_SEP_CSharp ";")
#else()
#  set(CMAKE_INCLUDE_FLAG_SEP_CSharp ":")
#endif()

set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSFLAGS} ${CMAKE_CSharp_FLAGS_INIT}")

# avoid just having a space as the initial value for the cache
if(CMAKE_CSharp_FLAGS_INIT STREQUAL " ")
  set(CMAKE_CSharp_FLAGS_INIT)
endif()
set (CMAKE_CSharp_FLAGS "${CMAKE_CSharp_FLAGS_INIT}" CACHE STRING
     "Flags used by the compiler during all build types.")