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

Problem with clang-cl toolchain on windows (and solution) #311

Open
martenrichter opened this issue Nov 18, 2023 · 1 comment
Open

Problem with clang-cl toolchain on windows (and solution) #311

martenrichter opened this issue Nov 18, 2023 · 1 comment

Comments

@martenrichter
Copy link

First, thank you for the cmake-js build system.

Recently, I had to update to the current cmake-js version.
Unfortunately, the following code stopped working, which worked before:

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  # Generate node.lib
  execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()

I am using the clang-cl toolchain and it turns out that CMAKE_AR now points to lib of llvm, which does support the /def: input. As it turns out link of llvm instead supports the /def: input, so replacing CMAKE_AR with CMAKE_LINKER does the trick:

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  # Generate node.lib
  execute_process(COMMAND ${CMAKE_LINKER} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()

I know that is not really an problem/issue, but since I spend half a day, chaising this, I thought documenting it, may save someone's day.

@Julusian
Copy link
Collaborator

unfortonately that change does not work for msvc, so this needs a paragraph of documentation and cant simply be changing the examples

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

No branches or pull requests

2 participants