And if you want to make it work before Nim has generated the C files, use a 
dummy source file, such as nimbase.h:
    
    
    # Get the Nim include path to get nimbase.h
    execute_process(
      COMMAND nim "--verbosity:0" "--eval:import std/os; echo 
getCurrentCompilerExe().parentDir.parentDir / \"lib\""
      OUTPUT_VARIABLE NIM_INCLUDE_PATH
      OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    if(NOT NimSources)
      # Nim project hasn't been built yet, so we need some source file... 
nimbase will do!
      # It won't actually get compiled, it's just during initial configure step
      set(NimSources ${NIM_INCLUDE_PATH}/nimbase.h)
    endif()
    
    ...
    add_executable(${OUTPUT_NAME} ${NimSources})
    
    ...
    target_include_directories(${OUTPUT_NAME} PUBLIC ${NIM_INCLUDE_PATH})
    
    
    Run

Reply via email to