diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2023-10-19 13:05:18 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2023-10-27 13:37:50 +0300 |
commit | 79549005b9116d7d990f3af5f3470f2bc692a264 (patch) | |
tree | 6c3bcaed34d8fc9488aee83f69b4c9aed5a841f6 /CMakeLists.txt | |
parent | 5896c28cd23ba76c9cd02253a59240a3dcbb42e0 (diff) |
Add GitHub workflow for testing CMake installation
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a6a7b0..d359c8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,16 @@ if(nanopb_BUILD_GENERATOR) install( FILES generator/__init__.py DESTINATION ${PYTHON_INSTDIR}/nanopb/ ) + # Include the full path to Python executable in Windows .bat scripts, in case it is not in PATH + if(WIN32) + file(READ generator/protoc-gen-nanopb.bat FILE_CONTENTS) + string(REPLACE "python" ${Python_EXECUTABLE} FILE_CONTENTS "${FILE_CONTENTS}") + file(WRITE ${PROJECT_BINARY_DIR}/protoc-gen-nanopb.bat "${FILE_CONTENTS}") + + file(READ generator/nanopb_generator.bat FILE_CONTENTS) + string(REPLACE "python" ${Python_EXECUTABLE} FILE_CONTENTS "${FILE_CONTENTS}") + file(WRITE ${PROJECT_BINARY_DIR}/nanopb_generator.bat "${FILE_CONTENTS}") + endif() endif() # Install small script wrappers to invoke the generator from the installed module @@ -93,8 +103,8 @@ if(WIN32) install( PROGRAMS extra/script_wrappers/nanopb_generator.py - generator/protoc-gen-nanopb.bat - generator/nanopb_generator.bat + ${PROJECT_BINARY_DIR}/protoc-gen-nanopb.bat + ${PROJECT_BINARY_DIR}/nanopb_generator.bat DESTINATION ${CMAKE_INSTALL_BINDIR} ) else() |