Skip to content

Conversation

@dgbeliveau
Copy link
Contributor

The correct syntax here is ${VARIABLE:-REPLACEMENT}. The dash is part of the operator.

Since the replacement also needs to start with a dash, two dashes are required.

For instance:

CMAKE_OPTS="${CMAKE_OPTS:-DBUILD_SHARED_LIBS=OFF}"
echo $CMAKE_OPTS

Will output

DBUILD_SHARED_LIBS=OFF

And

CMAKE_OPTS="${CMAKE_OPTS:--DBUILD_SHARED_LIBS=OFF}"
echo $CMAKE_OPTS

Will output

-DBUILD_SHARED_LIBS=OFF

This issue was causing the -DBUILD_SHARED_LIBS=OFF default to be ignored if a user did not set CMAKE_OPTS:

2023-09-06T22:39:53.3228622Z cmake -DMAC_ARCH=x86_64 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PACKAGE_TYPE=deb -DCMAKE_CXX_FLAGS="-DHAVE_MAT_EVT_TRACEID=1" DBUILD_SHARED_LIBS=OFF ..

CMake Warning:
  Ignoring extra path from command line:

   "/mnt/s/out/DBUILD_SHARED_LIBS=OFF"

The correct syntax here is `${VARIABLE:-REPLACEMENT}`. Since the
replacement also needs to start with a dash, two dashes are required.
Copy link
Contributor

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix.

Copy link
Contributor

@ThomsonTan ThomsonTan left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

@ThomsonTan ThomsonTan merged commit dee05c0 into microsoft:main Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants