# Build and install Julia from source code with cmake

**URL:** <https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483>\
**Category:** General Usage\
**Created:** [July 1, 2024, 4:38pm UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483 "2024-07-01T16:38:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatriceLebrun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricelebrun/32/44599_2.png) [@PatriceLebrun](https://discourse.julialang.org/u/PatriceLebrun)\
**Post date:** [July 1, 2024, 4:38pm UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/1 "2024-07-01T16:38:32Z")

</div>

Hi,  
I would like use julia in c++ environment in Particule Physics.  
All external packages are build from source code by using cmake.  
In this environment it’s very difficult to add Julia because of CMakeLists.txt is not available.  
Do you think possible to add such file in a near future ?

Thank you to take into account my request.  
Maybe it’s not the good place to do such request ?  
Patrice.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 1, 2024, 4:54pm UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/2 "2024-07-01T16:54:42Z")

</div>

What is CMake doing? It creates a Makefile. But the Julia source tree already contains a Makefile. You can always write a CMakeLists.txt file that checks out the Julia repo, installs the required dependencies and compiles it. But what would be the advantage?

Most libraries that Julia uses are heavily patched, and you cannot use the default libraries.

And for adding packages you want to use the package manager anyway, and not a CMakeLists.txt file.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 1, 2024, 6:44pm UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/3 "2024-07-01T18:44:12Z")

</div>

My thought is that it might make sense to store this in a `contrib` directory to allow the community that wants to use this to support it. There have been some attempts in the past.

---

<div class="post-metadata">

**Author:** ![PatriceLebrun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricelebrun/32/44599_2.png) [@PatriceLebrun](https://discourse.julialang.org/u/PatriceLebrun)\
**Post date:** [July 2, 2024, 8:14am UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/4 "2024-07-02T08:14:38Z")

</div>

I belong to an international collaboration of around 100 members. For about 10 years, C++ has been used for coding. The software uses so-called external packages from CERN such as Geant4, ROOT, CLHEP and also such as mysql and PYTHON. The policy for future-proofing is to compile, build and install them with CMAKE. All these software, even PYTHON, have a CMakeLists.txt for this purpose.  
Now, on my part, I am relatively new to this collaboration, and with a colleague we are developing pure Julia code with CUDA and IntervalArithmitic as master packages. It’s very nice to do it in Julia (thanks Julia community).  
But now we need to integrate our code into this software environment and unfortunately Julia doesn’t use CMAKE.  
This is the reason for my question.  
Note, almost all the members of this collaboration have never heard of Julia. But because of me, that’s not really the case anymore.  
So for me it’s like a challenge to convince to add Julia in the official software.  
Having CMakeLists.txt in Julia like PYTHON does will be very useful and great.  
Our code will no longer be autonomous in the future but unfortunately managed by the collaboration’s software environment AND NOT BY JULIA (of course the julia part will manage its own packages, it will be done during the build).  
We cannot change their policy.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 2, 2024, 8:17am UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/5 "2024-07-02T08:17:33Z")

</div>

Just write a CMakeLists.txt file and try it out…

---

<div class="post-metadata">

**Author:** ![PatriceLebrun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricelebrun/32/44599_2.png) [@PatriceLebrun](https://discourse.julialang.org/u/PatriceLebrun)\
**Post date:** [July 2, 2024, 8:30am UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/6 "2024-07-02T08:30:37Z")

</div>

I have no skills to do this.  
Otherwise I would not have made this request.  
But however, I think it would be a real plus for Julia.  
Thank you for your attention.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 2, 2024, 9:11am UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/7 "2024-07-02T09:11:11Z")

</div>

> [@PatriceLebrun](#):
>
> I have no skills to do this.

Not hard to learn. See for example: [https://www.youtube.com/watch?v=ddPzmWefC48](https://www.youtube.com/watch?v=ddPzmWefC48)

Or perhaps you have some collegues who can help you? At my University we have a competence center that helps researchers with these kind of issues: [About the DCC — DCC Guides](https://tu-delft-dcc.github.io/community/dcc.html)

---

<div class="post-metadata">

**Author:** ![PatriceLebrun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patricelebrun/32/44599_2.png) [@PatriceLebrun](https://discourse.julialang.org/u/PatriceLebrun)\
**Post date:** [July 2, 2024, 10:12am UTC](https://discourse.julialang.org/t/build-and-install-julia-from-source-code-with-cmake/116483/8 "2024-07-02T10:12:51Z")

</div>

I have had a bad information: PYTHON does not use CMAKE so I have a clue to install in our software JULIA as it’s done for PYTHON.
