| 883 | } |
| 884 | |
| 885 | bool CMakeSetupDialog::setupFirstConfigure() |
| 886 | { |
| 887 | FirstConfigure dialog; |
| 888 | |
| 889 | // initialize dialog and restore saved settings |
| 890 | |
| 891 | // add generators |
| 892 | dialog.setGenerators( |
| 893 | this->CMakeThread->cmakeInstance()->availableGenerators()); |
| 894 | |
| 895 | // restore from settings |
| 896 | dialog.loadFromSettings(); |
| 897 | |
| 898 | auto presetData = this->Preset->currentData(); |
| 899 | if (presetData.isValid()) { |
| 900 | auto preset = presetData.value<QCMakePreset>(); |
| 901 | dialog.setCurrentGenerator(preset.generator); |
| 902 | if (preset.setArchitecture) { |
| 903 | dialog.setPlatform(preset.architecture); |
| 904 | } |
| 905 | if (preset.setToolset) { |
| 906 | dialog.setToolset(preset.toolset); |
| 907 | } |
| 908 | dialog.setCompilerOption(CompilerOption::DefaultPreset); |
| 909 | } |
| 910 | |
| 911 | if (dialog.exec() == QDialog::Accepted) { |
| 912 | dialog.saveToSettings(); |
| 913 | this->CMakeThread->cmakeInstance()->setGenerator(dialog.getGenerator()); |
| 914 | this->CMakeThread->cmakeInstance()->setPlatform(dialog.getPlatform()); |
| 915 | this->CMakeThread->cmakeInstance()->setToolset(dialog.getToolset()); |
| 916 | |
| 917 | QCMakeCacheModel* m = this->CacheValues->cacheModel(); |
| 918 | |
| 919 | if (dialog.compilerSetup()) { |
| 920 | QString fortranCompiler = dialog.getFortranCompiler(); |
| 921 | if (!fortranCompiler.isEmpty()) { |
| 922 | m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", |
| 923 | "Fortran compiler.", fortranCompiler, false); |
| 924 | } |
| 925 | QString cxxCompiler = dialog.getCXXCompiler(); |
| 926 | if (!cxxCompiler.isEmpty()) { |
| 927 | m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", |
| 928 | "CXX compiler.", cxxCompiler, false); |
| 929 | } |
| 930 | |
| 931 | QString cCompiler = dialog.getCCompiler(); |
| 932 | if (!cCompiler.isEmpty()) { |
| 933 | m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", |
| 934 | "C compiler.", cCompiler, false); |
| 935 | } |
| 936 | } else if (dialog.crossCompilerSetup()) { |
| 937 | QString fortranCompiler = dialog.getFortranCompiler(); |
| 938 | if (!fortranCompiler.isEmpty()) { |
| 939 | m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", |
| 940 | "Fortran compiler.", fortranCompiler, false); |
| 941 | } |
| 942 |
no test coverage detected