Skip to content

[Question] Select the compiler used to generate tests #118

@josephgarnier

Description

@josephgarnier

Hello dead dev,

On Windows, the compiler selected by CMakeTest to generate or run tests is MSVC.

Image

How can I select a different one? I couldn't figure out how to change this parameter despite 2 hours of digging through the code.

I'm using GCC to compile a static lib for testing CMake modules and the Makefile generator. It therefore has the '.a' extension. But then my tests fail, because MSVC expects to find a lib with the extension '.lib'.

Here's an example of how the choice of compiler affects CMake variable values:

# With GCC
# CMAKE_SHARED_LIBRARY_PREFIX: lib
# CMAKE_SHARED_LIBRARY_SUFFIX: .dll
# CMAKE_STATIC_LIBRARY_PREFIX: lib
# CMAKE_STATIC_LIBRARY_SUFFIX: .a
# CMAKE_FIND_LIBRARY_PREFIXES: lib;
# CMAKE_FIND_LIBRARY_SUFFIXES: .dll.a;.a;.lib

# With MSVC
# CMAKE_SHARED_LIBRARY_PREFIX: 
# CMAKE_SHARED_LIBRARY_SUFFIX: .dll
# CMAKE_STATIC_LIBRARY_PREFIX: 
# CMAKE_STATIC_LIBRARY_SUFFIX: .lib
# CMAKE_FIND_LIBRARY_PREFIXES: ;lib
# CMAKE_FIND_LIBRARY_SUFFIXES: .dll.lib;.lib;.a

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions