CMake generator expression is not being evaluated

前端 未结 2 1997
情话喂你
情话喂你 2021-02-20 12:40

Due to the following warning:

CMake Error at test/CMakeLists.txt:29 (get_target_property):
  The LOCATION property may not be read from target \"my_exe\".  Use t         


        
2条回答
  •  忘掉有多难
    2021-02-20 13:13

    Here is a quick and easy way to print the value of a generator expression:

    add_custom_target(print
            ${CMAKE_COMMAND} -E echo $<1:hello> $<0:world>
        )
    

    In this example, if you run cmake . and then make print, you will see "hello" (without the quotation marks) in the output.

    However, if you just use message($<1:hello> $<0:world>), you will see "$<1:hello> $<0:world>" as output (again, without the quotation marks).

提交回复
热议问题