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

SystemCLanguageTargets.cmake placed in wrong directory when using CMake FetchContent with SystemC #96

Open
Jench2103 opened this issue Oct 6, 2024 · 1 comment

Comments

@Jench2103
Copy link

Hi, I encountered a problem while using the CMake FetchContent to set up SystemC as a dependency library of my project.

Once a clean build finishes, the SystemCLanguageTargets.cmake is put in an incorrect location (i.e., build/) rather than the folder expected by build/_deps/systemclanguage-build/SystemCLanguageConfig.cmake (i.e., build/_deps/systemclanguage-build/). I expect the SystemCLanguageTargets.cmake file to be placed in the same folder as SystemCLanguageConfig.cmake.

Note that a clean build can finish without any errors. However, starting from the second time CMake configures the project, the following error occurs:

CMake Error at build/_deps/systemclanguage-build/SystemCLanguageConfig.cmake:44 (include):
  include could not find requested file:

    /home/user/projects/systemc-test/build/_deps/systemclanguage-build/SystemCLanguageTargets.cmake
Call Stack (most recent call first):
  /usr/local/lib/python3.10/dist-packages/cmake/data/share/cmake-3.25/Modules/FetchContent.cmake:1951 (find_package)
  CMakeLists.txt:14 (fetchcontent_makeavailable)

Steps to Reproduce

Here is a simple example for anyone to reproduce the issue.

  • File Structure
    .
    ├── build/
    ├── CMakeLists.txt
    └── main.cc
    
  • CMakeLists.txt
    include(FetchContent)
    
    cmake_minimum_required(VERSION 3.25)
    
    project(test)
    
    fetchcontent_declare(
        SystemCLanguage
        GIT_REPOSITORY https://github.com/accellera-official/systemc.git
        GIT_TAG 3.0.0
        FIND_PACKAGE_ARGS
    )
    
    fetchcontent_makeavailable(SystemCLanguage)
    
    add_executable(test main.cc)
    target_link_libraries(test SystemC::systemc)
  • main.cc
    int main() {
    	return 0;
    }
  • Commands for a Clean Build
    mkdir build
    cd build
    cmake ..
    cmake --build . -j
  • Commands for the Second Configuration (which will result in the above error):
    cd build
    cmake ..

Development Environment

  • OS: Ubuntu 22.04
  • Compiler: GCC 11.4.0
  • CMake Version: 3.25.0

Please let me know if more details are needed, or if there's a known workaround.

@lmailletcontoz
Copy link
Contributor

thanks for the feedback. The LWG will investigate the issue.

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