Mercurial > irccd
comparison cmake/function/IrccdDefineLibrary.cmake @ 207:6635b9187d71
Irccd: switch to 4 spaces indent, #518
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 21 Jun 2016 20:52:17 +0200 |
parents | 98ac3c79009f |
children | 08b52b6483e3 |
comparison
equal
deleted
inserted
replaced
206:11808e98218f | 207:6635b9187d71 |
---|---|
19 # | 19 # |
20 # irccd_define_library | 20 # irccd_define_library |
21 # ------------------------------------------------------------------- | 21 # ------------------------------------------------------------------- |
22 # | 22 # |
23 # irccd_define_library( | 23 # irccd_define_library( |
24 # TARGET target name | 24 # TARGET target name |
25 # SOURCES src1, src2, srcn | 25 # SOURCES src1, src2, srcn |
26 # LOCAL (Optional) set to true to build a static library | 26 # LOCAL (Optional) set to true to build a static library |
27 # FLAGS (Optional) C/C++ flags (without -D) | 27 # FLAGS (Optional) C/C++ flags (without -D) |
28 # LIBRARIES (Optional) libraries to link | 28 # LIBRARIES (Optional) libraries to link |
29 # LOCAL_INCLUDES (Optional) local includes for the target only | 29 # LOCAL_INCLUDES (Optional) local includes for the target only |
30 # PUBLIC_INCLUDES (Optional) includes to share with target dependencies | 30 # PUBLIC_INCLUDES (Optional) includes to share with target dependencies |
31 # ) | 31 # ) |
32 # | 32 # |
33 # Create a static library for internal use. | 33 # Create a static library for internal use. |
34 # | 34 # |
35 | 35 |
36 function(irccd_define_library) | 36 function(irccd_define_library) |
37 set(options LOCAL) | 37 set(options LOCAL) |
38 set(oneValueArgs TARGET) | 38 set(oneValueArgs TARGET) |
39 set(multiValueArgs SOURCES FLAGS LIBRARIES LOCAL_INCLUDES PUBLIC_INCLUDES) | 39 set(multiValueArgs SOURCES FLAGS LIBRARIES LOCAL_INCLUDES PUBLIC_INCLUDES) |
40 set(mandatory TARGET SOURCES) | 40 set(mandatory TARGET SOURCES) |
41 | 41 |
42 cmake_parse_arguments(LIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | 42 cmake_parse_arguments(LIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) |
43 | 43 |
44 if (NOT LIB_TARGET) | 44 if (NOT LIB_TARGET) |
45 message(FATAL_ERROR "Please set TARGET") | 45 message(FATAL_ERROR "Please set TARGET") |
46 endif () | 46 endif () |
47 if (NOT LIB_SOURCES) | 47 if (NOT LIB_SOURCES) |
48 message(FATAL_ERROR "Please set SOURCES") | 48 message(FATAL_ERROR "Please set SOURCES") |
49 endif () | 49 endif () |
50 if (LIB_LOCAL) | 50 if (LIB_LOCAL) |
51 set(type STATIC) | 51 set(type STATIC) |
52 endif () | 52 endif () |
53 | 53 |
54 add_library(${LIB_TARGET} ${type} ${LIB_SOURCES}) | 54 add_library(${LIB_TARGET} ${type} ${LIB_SOURCES}) |
55 target_include_directories(${LIB_TARGET} PRIVATE ${LIB_LOCAL_INCLUDES} PUBLIC ${LIB_PUBLIC_INCLUDES}) | 55 target_include_directories(${LIB_TARGET} PRIVATE ${LIB_LOCAL_INCLUDES} PUBLIC ${LIB_PUBLIC_INCLUDES}) |
56 target_compile_definitions(${LIB_TARGET} PUBLIC ${LIB_FLAGS}) | 56 target_compile_definitions(${LIB_TARGET} PUBLIC ${LIB_FLAGS}) |
57 target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES}) | 57 target_link_libraries(${LIB_TARGET} ${LIB_LIBRARIES}) |
58 endfunction() | 58 endfunction() |