# Using ifx rather than ifort with cmake

**URL:** <https://fortran-lang.discourse.group/t/using-ifx-rather-than-ifort-with-cmake/8423>\
**Category:** Uncategorized\
**Created:** [August 1, 2024, 8:11pm UTC](https://fortran-lang.discourse.group/t/using-ifx-rather-than-ifort-with-cmake/8423 "2024-08-01T20:11:31Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [August 7, 2024, 12:07pm UTC](https://fortran-lang.discourse.group/t/using-ifx-rather-than-ifort-with-cmake/8423/11 "2024-08-07T12:07:17Z")

</div>

I’ll leave this here as a note-to-self and for anyone else bumping into the same rock:

In order to build a MVS2022 project that can switch between classic or LLVM compilers (assuming \<= oneAPI2023), one can now do it with CMake (version \>3.29, I’m testing with 3.30.2):

- Classic C++ and Classic Fortran  
`-DCMAKE_GENERATOR_TOOLSET=Intel C++ Compiler 19.2,fortran=ifort`
- LLVM C++ and LLVM Fortran  
`-DCMAKE_GENERATOR_TOOLSET=Intel C++ Compiler 2023,fortran=ifx`

The Visual project is well set, and one can also then manually revert/change the compiler for individual projects.

---

_[View the full topic](https://fortran-lang.discourse.group/t/using-ifx-rather-than-ifort-with-cmake/8423)._
