From d20ab1b390c14ac794ca3438df7e1d9cf057ceed Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 8 Mar 2022 16:09:37 +0100 Subject: Add --linker, --build and --skip-compile options --- src/CmakeModule.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/CmakeModule.cpp') diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index a706e64..65e0c92 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -194,6 +194,7 @@ namespace sibs _putenv("CXXFLAGS=-fPIC"); #endif #endif + std::vector cmd = { cmakePath }; FileString cflags = TINYDIR_STRING("-fPIC"); @@ -238,6 +239,9 @@ namespace sibs } } + if(!config.linker.empty()) + cflags += TINYDIR_STRING(" -fuse-ld=") + toFileString(config.linker); + cxxflags = cflags; cmd.push_back(TINYDIR_STRING("-DCMAKE_C_FLAGS=") + cflags); cmd.push_back(TINYDIR_STRING("-DCMAKE_CXX_FLAGS=") + cxxflags); @@ -299,14 +303,16 @@ namespace sibs return Result::Err(execResult); //nprintf("Compiling cmake generated ninja file: %s\n", buildPath.c_str()); - execResult = exec({ TINYDIR_STRING("ninja"), TINYDIR_STRING("-C"), buildPath }, true); - if(execResult.isOk()) - { - if(execResult.unwrap().exitCode != 0) - return Result::Err(execResult.unwrap().execStdout); + if(config.skipCompile) { + execResult = exec({ TINYDIR_STRING("ninja"), TINYDIR_STRING("-C"), buildPath }, true); + if(execResult.isOk()) + { + if(execResult.unwrap().exitCode != 0) + return Result::Err(execResult.unwrap().execStdout); + } + else + return Result::Err(execResult); } - else - return Result::Err(execResult); if(config.getPackageType() != PackageType::EXECUTABLE) { -- cgit v1.2.3