Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IHTACMakeCommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IHTA
CMake
IHTACMakeCommon
Commits
cc11b0aa
Commit
cc11b0aa
authored
2 years ago
by
Pascal Palenda
Browse files
Options
Downloads
Patches
Plain Diff
Add first draft for ihta_add_library
parent
91d48f0a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/IhtaAddLibrary.cmake
+74
-0
74 additions, 0 deletions
src/IhtaAddLibrary.cmake
src/Index.cmake
+1
-0
1 addition, 0 deletions
src/Index.cmake
with
75 additions
and
0 deletions
src/IhtaAddLibrary.cmake
0 → 100644
+
74
−
0
View file @
cc11b0aa
include_guard
()
#[=======================================================================[.rst:
..command:: ihta_add_library
Macro to generate doxygen documentation with custom logo and style sheet.
::
build_doc(
SOURCES <documentation-folder...>
[README_MAINPAGE <readme-file-for-main-page>]
[COLOR_STYLE <css-style-sheet>]
[LOGO <logo-file>]
[ADD_DEV_SECTION]
[SIDEBAR_ONLY]
)
.. variable:: SIDEBAR_ONLY
Specifies, that the `doxygen-awesome-css` sidebar ony style should be used.
#]=======================================================================]
macro
(
ihta_add_library
)
set
(
options
)
set
(
oneValueArgs NAMESPACE NAME LIBRARY_TYPE INCLUDE_DIR IDE_FOLDER
)
set
(
multiValueArgs SOURCES
)
cmake_parse_arguments
(
IHTA_ADD_LIB
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
if
(
DEFINED IHTA_ADD_LIB_LIBRARY_TYPE
)
set
(
IHTA_ADD_LIB_TYPES
"STATIC"
"SHARED"
"INTERFACE"
"OBJECT"
)
if
(
NOT
(
${
IHTA_ADD_LIB_LIBRARY_TYPE
}
IN_LIST IHTA_ADD_LIB_TYPES
))
message
(
FATAL_ERROR
"ihta_add_library only supports the following LIBRARY_TYPE's: STATIC, SHARED, INTERFACE or OBJECT"
)
endif
()
endif
()
if
(
NOT DEFINED IHTA_ADD_LIB_INCLUDE_DIR
)
set
(
IHTA_ADD_LIB_INCLUDE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/include
)
endif
()
if
(
DEFINED IHTA_ADD_LIB_NAMESPACE AND NOT DEFINED IHTA_ADD_LIB_IDE_FOLDER
)
set
(
IHTA_ADD_LIB_IDE_FOLDER
${
IHTA_ADD_LIB_NAMESPACE
}
)
elseif
(
NOT DEFINED IHTA_ADD_LIB_NAMESPACE AND DEFINED IHTA_ADD_LIB_IDE_FOLDER
)
set
(
IHTA_ADD_LIB_NAMESPACE
${
IHTA_ADD_LIB_IDE_FOLDER
}
)
elseif
(
NOT DEFINED IHTA_ADD_LIB_NAMESPACE AND NOT DEFINED IHTA_ADD_LIB_IDE_FOLDER
)
message
(
FATAL_ERROR
"ihta_add_library requires to set either a NAMESPACE or an IDE_FOLDER"
)
endif
()
add_library
(
${
IHTA_ADD_LIB_NAME
}
${
IHTA_ADD_LIB_LIBRARY_TYPE
}
""
)
add_library
(
${
IHTA_ADD_LIB_NAMESPACE
}
::
${
IHTA_ADD_LIB_NAME
}
ALIAS
${
IHTA_ADD_LIB_NAME
}
)
target_sources
(
${
IHTA_ADD_LIB_NAME
}
PRIVATE
${
IHTA_ADD_LIB_SOURCES
}
)
# Include Directory
target_include_directories
(
${
IHTA_ADD_LIB_NAME
}
PUBLIC $<BUILD_INTERFACE:
${
IHTA_ADD_LIB_INCLUDE_DIR
}
>
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
/
${
IHTA_ADD_LIB_NAME
}
>
)
# Required compiler features
target_compile_features
(
${
IHTA_ADD_LIB_NAME
}
PUBLIC cxx_std_17
)
# If build out of parent project, add parent folder library to parent project folder
if
(
NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR
)
set_property
(
TARGET
${
IHTA_ADD_LIB_NAME
}
PROPERTY FOLDER
${
IHTA_ADD_LIB_FOLDER
}
)
endif
()
# Organize sources in folders
GroupSourcesByFolder
(
${
IHTA_ADD_LIB_NAME
}
)
endmacro
()
This diff is collapsed.
Click to expand it.
src/Index.cmake
+
1
−
0
View file @
cc11b0aa
...
...
@@ -23,3 +23,4 @@ include (${CPM_MODULE_LOCATION})
include
(
${
CMAKE_CURRENT_LIST_DIR
}
/GetCommonLibraries.cmake
)
include
(
${
CMAKE_CURRENT_LIST_DIR
}
/BuildDoc.cmake
)
include
(
${
CMAKE_CURRENT_LIST_DIR
}
/IhtaAddLibrary.cmake
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment