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

cmake: fix the build on windows #26783

Merged

Conversation

mbolivar-nordic
Copy link
Contributor

@mbolivar-nordic mbolivar-nordic commented Jul 9, 2020

Commit ef3c5e5 changed the way
WEST_TOPDIR is initialized from calling 'west topdir' as a subprocess
to using the west API.

However, WEST_TOPDIR is a cmake variable and must be a cmake-style
path, with forward slashes. While 'west topdir' as a command does
output a forward slash separated path (basically in order to make the
zephyr build system work), west_topdir() as an API returns the path in
the host environment path style, which on Windows uses backslashes.

This turns out to be the ultimate cause of the following build error:

CMake Error at C:/.../CheckCCompilerFlag.cmake:41 (set):
  Syntax error in cmake code when parsing string
    -fmacro-prefix-map=C:\Users\Marti\zp=WEST_TOPDIR

Fix it by converting to POSIX style in Python. We could have
potentially also done this using file(TO_CMAKE_PATH "${WEST_TOPDIR}"
...), but I'm intentionally repeating the old way of doing things
since it was known to work.

Signed-off-by: Martí Bolívar marti.bolivar@nordicsemi.no

Commit ef3c5e5 changed the way
WEST_TOPDIR is initialized from calling 'west topdir' as a subprocess
to using the west API.

However, WEST_TOPDIR is a cmake variable and must be a cmake-style
path, with forward slashes. While 'west topdir' as a command does
output a forward slash separated path (basically in order to make the
zephyr build system work), west_topdir() as an API returns the path in
the host environment path style, which on Windows uses backslashes.

This turns out to be the ultimate cause of the following build error:

CMake Error at C:/.../CheckCCompilerFlag.cmake:41 (set):
  Syntax error in cmake code when parsing string
    -fmacro-prefix-map=C:\Users\Marti\zp=WEST_TOPDIR

Fix it by converting to POSIX style in Python. We could have
potentially also done this using file(TO_CMAKE_PATH "${WEST_TOPDIR}"
...), but I'm intentionally repeating the old way of doing things
since it was known to work.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
@mbolivar-nordic mbolivar-nordic added Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. priority: high High impact/importance bug labels Jul 9, 2020
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduced the issue in master (d0e36f2) and can confirm this PR fixes it.

@mbolivar-nordic mbolivar-nordic added the bug The issue is a bug, or the PR is fixing a bug label Jul 9, 2020
@nashif nashif merged commit a043d48 into zephyrproject-rtos:master Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. priority: high High impact/importance bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants