Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/cmake/modules/KDevPlatformMacrosInternal.cmake
- This file was added.
1 | # | ||||
---|---|---|---|---|---|
2 | # KDevelop Platform Private Macros | ||||
3 | # | ||||
4 | # The following macros are defined here: | ||||
5 | # | ||||
6 | # KDEVPLATFORM_ADD_LIBRARY( <targetname> SOURCES <src1> [<src2> [...]] ) | ||||
7 | # Use this to add libraries part of the KDevPlatform | ||||
8 | # | ||||
9 | # Copyright 2007 Andreas Pakulat <apaku@gmx.de> | ||||
10 | # Redistribution and use is allowed according to the terms of the BSD license. | ||||
11 | | ||||
12 | include(CMakeParseArguments) | ||||
13 | | ||||
14 | function(kdevplatform_add_library target) | ||||
15 | set(options) | ||||
16 | set(oneValueArgs) | ||||
17 | set(multiValueArgs SOURCES) | ||||
18 | cmake_parse_arguments(KDEV_ADD_LIBRARY "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||||
19 | | ||||
20 | string(REPLACE "KDevPlatform" "" shortTargetName ${target}) | ||||
21 | if (${shortTargetName} STREQUAL ${target}) | ||||
22 | message(FATAL_ERROR "Target passed to kdevplatform_add_library needs to start with \"KDevPlatform\", was \"${target}\"") | ||||
23 | endif() | ||||
24 | | ||||
25 | string(TOLOWER ${shortTargetName} shortTargetNameToLower) | ||||
26 | | ||||
27 | add_library(${target} ${KDEV_ADD_LIBRARY_SOURCES}) | ||||
28 | add_library(KDev::${shortTargetName} ALIAS ${target}) | ||||
29 | | ||||
30 | generate_export_header(${target} EXPORT_FILE_NAME ${shortTargetNameToLower}export.h) | ||||
31 | | ||||
32 | target_include_directories(${target} | ||||
33 | INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/kdevplatform>" | ||||
34 | "$<BUILD_INTERFACE:${KDevPlatform_SOURCE_DIR}>" "$<BUILD_INTERFACE:${KDevPlatform_BINARY_DIR}>" | ||||
35 | "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" # useful for the "something.export.h" includes | ||||
36 | ) | ||||
37 | #some plugins install interfaces such as execute/iexecuteplugin.h | ||||
38 | target_include_directories(${target} INTERFACE | ||||
39 | "$<BUILD_INTERFACE:${KDevPlatform_SOURCE_DIR}/plugins>" "$<BUILD_INTERFACE:${KDevPlatform_BINARY_DIR}/plugins>" ) | ||||
40 | set_target_properties(${target} PROPERTIES | ||||
41 | VERSION ${KDEVPLATFORM_VERSION} | ||||
42 | SOVERSION ${KDEVPLATFORM_LIB_SOVERSION} | ||||
43 | EXPORT_NAME ${shortTargetName} | ||||
44 | ) | ||||
45 | | ||||
46 | install(TARGETS ${target} EXPORT KDevPlatformTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | ||||
47 | install(FILES | ||||
48 | ${CMAKE_CURRENT_BINARY_DIR}/${shortTargetNameToLower}export.h | ||||
49 | DESTINATION ${KDE_INSTALL_INCLUDEDIR}/kdevplatform/${shortTargetNameToLower} COMPONENT Devel) | ||||
50 | endfunction() |