2 projects for Windows & Linux respectively but with single code base
Answered
Can anyone please tell me, can i have 2 projects for CLion ( i mean dirs with .idea subdir or something ), one for windows one for linux, but they have to access ONE source directory, containing CMakeLists.txt.
What for: crossplatform development with testing on a live hardware via dual-boot
Seems like "Cahnge project root" is not what i'm looking for. And i tried to make generation configurations in a single project (one for windows, other for linux), but they are configuring simultaneously, and give a side effects, such as: creating directory for configuration, intended for opposite OS.
Help? :-)
Please sign in to leave a comment.
You can achieve it in of hacky way: Have two dummy CMakeLists.txt which will `add_subdirectory()` the correct sources like:
- linux-dir/CMakeLists.txt: add_subdirectory(../src)
- windows-dir/CMakeLists.txt: add_subdirectory(../src)
- src/...: the actual sources
Then you can open these different "projects" separately. Does that help?
Looks like that did the trick, thanks a million! :-)
One more notice: add_subdirectory() call MUST have a second parameter in this case - binary directory, to complete configuration. Like this:
add_subdirectory( ../src bin-dir )
we will have bin-dir under cmake-build-debug in this case.