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
0e7bf4d1
Unverified
Commit
0e7bf4d1
authored
Oct 09, 2018
by
Mark Lindner
Committed by
GitHub
Oct 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from erstrom/fix-library-name-on-linux
cmake: remove lib prefix when building for non windows hosts
parents
6ef3723c
f8dd13ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
18 deletions
+42
-18
examples/c++/CMakeLists.txt
examples/c++/CMakeLists.txt
+10
-4
examples/c/CMakeLists.txt
examples/c/CMakeLists.txt
+9
-3
lib/CMakeLists.txt
lib/CMakeLists.txt
+16
-10
tests/CMakeLists.txt
tests/CMakeLists.txt
+7
-1
No files found.
examples/c++/CMakeLists.txt
View file @
0e7bf4d1
if
(
CMAKE_HOST_WIN32
)
set
(
libname
"libconfig"
)
else
()
set
(
libname
"config"
)
endif
()
add_executable
(
c++_example1 example1.cpp
)
add_executable
(
c++_example2 example2.cpp
)
add_executable
(
c++_example3 example3.cpp
)
...
...
@@ -8,7 +14,7 @@ target_include_directories(c++_example2 PRIVATE ${CMAKE_SOURCE_DIR}/lib)
target_include_directories
(
c++_example3 PRIVATE
${
CMAKE_SOURCE_DIR
}
/lib
)
target_include_directories
(
c++_example4 PRIVATE
${
CMAKE_SOURCE_DIR
}
/lib
)
target_link_libraries
(
c++_example1 libconfig++
)
target_link_libraries
(
c++_example2 libconfig++
)
target_link_libraries
(
c++_example3 libconfig++
)
target_link_libraries
(
c++_example4 libconfig++
)
\ No newline at end of file
target_link_libraries
(
c++_example1
${
libname
}
++
)
target_link_libraries
(
c++_example2
${
libname
}
++
)
target_link_libraries
(
c++_example3
${
libname
}
++
)
target_link_libraries
(
c++_example4
${
libname
}
++
)
examples/c/CMakeLists.txt
View file @
0e7bf4d1
if
(
CMAKE_HOST_WIN32
)
set
(
libname
"libconfig"
)
else
()
set
(
libname
"config"
)
endif
()
add_executable
(
c_example1 example1.c
)
add_executable
(
c_example2 example2.c
)
add_executable
(
c_example3 example3.c
)
...
...
@@ -6,6 +12,6 @@ target_include_directories(c_example1 PRIVATE ${CMAKE_SOURCE_DIR}/lib)
target_include_directories
(
c_example2 PRIVATE
${
CMAKE_SOURCE_DIR
}
/lib
)
target_include_directories
(
c_example3 PRIVATE
${
CMAKE_SOURCE_DIR
}
/lib
)
target_link_libraries
(
c_example1 libconfig
)
target_link_libraries
(
c_example2 libconfig
)
target_link_libraries
(
c_example3 libconfig
)
\ No newline at end of file
target_link_libraries
(
c_example1
${
libname
}
)
target_link_libraries
(
c_example2
${
libname
}
)
target_link_libraries
(
c_example3
${
libname
}
)
lib/CMakeLists.txt
View file @
0e7bf4d1
...
...
@@ -28,41 +28,47 @@ set(libsrc_cpp
${
libsrc
}
libconfigcpp.cc
)
add_library
(
libconfig
${
libsrc
}
${
libinc
}
)
add_library
(
libconfig++
${
libsrc_cpp
}
${
libinc_cpp
}
)
if
(
CMAKE_HOST_WIN32
)
set
(
libname
"libconfig"
)
else
()
set
(
libname
"config"
)
endif
()
add_library
(
${
libname
}
${
libsrc
}
${
libinc
}
)
add_library
(
${
libname
}
++
${
libsrc_cpp
}
${
libinc_cpp
}
)
set_target_properties
(
libconfig
set_target_properties
(
${
libname
}
PROPERTIES LINKER_LANGUAGE C
PUBLIC_HEADER
"
${
libinc
}
"
)
set_target_properties
(
libconfig
++
set_target_properties
(
${
libname
}
++
PROPERTIES LINKER_LANGUAGE CXX
PUBLIC_HEADER
"
${
libinc_cpp
}
"
)
target_compile_definitions
(
libconfig
target_compile_definitions
(
${
libname
}
PRIVATE
_CRT_SECURE_NO_DEPRECATE
YY_NO_UNISTD_H
YY_USE_CONST
)
target_compile_definitions
(
libconfig
++
target_compile_definitions
(
${
libname
}
++
PRIVATE
_CRT_SECURE_NO_DEPRECATE
YY_NO_UNISTD_H
YY_USE_CONST
)
if
(
CMAKE_HOST_WIN32
)
target_link_libraries
(
libconfig
Shlwapi.lib
)
target_link_libraries
(
libconfig
++ Shlwapi.lib
)
target_link_libraries
(
${
libname
}
Shlwapi.lib
)
target_link_libraries
(
${
libname
}
++ Shlwapi.lib
)
endif
()
install
(
TARGETS
libconfig
install
(
TARGETS
${
libname
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
PUBLIC_HEADER DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
)
install
(
TARGETS
libconfig
++
install
(
TARGETS
${
libname
}
++
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
...
...
tests/CMakeLists.txt
View file @
0e7bf4d1
if
(
CMAKE_HOST_WIN32
)
set
(
libname
"libconfig"
)
else
()
set
(
libname
"config"
)
endif
()
add_executable
(
libconfig_tests
tests.c
)
target_link_libraries
(
libconfig_tests
libconfig
${
libname
}
libtinytest
)
...
...
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