mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.58k stars 1.62k forks source link

Meson mangles MSVC flags beginning with L if specified with a dash #11670

Open amyspark opened 1 year ago

amyspark commented 1 year ago

Describe the bug

The /LINKREPRO:xxx flag is needed to compile a linker test case for Microsoft.

However, specifying it with a dash (-Dcpp_link_args=-LINKREPRO:msvc or cpp_link_args: '-LINKREPRO:MSVC') results in Meson thinking it's a library link flag, so it gets mangled into LINK_ARGS = "/LIBPATH:INKREPRO:MSVC".

To Reproduce

meson.build:

project('doxygen test', 'cpp', version : '0.1.0')

spede_inc = include_directories('include')

spede_src = [ 'src/spede.cpp' ]

spede_lib = library('spede', spede_src, include_directories: spede_inc, link_args: ['-LINKREPRO:MSVC']) 

srcs/spede.cpp

#include<spede.h>

/**
 * \file spede.cpp
 *
 * This file contains the implementation of the king of comedy.
 */

/**
 * \mainpage The Vast Comedian Project
 *
 * \section intro Introduction
 *
 * The purpose of this project is to model every single comedian
 * who has ever lived.
 *
 * \section sched Project schedule
 *
 * There is no real estimate on when this will be finished.
 */

/**
 * \namespace Comedy
 *
 * This contains everything that is funny.
 */

namespace Comedy {

/**
 * Do all the delicate movements that lead to a comical sound
 * emanating from a person.
 *
 * \param force how hard to move the hand.
 * \return something or another
 */
int gesticulate(int force) {
    // FIXME add implementation.
    return 0;
}

Spede::Spede() : num_movies(100) {
}

void Spede::slap_forehead() {
    gesticulate(42);
}

}

Expected behavior

Compilation should succeed once the MSVC folder is created in the build folder.

system parameters

bruchar1 commented 1 year ago

msvc compiler accepts /LN and /link options. msvc linker accepts /LARGEADDRESSAWARE, /LIBPATH, /LINKREPRO, /LINKREPROTARGET, /LTCG, /LTCGOUT options.

we should probably also check for options beginning with /I...