# Multiple development enviroments with GLFW

**URL:** <https://discourse.glfw.org/t/multiple-development-enviroments-with-glfw/1332>\
**Category:** support\
**Created:** [May 23, 2019, 11:53pm UTC](https://discourse.glfw.org/t/multiple-development-enviroments-with-glfw/1332 "2019-05-23T23:53:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![McRaeAlex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mcraealex/32/255_2.png) [@McRaeAlex](https://discourse.glfw.org/u/McRaeAlex)\
**Post date:** [May 23, 2019, 11:53pm UTC](https://discourse.glfw.org/t/multiple-development-enviroments-with-glfw/1332/1 "2019-05-23T23:53:22Z")

</div>

Essentially, I switch between linux and windows a lot. But I want to learn opengl using one github repo. In the compiling section it says “CMake only generates project files or makefiles. It does not compile the actual GLFW library. To compile GLFW, first generate these files for your chosen development environment and then use them to compile the actual GLFW library.” which I get but I don’t know how to allow this to not create them for my one development environment. Do I compile it for each environment separately and put it in a lib/ directory then include that in .gitignore? will that work? Is that they best way to go about this? Thanks for help! I am new to C++ and OpenGL.

If it helps my directory structure is as follows:  
\lib  
\bin  
\src  
main.cpp  
glad.c  
\include  
\glad  
glad.h  
\KHR  
khrplatform.h  
make  
README.md

---

<div class="post-metadata">

**Author:** ![ThomasL81](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/thomasl81/32/256_2.png) [@ThomasL81](https://discourse.glfw.org/u/ThomasL81)\
**Post date:** [May 25, 2019, 6:56am UTC](https://discourse.glfw.org/t/multiple-development-enviroments-with-glfw/1332/2 "2019-05-25T06:56:34Z")

</div>

Hi,

The documentation is right in a sense that CMake doesn’t compile the libraries. It prepares the project files for your toolchain on your platform (like VS on windows or clang or gcc on linux or mac). CMake makes this complete platform agnostic.

EDIT: I see you use make. I suggest you switch to CMake. It will generate the make files automatically if your toolchain requires make files.

I use GLFW in a multi-platform environment as well along with CMake.

I use the following procedrue:

- clone GLFW git repo as a submodule (for this example, I assume you clone it into the ./glfw folder).
- in your root CMakeFiles.txt, you add:  
`add_subdirectory( glfw )`
- in your CMakeFiles.txt where your add\_executable statement resides, you simply do:  
`target_link_libraries( <proj_name> glfw )`

And you’re done!  
Now each time you build, GLFW is built along with your project as a dependency.

Let me know if you require more input.

---

<div class="post-metadata">

**Author:** ![McRaeAlex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mcraealex/32/255_2.png) [@McRaeAlex](https://discourse.glfw.org/u/McRaeAlex)\
**Post date:** [May 26, 2019, 10:13pm UTC](https://discourse.glfw.org/t/multiple-development-enviroments-with-glfw/1332/3 "2019-05-26T22:13:42Z")

</div>

Hey thanks for the reply! I will definitely do this! I just wish there was a easier way!
