Mercurial > pub > dyncall > dyncall
annotate CMakeLists.txt @ 313:73b5b9e224e2
- dynload_plain test: stability fix for picking right testing lib on build
author | Tassilo Philipp |
---|---|
date | Tue, 05 Nov 2019 15:19:16 +0100 |
parents | 3cb226f48495 |
children | dc8bbffc39e6 |
rev | line source |
---|---|
0 | 1 # Package: dyncall |
2 # File: CMakeLists.txt | |
3 # Description: DynCall Project cmake files | |
4 # License: | |
5 # | |
6 # Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de> | |
7 # | |
8 # Permission to use, copy, modify, and distribute this software for any | |
9 # purpose with or without fee is hereby granted, provided that the above | |
10 # copyright notice and this permission notice appear in all copies. | |
11 # | |
12 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
15 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
16 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
17 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
18 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
19 # | |
20 | |
21 cmake_minimum_required (VERSION 2.6) | |
149
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
22 project(DynCall C) |
0 | 23 |
24 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "dyncall enables dynamic invocation of machine-level function calls") | |
25 set(CPACK_PACKAGE_VENDOR "dyncall project") | |
26 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt") | |
27 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/License.txt") | |
28 if(APPLE) | |
29 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/doc/Description.txt") | |
30 endif(APPLE) | |
31 set(CPACK_PACKAGE_NAME "dyncall") | |
32 include(CPack) | |
33 | |
34 # add cmake modules shipped with the package to cmake's module path. | |
35 # currently we have no use for this, but maybe later.. | |
36 #set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/buildsys/cmake/Modules" "${CMAKE_MODULE_PATH}") | |
37 | |
149
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
38 option(LANG_CXX "Enable and build C++ tests" ON) |
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
39 |
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
40 if(LANG_CXX) |
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
41 enable_language(CXX) |
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
42 endif() |
0 | 43 |
150
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
44 include(CheckCCompilerFlag) |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
45 check_c_compiler_flag("-fPIC -Werror" COMPILER_HAS_FPIC) |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
46 |
0 | 47 if(MSVC) |
48 enable_language(ASM_MASM) | |
49 #if(CMAKE_SIZEOF_VOID_P MATCHES 8) | |
50 # set(CMAKE_ASM_COMPILER "ml64") | |
51 #else() | |
52 # set(CMAKE_ASM_COMPILER "ml") | |
53 #endif() | |
54 #set(CMAKE_ASM_COMPILER_ARG1 "/c") | |
55 #set(CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS asm) | |
56 #set(CMAKE_ASM_MASM_COMPILE_OBJECT "<CMAKE_ASM_MASM_COMPILER> <FLAGS> /c /Fo <OBJECT> <SOURCE>") | |
31
6e7b1b7ad9d3
Fixed failing builds when the compiler is ICC/ICPC
Snaipe <franklinmathieu@gmail.com>
parents:
3
diff
changeset
|
57 elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") |
150
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
58 if(COMPILER_HAS_FPIC) |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
59 # when used in shared libraries, -fPIC is required by several architectures |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
60 # and platforms (observed on AMD64, Solaris/Sparc). |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
61 # we enable it per default here. |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
62 add_definitions("-fPIC") |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
63 endif() |
0 | 64 # enable gcc as front-end to assembler for .S files |
65 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}") | |
66 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c") | |
67 enable_language(ASM) | |
3 | 68 elseif(CMAKE_COMPILER_IS_CLANG) |
0 | 69 elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro") |
70 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}") | |
71 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c") | |
72 enable_language(ASM) | |
3 | 73 else() |
149
c12120a1fbc0
- make cmake based builds work on systems without a C++ compiler (thanks Franklin Mathieu)
cslag
parents:
31
diff
changeset
|
74 if (CMAKE_C_COMPILER_ID STREQUAL "Clang") |
150
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
75 if(COMPILER_HAS_FPIC) |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
76 add_definitions("-fPIC") |
3cb226f48495
- make cmake based builds check if compiler has -fPIC flag, in order to silence warnings if not (thanks Franklin Mathieu)
cslag
parents:
149
diff
changeset
|
77 endif() |
3 | 78 # enable gcc as front-end to assembler for .S files |
79 set(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}") | |
80 set(CMAKE_ASM_COMPILER_ARG1 "${CPPFLAGS} -c") | |
81 enable_language(ASM) | |
82 endif() | |
0 | 83 endif() |
84 | |
85 add_subdirectory(dynload) | |
86 add_subdirectory(dyncall) | |
87 add_subdirectory(dyncallback) | |
88 add_subdirectory(doc/manual EXCLUDE_FROM_ALL) | |
89 add_subdirectory(test EXCLUDE_FROM_ALL) | |
90 | |
91 # install cmake Find scripts (disabled per default) | |
92 | |
93 option(INSTALL_CMAKE_MODULES "install cmake modules to locate dyncall" "NO") | |
94 | |
95 if(INSTALL_CMAKE_MODULES) | |
96 file(GLOB INSTALL_CMAKE_MODULES_FILES buildsys/cmake/Modules/Find*.cmake) | |
97 install(FILES ${INSTALL_CMAKE_MODULES_FILES} DESTINATION ${CMAKE_ROOT}/Modules) | |
98 endif(INSTALL_CMAKE_MODULES) | |
99 |