Skip to main content
Clarify
Source Link

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

If you disagree with my first point and want to put the file into CMakeFiles (and you're willing to accept that you'll be relying on apparently stable, but undocumented and not guaranteed CMake behaviour), you can instead write the file into ${CMAKE_BINARY_DIR}/CMakeFiles/whatever.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

If you disagree with my first point and want to put the file into CMakeFiles (and you're willing to accept that you'll be relying on stable, but undocumented and not guaranteed CMake behaviour), you can instead write the file into ${CMAKE_BINARY_DIR}/CMakeFiles/whatever.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

If you disagree with my first point and want to put the file into CMakeFiles (and you're willing to accept that you'll be relying on apparently stable, but undocumented and not guaranteed CMake behaviour), you can instead write the file into ${CMAKE_BINARY_DIR}/CMakeFiles/whatever.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

React to comments
Source Link

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

If you disagree with my first point and want to put the file into CMakeFiles (and you're willing to accept that you'll be relying on stable, but undocumented and not guaranteed CMake behaviour), you can instead write the file into ${CMAKE_BINARY_DIR}/CMakeFiles/whatever.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

If you disagree with my first point and want to put the file into CMakeFiles (and you're willing to accept that you'll be relying on stable, but undocumented and not guaranteed CMake behaviour), you can instead write the file into ${CMAKE_BINARY_DIR}/CMakeFiles/whatever.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.

Source Link

Regarding the "generate from string" option your are considering: CMakeFiles is internal to CMake and not intended for projects to access manually, but nothing prevents you from using file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/whatever contents) to dump the file somewhere into the binary directory and try_run() it from there.

And if you decide to keep it as an actual file, since as you say it's local to the CMake module, I'd be inclined to put it alongside the module itself: into cmake/Modules.