How to set CMAKE variables in Visual Studio on Ubuntu side

I am building python files using CMAKE on Ubuntu side.
My CmakeLists.txt looks as below.



execute_process(COMMAND python

set_target_properties(myhtml PROPERTIES LINKER_LANGUAGE myhtml)

I am able to build this on Windows side but i am facing below error when i tried building on Ubuntu side.
Below is the error message.
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:

Please help me to solve this error.

What do you want to happen? There is nothing to compile for a Python file. is my python script. And i am providing inputs files in txt format. Output of the script is HTML report.
If i run script alone its running fine and html report is generating.
When i try to run using cmake build (cmake …) i am facing the above error which i have described.

myhtml is a script but not an executable. Some operating systems can execute it when the interpreter is configured. Here, the executable is “python” that you should find first with find_package to make your CMake code portable.

There is also no known LINKER_LANGUAGE named “myhtml” (that’s where this error comes from).

CMake doesn’t have an abstraction for executables that it does not compile (there are IMPORTED executables, but this doesn’t really work with Python scripts without shebang lines or other system configuration controlling the interpreter to make the file itself directly executable). I filed an issue for that a while ago.

The issue is resolved by updating the CMakelists.txt as below.

cmake_minimum_required(VERSION 3.15)

set (py_cmd “”)
message(STATUS “Python result:” ${py_result1})