cmake: resolve IMPORTED executables in custom commands (fixes #7509)
parent
0fc3e456d8
commit
535a2d7285
5 changed files with 49 additions and 5 deletions
@ -0,0 +1,15 @@ |
||||
cmake_minimum_required(VERSION 3.5) |
||||
|
||||
project(cmMod) |
||||
|
||||
message(STATUS "CMAKE_MODULE_PATH: '${CMAKE_MODULE_PATH}'") |
||||
|
||||
find_package(SomethingLikePython REQUIRED) |
||||
|
||||
add_custom_command( |
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main.c" |
||||
COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/gen.py" |
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" |
||||
) |
||||
|
||||
add_executable(main "${CMAKE_CURRENT_BINARY_DIR}/main.c") |
@ -0,0 +1,9 @@ |
||||
with open('main.c', 'w') as fp: |
||||
print(''' |
||||
#include <stdio.h> |
||||
|
||||
int main(void) { |
||||
printf(\"Hello World\"); |
||||
return 0; |
||||
} |
||||
''', file=fp) |
Loading…
Reference in new issue