0

Hi there my project has job.sh in a root dir

the file contains

#!/bin/bash

#SBATCH --job-name=$(REPLACEME)
#SBATCH --tasks=4
#SBATCH --computers=1

run ./myApp

now I would like to somehow copy the file to builddir as well as replace $(REPLACEME) with Project name

not sure how to do the reeplacing part, as copying it easy

file(GENERATE OUTPUT job.sh INPUT job.sh)

Thanks for Anwsering and Best Regards

Hojzerice
  • 35
  • 3

1 Answers1

0

I figured it out, you create a template file like job.sh in root dir that contains what you want and some CMAKE variables like ${CMAKE_PROJECT_NAME} for example

#!/bin/bash

#SBATCH --job-name=${CMAKE_PROJECT_NAME}
#SBATCH --tasks=4
#SBATCH --computers=1

run ./myApp

then in your CMakeLists.txt just do this

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/job.sh ${CMAKE_CURRENT_BINARY_DIR}/job.sh)
Hojzerice
  • 35
  • 3