Skip to content

Commit 6761b9d

Browse files
committed
Build script fixes
1 parent a255907 commit 6761b9d

File tree

9 files changed

+96
-60
lines changed

9 files changed

+96
-60
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.15)
88

99
project(
1010
Skyr
11-
VERSION 1.4.1
11+
VERSION 1.4.2
1212
HOMEPAGE_URL https://cpp-netlib.github.io/url
1313
DESCRIPTION "A C++ library that implements the WhatWG URL specification"
1414
LANGUAGES CXX

cmake/SkyrFunctions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function(remove_extension file_name basename)
2+
string(REGEX REPLACE "\\.[^.]*$" "" _basename ${file_name})
3+
set(${basename} ${_basename} PARENT_SCOPE)
4+
endfunction()

docs/CMakeLists.txt

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# Copyright (c) Glyn Matthews 2018-19.
1+
# Copyright (c) Glyn Matthews 2018-20.
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6-
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
6+
include(${Skyr_SOURCE_DIR}/cmake/SkyrFunctions.cmake)
7+
8+
LIST(APPEND CMAKE_MODULE_PATH "${Skyr_SOURCE_DIR}/cmake")
79

810
find_package(Doxygen REQUIRED)
911
find_package(Pandoc REQUIRED)
@@ -37,18 +39,22 @@ endforeach()
3739

3840
# Generate API documentation using Doxygen
3941
configure_file(
40-
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
42+
Doxyfile.in
4143
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
4244

4345
configure_file(
44-
${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in
46+
conf.py.in
4547
${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
4648

47-
add_custom_target(doxygen ALL
49+
add_custom_target(
50+
doxygen ALL
4851
COMMAND
49-
${DOXYGEN}
50-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
51-
COMMENT "Generating documentation with Doxygen")
52+
${DOXYGEN}
53+
WORKING_DIRECTORY
54+
${CMAKE_CURRENT_BINARY_DIR}
55+
COMMENT
56+
"Generating documentation with Doxygen"
57+
)
5258

5359
# Convert markdown to RST
5460
SET(
@@ -58,19 +64,31 @@ SET(
5864
)
5965

6066
foreach (file_name ${GENERATED_FROM_MARKDOWN})
61-
_remove_extension(${file_name} basename)
67+
remove_extension(${file_name} basename)
6268
string(TOUPPER ${basename} basename_upper)
63-
add_custom_target(${file_name}
64-
pandoc ${CMAKE_SOURCE_DIR}/${basename_upper}.md -f markdown -t rst -s -o ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
65-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
66-
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
67-
COMMENT "Generating RST file with pandoc" VERBATIM)
69+
set(target ${basename})
70+
string(PREPEND target "doc_")
71+
add_custom_target(
72+
${target}
73+
pandoc ${Skyr_SOURCE_DIR}/${basename_upper}.md -f markdown -t rst -s -o ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
74+
WORKING_DIRECTORY
75+
${CMAKE_CURRENT_BINARY_DIR}
76+
BYPRODUCTS
77+
${CMAKE_CURRENT_BINARY_DIR}/${file_name}
78+
COMMENT
79+
"Generating RST file with pandoc" VERBATIM
80+
)
6881
endforeach()
6982

7083
# Bring it all together using Sphinx
71-
add_custom_target(doc ALL
84+
add_custom_target(
85+
doc ALL
7286
COMMAND
73-
${SPHINX_EXECUTABLE} -M html ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
74-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
75-
DEPENDS doxygen ${GENERATED_FROM_MARKDOWN}
76-
COMMENT "Generating documentation with Sphinx")
87+
${SPHINX_EXECUTABLE} -M html ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
88+
WORKING_DIRECTORY
89+
${CMAKE_CURRENT_BINARY_DIR}
90+
DEPENDS
91+
doxygen ${GENERATED_FROM_MARKDOWN}
92+
COMMENT
93+
"Generating documentation with Sphinx"
94+
)

docs/Doxyfile.in

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -791,23 +791,23 @@ WARN_LOGFILE =
791791
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
792792
# Note: If this tag is empty the current directory is searched.
793793

794-
INPUT = @CMAKE_SOURCE_DIR@/include/skyr/config.hpp \
795-
@CMAKE_SOURCE_DIR@/include/skyr/version.hpp \
796-
@CMAKE_SOURCE_DIR@/include/skyr/unicode.hpp \
797-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/domain.hpp \
798-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/idna.hpp \
799-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/errors.hpp \
800-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/byte_transform.hpp \
801-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/u16_transform.hpp \
802-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/u32_transform.hpp \
803-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/ranges/views/u8_view.hpp \
804-
@CMAKE_SOURCE_DIR@/include/skyr/unicode/ranges/views/u16_view.hpp \
805-
@CMAKE_SOURCE_DIR@/include/skyr/url.hpp \
806-
@CMAKE_SOURCE_DIR@/include/skyr/url/url_error.hpp \
807-
@CMAKE_SOURCE_DIR@/include/skyr/url/url_parse.hpp \
808-
@CMAKE_SOURCE_DIR@/include/skyr/url/url_record.hpp \
809-
@CMAKE_SOURCE_DIR@/include/skyr/url/url_search_parameters.hpp \
810-
@CMAKE_SOURCE_DIR@/include/skyr/url/url_serialize.hpp
794+
INPUT = @Skyr_SOURCE_DIR@/include/skyr/config.hpp \
795+
@Skyr_SOURCE_DIR@/include/skyr/version.hpp \
796+
@Skyr_SOURCE_DIR@/include/skyr/unicode.hpp \
797+
@Skyr_SOURCE_DIR@/include/skyr/unicode/domain.hpp \
798+
@Skyr_SOURCE_DIR@/include/skyr/unicode/idna.hpp \
799+
@Skyr_SOURCE_DIR@/include/skyr/unicode/errors.hpp \
800+
@Skyr_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/byte_transform.hpp \
801+
@Skyr_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/u16_transform.hpp \
802+
@Skyr_SOURCE_DIR@/include/skyr/unicode/ranges/transforms/u32_transform.hpp \
803+
@Skyr_SOURCE_DIR@/include/skyr/unicode/ranges/views/u8_view.hpp \
804+
@Skyr_SOURCE_DIR@/include/skyr/unicode/ranges/views/u16_view.hpp \
805+
@Skyr_SOURCE_DIR@/include/skyr/url.hpp \
806+
@Skyr_SOURCE_DIR@/include/skyr/url/url_error.hpp \
807+
@Skyr_SOURCE_DIR@/include/skyr/url/url_parse.hpp \
808+
@Skyr_SOURCE_DIR@/include/skyr/url/url_record.hpp \
809+
@Skyr_SOURCE_DIR@/include/skyr/url/url_search_parameters.hpp \
810+
@Skyr_SOURCE_DIR@/include/skyr/url/url_serialize.hpp
811811

812812
# This tag can be used to specify the character encoding of the source files
813813
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

docs/conf.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def parse_version_header(version_header):
3939
return major, minor, patch
4040

4141

42-
version_header = '@CMAKE_SOURCE_DIR@/include/skyr/version.hpp'
42+
version_header = '@Skyr_SOURCE_DIR@/include/skyr/version.hpp'
4343
major, minor, patch = parse_version_header(version_header)
4444

4545

examples/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Copyright (c) Glyn Matthews 2018-19.
1+
# Copyright (c) Glyn Matthews 2018-20.
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6+
include(${Skyr_SOURCE_DIR}/cmake/SkyrFunctions.cmake)
67

78
set(
89
EXAMPLES
@@ -19,10 +20,17 @@ set(
1920
)
2021

2122
foreach(file_name ${EXAMPLES})
22-
_remove_extension(${file_name} example)
23+
remove_extension(${file_name} example)
2324
add_executable(${example} ${example}.cpp)
24-
add_dependencies(${example} skyr-url)
25-
target_link_libraries(
26-
${example} PRIVATE ${CMAKE_THREAD_LIBS_INIT} skyr-url)
27-
set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${Skyr_BINARY_DIR}/examples)
28-
endforeach ()
25+
add_dependencies(${example} Skyr::skyr-url)
26+
target_link_libraries(
27+
${example}
28+
PRIVATE
29+
Skyr::skyr-url
30+
)
31+
set_target_properties(
32+
${example}
33+
PROPERTIES
34+
RUNTIME_OUTPUT_DIRECTORY ${Skyr_BINARY_DIR}/examples
35+
)
36+
endforeach()

include/skyr/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#define SKYR_VERSION_MAJOR 1
1515
#define SKYR_VERSION_MINOR 4
16-
#define SKYR_VERSION_PATCH 1
16+
#define SKYR_VERSION_PATCH 2
1717

1818
#define SKYR_VERSION_STRING \
1919
SKYR_PREPROCESSOR_TO_STRING(SKYR_VERSION_MAJOR) "." \

src/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ endif()
6565

6666
add_library(skyr-url ${Skyr_SRCS})
6767

68-
target_link_libraries(skyr-url tl::expected)
68+
target_link_libraries(skyr-url PUBLIC tl::expected)
6969
if(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
7070
if (NOT Skyr_DISABLE_LIBCXX)
71-
target_link_libraries(skyr-url "c++")
71+
target_link_libraries(skyr-url PUBLIC "c++")
7272
endif()
7373
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
7474
if (Skyr_BUILD_FILESYSTEM_PATH_FUNCTIONS)
75-
target_link_libraries(skyr-url "stdc++fs")
75+
target_link_libraries(skyr-url PUBLIC "stdc++fs")
7676
endif()
7777
endif()
7878

@@ -81,20 +81,20 @@ set_target_properties(skyr-url PROPERTIES
8181
SOVERSION 1
8282
POSITION_INDEPENDENT_CODE ON)
8383

84-
add_library(Skyr::skyr-url ALIAS skyr-url)
85-
8684
target_include_directories(skyr-url
8785
PUBLIC
8886
$<INSTALL_INTERFACE:include>
8987
$<BUILD_INTERFACE:${Skyr_SOURCE_DIR}/include>
9088
PRIVATE
9189
${Skyr_SOURCE_DIR}/src)
9290

91+
add_library(Skyr::skyr-url ALIAS skyr-url)
92+
9393
#propagate sources to parent scope for one-lib-build
9494
set(Skyr_SRCS ${Skyr_SRCS} PARENT_SCOPE)
9595

9696
# Install
97-
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include DESTINATION ".")
97+
install(DIRECTORY ${Skyr_SOURCE_DIR}/include DESTINATION ".")
9898
install(TARGETS skyr-url
9999
ARCHIVE DESTINATION lib
100100
LIBRARY DESTINATION lib)

tests/CMakeLists.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Copyright (c) Glyn Matthews 2012-2019.
1+
# Copyright (c) Glyn Matthews 2012-2020.
22
# Distributed under the Boost Software License, Version 1.0.
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6+
include(${Skyr_SOURCE_DIR}/cmake/SkyrFunctions.cmake)
67

78
find_package(Catch2 CONFIG REQUIRED)
89
find_package(nlohmann_json CONFIG REQUIRED)
@@ -12,18 +13,23 @@ if (MSVC)
1213
add_definitions(-D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING)
1314
endif(MSVC)
1415

15-
function(_remove_extension file_name basename)
16-
string(REGEX REPLACE "\\.[^.]*$" "" _basename ${file_name})
17-
set(${basename} ${_basename} PARENT_SCOPE)
18-
endfunction()
1916

2017
function(_create_test file_name output_dir test_name)
21-
_remove_extension(${file_name} test)
18+
remove_extension(${file_name} test)
2219
add_executable(${test} ${test}.cpp)
2320
add_dependencies(${test} Skyr::skyr-url)
2421
target_link_libraries(
25-
${test} PRIVATE ${CMAKE_THREAD_LIBS_INIT} Skyr::skyr-url Catch2::Catch2 nlohmann_json nlohmann_json::nlohmann_json)
26-
set_target_properties(${test} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_dir})
22+
${test}
23+
PRIVATE
24+
Skyr::skyr-url
25+
Catch2::Catch2
26+
nlohmann_json::nlohmann_json
27+
)
28+
set_target_properties(
29+
${test}
30+
PROPERTIES
31+
RUNTIME_OUTPUT_DIRECTORY ${output_dir}
32+
)
2733
set(${test_name} ${test} PARENT_SCOPE)
2834
endfunction()
2935

0 commit comments

Comments
 (0)