-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
emcmake breaks CMAKE_PREFIX_PATH #19243
Comments
I don't think this is intended behaviour. Do you have any idea how or why this might happen? |
I was hoping you might. :) I've been doing a binary search through the cross-compiling file (https://github.com/emscripten-core/emscripten/blob/main/cmake/Modules/Platform/Emscripten.cmake) and seeing what I have to disable to make this work. I can make it work with the following two places both commented out (but not separately):
emscripten/cmake/Modules/Platform/Emscripten.cmake Lines 245 to 247 in cb5ca6e
I have no idea why the first one needs to be commented. The second one doesn't seem like it should affect the PREFIX_PATH search given its description, and when used directly without the toolchain file, it doesn't seem to. I'm wondering if multiple settings are conflicting and exposing a bug in CMake, or if there's some setting somewhere else I'm not aware of. Really don't know why that first line affects anything. |
I can reproduce this in pure CMake: cmake_minimum_required(VERSION 3.15...3.26)
project(CMCheck LANGUAGES CXX)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pre")
list(APPEND CMAKE_FIND_ROOT_PATH "/emsdk/upstream/emscripten")
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
find_package(CheckMe CONFIG REQUIRED) Setting both of these causes CMAKE_PREFIX_PATH to be ignored. Removing There's also a possible workaround: |
I'm working around this for now in scikit-build/scikit-build-core#303. Not extremely happy with the workaround, so still would like to work out if this the expected behavior from CMake. |
Emscripten.cmake should set Otherwise, the only way to get packages found using |
Maybe? This is something best investigated with a proper SDK setup to see how it behaves under different settings. |
The only approach that worked is passing I've tried all these to no effect:
Interestingly, passing |
If I use emcmake,
CMAKE_PREFIX_PATH
breaks. For example, the following CMake file:And the following file in
pre/CheckMeConfig.cmake
:Produces the expected message if run on the host CMake, but when run through emcmake, it produces:
Is this expected? A bug with CMake I should report there, like faulty platform logic? Setting
CheckMe_DIR
works.Version of emscripten/emsdk:
CMAKE_FIND_USE_CMAKE_PATH
andCMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
are not set to false.(This is breaking the CMake based Python build backends scikit-build-core in Pyodide, which discovers the header only pybind11 via this method, FYI)
The text was updated successfully, but these errors were encountered: