Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libconfig
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
libconfig
Commits
87bace66
Unverified
Commit
87bace66
authored
Aug 14, 2019
by
Mark Lindner
Committed by
GitHub
Aug 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #146 from tastytea/cmake_config_target
Add modern *Config.cmake
parents
68689396
56dbd70d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletion
+38
-1
CMakeLists.txt
CMakeLists.txt
+8
-1
lib/CMakeLists.txt
lib/CMakeLists.txt
+30
-0
No files found.
CMakeLists.txt
View file @
87bace66
cmake_minimum_required
(
VERSION 3.1
)
project
(
libconfig LANGUAGES C CXX
)
# Extract version from configure.ac.
set
(
VERSION_REGEX
"^AC_INIT
\\
(libconfig,[
\t
]+([0-9\.]+),.*"
)
file
(
STRINGS
"configure.ac"
VERSION_STRING REGEX
${
VERSION_REGEX
}
)
string
(
REGEX REPLACE
${
VERSION_REGEX
}
"
\\
1"
VERSION_STRING
"
${
VERSION_STRING
}
"
)
project
(
libconfig LANGUAGES C CXX VERSION
${
VERSION_STRING
}
)
option
(
BUILD_EXAMPLES
"Enable examples"
ON
)
option
(
BUILD_SHARED_LIBS
"Enable shared library"
ON
)
option
(
BUILD_TESTS
"Enable tests"
ON
)
...
...
@@ -23,6 +29,7 @@ else()
endif
()
include
(
GNUInstallDirs
)
include
(
CheckSymbolExists
)
add_subdirectory
(
lib
)
if
(
BUILD_EXAMPLES
)
...
...
lib/CMakeLists.txt
View file @
87bace66
...
...
@@ -80,7 +80,16 @@ if(CMAKE_HOST_WIN32)
target_link_libraries
(
${
libname
}
++ Shlwapi.lib
)
endif
()
target_include_directories
(
${
libname
}
PUBLIC
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
target_include_directories
(
${
libname
}
++
PUBLIC
"$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>"
)
install
(
TARGETS
${
libname
}
EXPORT libconfigTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
...
...
@@ -88,8 +97,29 @@ install(TARGETS ${libname}
)
install
(
TARGETS
${
libname
}
++
EXPORT libconfig++Targets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
include
(
CMakePackageConfigHelpers
)
foreach
(
target_name libconfig libconfig++
)
write_basic_package_version_file
(
"
${
target_name
}
ConfigVersion.cmake"
VERSION
${
PACKAGE_VERSION
}
COMPATIBILITY SameMajorVersion
)
install
(
EXPORT
${
target_name
}
Targets
FILE
"
${
target_name
}
Config.cmake"
NAMESPACE libconfig::
DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
/cmake/libconfig
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
target_name
}
ConfigVersion.cmake"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/libconfig"
)
endforeach
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment