Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Utils
source-formatters
Commits
182454db
Commit
182454db
authored
Mar 29, 2018
by
Brad King
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: teach add_formatter to support configured formatters
Check in the build tree before the source tree.
parent
a3a0f318
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
src/CMakeLists.txt
src/CMakeLists.txt
+15
-3
No files found.
src/CMakeLists.txt
View file @
182454db
...
...
@@ -19,12 +19,18 @@ function (add_formatter name type)
endif
()
endforeach
()
if
(
EXISTS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/format.
${
name
}
"
)
set
(
script
"
${
CMAKE_CURRENT_BINARY_DIR
}
/format.
${
name
}
"
)
else
()
set
(
script
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/format.
${
name
}
"
)
endif
()
set_property
(
GLOBAL APPEND
PROPERTY formatters
"
${
name
}
"
)
set_property
(
GLOBAL APPEND
PROPERTY
"formatter_
${
name
}
_tools"
"
${
tools_exist
}
"
)
set_property
(
GLOBAL APPEND
PROPERTY
"formatter_
${
name
}
_script"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/format.
${
name
}
"
)
PROPERTY
"formatter_
${
name
}
_script"
"
${
script
}
"
)
option
(
"ENABLE_
${
name
}
"
"Install the
${
tool
}
formatter script"
"
${
tools_exist
}
"
)
...
...
@@ -41,12 +47,18 @@ function (add_formatter name type)
endfunction
()
function
(
install_formatter name
)
get_property
(
script GLOBAL PROPERTY
"formatter_
${
name
}
_script"
)
install
(
PROGRAMS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/format.
${
name
}
"
PROGRAMS
"
${
script
}
"
DESTINATION
"bin"
COMPONENT
"formatters"
)
if
(
EXISTS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
name
}
.yaml.in"
)
set
(
yaml_in
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
name
}
.yaml.in"
)
else
()
set
(
yaml_in
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
name
}
.yaml.in"
)
endif
()
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
name
}
.
yaml
.
in"
"
${
yaml
_
in
}
"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
name
}
.yaml"
@ONLY
)
install
(
...
...
Brad King
@brad.king
mentioned in commit
3fff801d
·
May 31, 2018
mentioned in commit
3fff801d
mentioned in commit 3fff801d498775c76e019de8ffe12998e902bf0b
Toggle commit list
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