How to build files so they appear in the project?

The issues I am having with the build system is it ignores the changes I do in the settings.

I change the default build location to a Build folder I make within the project and yes indeed it outputs the exe to that folder, but every other file generated is still going to the generated folder setup as the default binary location.

When attempted to change that directory from:
C:/Users/Kravyn/.clion10/system/cmake/generated/55281134/55281134/__default__
to
D:/Documents/ClionProjects/Cmake Testing/Build/__default__

As soon as saved it refuses to save the new Binary Directory and reverts.

I would prefer to beable to see the changes through the file structure but this does not happen because of its defaulting to a unwanted location and in their own folders like the debug/release exactly as the generated folder has it.

So any fix for this? besides set CMAKE_RUNTIME_OUTPUT_DIRECTORY or Cmake_Testing_BINARY_DIR since it always reverts to the generated folder on save.
I have tried using CMAKE_BINARY_DIR but it never showed in my cache.

Even tried to force it as an Install:

 
INSTALL(TARGETS ${EXECUTABLE_NAME}
    RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/Build/Debug/bin
    LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/Build/Debug/lib
    CONFIGURATIONS Debug
)

 
INSTALL(TARGETS ${EXECUTABLE_NAME}
    RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/Build/Release/bin/
    LIBRARY DESTINATION ${PROJECT_SOURCE_DIR}/Build/Release/lib/
    CONFIGURATIONS Release
)
3 comments
Comment actions Permalink

Unfortunately, it is not possible to override the binary directory.

0
Comment actions Permalink

I'd like to clarify the behavior that affects CMAKE_RUNTIME_OUTPUT_DIRECTORY (and corresponding variables for libraries).

CLion passes "Build path" setting as a value for these variables to CMake using "-D" option (even if "Build path" is empty). So, if you want to change the output directory, you have two options:

1) Use CLion's "Build path" setting
2) Set it directly in CMakeLists.txt by doing something like this:

set_target_properties(MyTarget PROPERTIES RUNTIME_OUTPUT_DIRECTORY /my/path)

0
Comment actions Permalink

or perhaps there is a 3rd  way
3) create cmakesh, that will filter what to pass to real cmake binary

though this way looks like starting a war with CLion which cannot be good

0

Please sign in to leave a comment.