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

if(${Coverage_BASE_DIRECTORY}) evaluates wrongly #55

Open
gvergine opened this issue Nov 21, 2020 · 0 comments
Open

if(${Coverage_BASE_DIRECTORY}) evaluates wrongly #55

gvergine opened this issue Nov 21, 2020 · 0 comments

Comments

@gvergine
Copy link

gvergine commented Nov 21, 2020

Hello,

I have a problem defining the BASE_DIRECTORY in CodeCoverage.cmake:

if(${Coverage_BASE_DIRECTORY})

I think if(${Coverage_BASE_DIRECTORY}) evaluates wrongly, probably should be without the parenthesis.

Here I attache a small test:

project(Test)
cmake_minimum_required(VERSION 3.5)
function(f)
    set(options NO_DEMANGLE)
    set(oneValueArgs BASE_DIRECTORY NAME)
    set(multiValueArgs EXCLUDE EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES LCOV_ARGS GENHTML_ARGS)
    cmake_parse_arguments(Coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
    message("Coverage_BASE_DIRECTORY should be defined as ${Coverage_BASE_DIRECTORY}")
    if(${Coverage_BASE_DIRECTORY})
        message("but is defined as ${Coverage_BASE_DIRECTORY}")
    else()
        message("but is not defined")
    endif()
    if(Coverage_BASE_DIRECTORY)
        message("[with fix]: is defined as ${Coverage_BASE_DIRECTORY}")
    else()
        message("[with fix]: is not defined")
    endif()
endfunction()
f(BASE_DIRECTORY "TEST1")
f()

That on my machine (amd64, ubuntu 20.04, cmake 3.16) produces:

Coverage_BASE_DIRECTORY should be defined as TEST1
but is not defined
[with fix]: is defined as TEST1
Coverage_BASE_DIRECTORY should be defined as 
but is not defined
[with fix]: is not defined

I found this line because I'm using lcov, but probably same thing applies for gcov sections.

Cheers!

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

1 participant