- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have run into a peculiar issue: the Visual Studio solution we are using, consisting of several dozen projects, has a property that it is to be compiled with the classic compiler. But we want to experiment with ifx. VS allows you to change the compiler on a project level, but that is awkward as the solution with its projects is regularly generated via CMake. So, changing the compiler one project at a time would be tedious, error-prone and recurring.
Is there a way to instruct VS to use ifx as the default in stead of ifort? We have been checking the myriad of options that seem to control this sort of things, but we have failed so far.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has now been solved in CMake: CMake 3.29 Release Notes — CMake 3.30.0 Documentation
Pass the -T argument to cmake as a command line option:
cmake -G "Visual Studio 17 2022" -T fortran=ifx
(alternatively, the CMAKE_GENERATOR_TOOLSET variable can be used).
You can choose either ifx or ifort, see also How to use oneAPI Fortran ifx on WIndows Visual Studio generator? - Usage - CMake Discourse
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arjen_Markus,
You can create projects
Debug_ifx, Debug_ifort, Release_ifx, Release_ifort
DebugOpenMP_ifx, DebugOpenMP_ifort, ReleaseOpenMP_ifx, ReleaseOpenMP_ifort
Yes, this is a bit of work, but it is one-time work.
Alternatively (untested)
1) configure on project as ifort, copy its *.vfproj to a safe/temporary/differentName place
2) reconfigure that project as ifx
3) run a difference program on the two *.vfproj files
You will likely see differences in <Tool Name="..."> in multiple places and possibly <somethingElse="...">
4) create two edit scripts (AWK, PEARL, TECO, ...) to set the appropriate values (note, this can do a recursive search edit on *.vfproj files starting in the solution folder.
Then you should be able to think of some creative ways to run the desired Tool Name change script.
*** Experiment to see if for an Open Solution + Project if edits to the *.vfproj file (external to VS) are made visible to the open solution/project (as is done with source files). If so, you can add a tool to the tool bar to run the scripts .OR. create a Project that you can build that runs the script of choice.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://ahamodel.uib.no/intel/GUID-2A7170C9-7246-4267-99D8-EB8E1941B6D9.html
This looks like it might have something you can use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The difference you will see in the .vfproj is this:
If ifort:
<Configuration Name="Debug|x64">
If ifx:
<Configuration Name="Debug|x64" UseCompiler="ifxCompiler">
You could run a batch edit over the .vfproj files to change this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, your comment suggested to me that I could fix my problem of "project incompatible" by editting the .vfproj file to add 'UseCompiler="ifxCompiler"' in the appropriate places, and renaming the file as .ifx. But this revealed another problem. When I try to open a project within VS 2019, it doesn't display the .ifx file as a candidate project file, in fact *.ifx does not appear in the drop-down list of possible project file extensions, and the only file type for Intel Fortran projects is *.vfproj.
I tried renaming the file as .vfproj, but the same problem persists. I removed the "ifxCompiler" additions.
By the way, this project file builds a DLL. The project file for the main program that uses this DLL does load and build as usual. Comparing the two .vfproj files, apart from the fact that one refers to building a DLL and the other to building a console app, the only thing that I can see that could lead to different loading behaviour is the ProjectIdGuid string.
.....
I tried removing the .sln file from the folder, and now the project opens!! It shows as an "IFORT" project.
I can build, but I get a string of messages telling me to stop using ifort and use instead ifx. How do I do that? VS 2019 doesn't know about IFX files, although I installed the latest onAPI HPC version.
This is all very confusing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, we are considering just that sort of a solution, not ideal, as the project files are re-created from time to time. But this confirms our conclusion that Visual Studio itself does not allow a global change as to what compiler to use.
Thanks, all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arjen,
Suggestion for "easy" way to implement the launch the batch edit (without creating a VB script).
Add two Projects, perhaps Use_ifx and Use_ifort
Each project has a pre-build (or post build) step that runs the desired batch file (or command line).
Note, the project is to have no dependencies and is not dependent upon anything.
To effect the change, do a project-only rebuild of the desired project.
Adding a tool-tip is not that hard either. But that is something additional to learn.
Intel... you could add this to "Tools | Intel Compiler | ..." as part of the VS integration.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm, that looks like useful semi-automation step. I have forwarded this to my colleague. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I said nothing about renaming the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has now been solved in CMake: CMake 3.29 Release Notes — CMake 3.30.0 Documentation
Pass the -T argument to cmake as a command line option:
cmake -G "Visual Studio 17 2022" -T fortran=ifx
(alternatively, the CMAKE_GENERATOR_TOOLSET variable can be used).
You can choose either ifx or ifort, see also How to use oneAPI Fortran ifx on WIndows Visual Studio generator? - Usage - CMake Discourse

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page