Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"-DCMAKE_C_FLAGS" in local.mk is ignored? #25754

Closed
sys9kdr opened this issue Oct 23, 2023 · 2 comments · Fixed by #25760
Closed

"-DCMAKE_C_FLAGS" in local.mk is ignored? #25754

sys9kdr opened this issue Oct 23, 2023 · 2 comments · Fixed by #25760
Assignees
Labels
bug issues reporting wrong behavior

Comments

@sys9kdr
Copy link
Contributor

sys9kdr commented Oct 23, 2023

Problem

I set -DCMAKE_C_FLAGS in local.mk and built neovim.
But CMAKE_C_FLAGS is missed in :verbose version.

"-DCMAKE_C_FLAGS" in local.mk is ignored?

# local.mk
CMAKE_BUILD_TYPE := RelWithDebInfo
CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-O3 -march=native -flto"
:verbose version
NVIM v0.10.0-dev-5e5f517
Build type: RelWithDebInfo
LuaJIT 2.1.1697887905
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-protot
ypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-a
ttribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-co
lor=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -D
NVIM_TS_HAS_SET_MAX_START_DEPTH -I/home/myname/workspace/neovim/.deps/usr/include/luajit-2.1 -I/usr
/include -I/home/myname/workspace/neovim/.deps/usr/include -I/home/myname/workspace/neovim/build/s
rc/nvim/auto -I/home/myname/workspace/neovim/build/include -I/home/myname/workspace/neovim/build/c
make.config -I/home/myname/workspace/neovim/src

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info
Press ENTER or type command to contin

Steps to reproduce

  1. create local.mk at project root.
# local.mk
CMAKE_BUILD_TYPE := RelWithDebInfo
CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-O3 -march=native -flto"
  1. make and sudo make install

  2. nvim and :verbose version. options I set in are missed.

:verbose version
NVIM v0.10.0-dev-5e5f517
Build type: RelWithDebInfo
LuaJIT 2.1.1697887905
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-protot
ypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-a
ttribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-co
lor=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -D
NVIM_TS_HAS_SET_MAX_START_DEPTH -I/home/myname/workspace/neovim/.deps/usr/include/luajit-2.1 -I/usr
/include -I/home/myname/workspace/neovim/.deps/usr/include -I/home/myname/workspace/neovim/build/s
rc/nvim/auto -I/home/myname/workspace/neovim/build/include -I/home/myname/workspace/neovim/build/c
make.config -I/home/myname/workspace/neovim/src

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info
Press ENTER or type command to contin

Expected behavior

Compilation: /usr/bin/cc -O3 -march=native -flto ... is displayed in :verbose version.

Neovim version (nvim -v)

NVIM v0.10.0-dev-5e5f517

Vim (not Nvim) behaves the same?

Operating system/version

Ubuntu 22.04(WSL)

Terminal name/version

wsltty

$TERM environment variable

xterm

Installation

build from repo

@sys9kdr sys9kdr added the bug issues reporting wrong behavior label Oct 23, 2023
@dundargoc
Copy link
Member

dundargoc commented Oct 23, 2023

Nah, they're not ignored, they're just not shown in version output. Grep the build files for the flags you're looking for and they should be there.

I think the flags in CMAKE_C_FLAGS aren't added to version currently. I'll take a look.

@dundargoc dundargoc self-assigned this Oct 23, 2023
@sys9kdr
Copy link
Contributor Author

sys9kdr commented Oct 23, 2023

I found that line in ./cmake.config/versiondef.h.in

#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$<CONFIG:Debug>:${CMAKE_C_FLAGS_DEBUG}>$<$<CONFIG:Release>:${CMAKE_C_FLAGS_RELEASE}>$<$<CONFIG:RelWithDebInfo>:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$<CONFIG:MinSizeRel>:${CMAKE_C_FLAGS_MINSIZEREL}> $<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_OPTIONS>, > -D$<JOIN:$<TARGET_PROPERTY:nvim,COMPILE_DEFINITIONS>, -D> -I$<JOIN:$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:nvim,INCLUDE_DIRECTORIES>>, -I>"

there is no CMAKE_C_FLAGS.

dundargoc added a commit to dundargoc/neovim that referenced this issue Oct 23, 2023
dundargoc added a commit to dundargoc/neovim that referenced this issue Oct 23, 2023
dundargoc added a commit that referenced this issue Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants