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

CLion support #175

Open
TaxMachine opened this issue Jan 13, 2025 · 4 comments
Open

CLion support #175

TaxMachine opened this issue Jan 13, 2025 · 4 comments

Comments

@TaxMachine
Copy link

I'm trying to get it work as a CLion Toolchain but when I set the compiler like this

CMake: Bundled
Build Tool: Detected: Ninja
C Compiler: /home/taxmachine/msvc/bin/x86/cl
C++ Compiler: /home/taxmachine/msvc/bin/x86/cl
Debugger: Bundled GDB

I get this error "Test CMake run finished with errors"

-- The C compiler identification is MSVC 19.42.34435.0
-- The CXX compiler identification is MSVC 19.42.34435.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/taxmachine/msvc/bin/x86/cl
-- Check for working C compiler: /home/taxmachine/msvc/bin/x86/cl - broken
CMake Error at /home/taxmachine/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/home/taxmachine/msvc/bin/x86/cl"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/tmp/cmake_check_environment/_build143599532081475529/CMakeFiles/CMakeScratch/TryCompile-GwiSiI'
    
    Run Build Command(s): /home/taxmachine/.local/share/JetBrains/Toolbox/apps/clion/bin/ninja/linux/x64/ninja -v cmTC_d16ca
    [1/2] /home/taxmachine/msvc/bin/x86/cl    -o CMakeFiles/cmTC_d16ca.dir/testCCompiler.c.o -c /tmp/cmake_check_environment/_build143599532081475529/CMakeFiles/CMakeScratch/TryCompile-GwiSiI/testCCompiler.c
    Microsoft (R) C/C++ Optimizing Compiler Version 19.42.34435 for x86
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
    testCCompiler.c
    [2/2] : && /home/taxmachine/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/bin/cmake -E rm -f libcmTC_d16ca.a && /home/taxmachine/msvc/bin/x86/lib qc libcmTC_d16ca.a  CMakeFiles/cmTC_d16ca.dir/testCCompiler.c.o && :
    FAILED: libcmTC_d16ca.a 
    : && /home/taxmachine/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/bin/cmake -E rm -f libcmTC_d16ca.a && /home/taxmachine/msvc/bin/x86/lib qc libcmTC_d16ca.a  CMakeFiles/cmTC_d16ca.dir/testCCompiler.c.o && :
    Microsoft (R) Library Manager Version 14.42.34435.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    LINK : fatal error LNK1181: cannot open input file 'qc'
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!

Error code: 1
@mstorsjo
Copy link
Owner

Can you add some option to indicate that you're cross compiling for a Windows target, similar to -DCMAKE_SYSTEM=Windows on the command line? It looks like it tries to invoke the lib.exe command with Unix ar style options, so it somehow seems to not have picked up the fact that the tools should be invoked with MSVC style options, even if it did say The C compiler identification is MSVC 19.42.34435.0.

@TaxMachine
Copy link
Author

my CMakeLists looks like this

cmake_minimum_required(VERSION 3.30)
project(some_project)

set(CMAKE_GENERATOR_PLATFORM Win32)  # Force 32-bit compilation
set(CMAKE_SYSTEM_PROCESSOR x86)      # Specify x86 architecture
set(CMAKE_SYSTEM_NAME Windows)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /MTd")
file(GLOB_RECURSE SOURCES "src/**")


add_library(some_project SHARED ${SOURCES})

target_link_libraries(some_project PRIVATE "${CMAKE_SOURCE_DIR}\\libs\\detours.lib")

@mstorsjo
Copy link
Owner

I think some of these variables need to be set already at the time of the project() statement, either set on the command line or via a cmake toolchain file. Or what if you move the CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_PROCESSOR and CMAKE_GENERATOR_PLATFORM options to the top of the file before project()?

@TaxMachine
Copy link
Author

nop same error

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