Mercurial > malikania
comparison cmake/function/MalikaniaDefineExecutable.cmake @ 49:2804ae55c70f
CMake: big cleanup, closes #598
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 09 Dec 2016 13:28:45 +0100 |
parents | |
children | 697bf85e8e19 |
comparison
equal
deleted
inserted
replaced
48:3be179ba3226 | 49:2804ae55c70f |
---|---|
1 # | |
2 # MalikaniaDefineExecutable.cmake -- CMake build system for malikania | |
3 # | |
4 # Copyright (c) 2013-2016 Malikania Authors | |
5 # | |
6 # Permission to use, copy, modify, and/or distribute this software for any | |
7 # purpose with or without fee is hereby granted, provided that the above | |
8 # copyright notice and this permission notice appear in all copies. | |
9 # | |
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 # | |
18 | |
19 # | |
20 # malikania_define_executable | |
21 # --------------------------- | |
22 # | |
23 # malikania_define_executable( | |
24 # TARGET The target name | |
25 # SOURCES The list of sources | |
26 # FLAGS (Optional) List of flags | |
27 # INCLUDES (Optional) List of include directories | |
28 # LIBRARIES (Optional) List of libraries | |
29 # ) | |
30 # | |
31 # Create an executable. Be sure to quote SOURCES, if not only the first file will be passed. | |
32 # If you need flags, just pass them without -D or /D, this is automatically done for you. | |
33 # | |
34 | |
35 include(CMakeParseArguments) | |
36 | |
37 function(malikania_define_executable) | |
38 set(singleArgs TARGET) | |
39 set(multiArgs SOURCES FLAGS INCLUDES LIBRARIES) | |
40 | |
41 cmake_parse_arguments(EXE "" "${singleArgs}" "${multiArgs}" ${ARGN}) | |
42 | |
43 if (NOT EXE_TARGET) | |
44 message(FATAL_ERROR "Missing TARGET parameter") | |
45 endif () | |
46 if (NOT EXE_SOURCES) | |
47 message(FATAL_ERROR "Missing SOURCES parameter") | |
48 endif () | |
49 | |
50 add_executable(${EXE_TARGET} ${EXE_SOURCES}) | |
51 target_link_libraries(${EXE_TARGET} ${EXE_LIBRARIES}) | |
52 target_include_directories(${EXE_TARGET} PRIVATE ${EXE_INCLUDES}) | |
53 target_compile_definitions(${EXE_TARGET} PRIVATE ${EXE_FLAGS}) | |
54 endfunction() |