Closed sanssecours closed 5 years ago
You can disable the autosort
config as a work-around.
Ok, I added parsers for the non-"normal" add_library()
forms. They are in the branch stage_v0.5.2
(here) if you'd like to try. I definitely should have done that before defaulting to autosort=on
. I forgot that there were additional forms of this command. I'll need to add additional forms for add_executable()
too.
Also, as a note to myself: autosort will also break if the command form descriminator is hidden behind a cmake variable. For example:
set(libtype OBJECT)
add_library(foobar ${libtype} bar.cc baz.cc foo.cc)
same happens for ALIAS:
# correct
add_library(my_proj::my_comp
ALIAS
${PROJECT_NAME}_my_comp
)
# not correct
add_library(my_proj::my_comp
${PROJECT_NAME}_my_comp
ALIAS)
@gocarlos I believe this case is already covered in stage_v0.5.2
(here) but if you are seeing this on that branch please let me know:
Closed in v0.5.2
Steps to Reproduce
Create a file
test.cmake
with the following content:Run
cmake-format
:Expected Result
The command
cmake-format
prints a nicely formatted version of the given CMake code.Actual Result
cmake format breaks the
add_library
function call, since it moves the keywordOBJECT
:.
System Information
0.5.1
10.14.4