mirror of https://gitlab.com/cppit/jucipp
Browse Source
This is a lot more precise than the currently exisiting method and correctly detects any modification to the executable file path (e.g. setting CMAKE_RUNTIME_OUTPUT_DIRECTORY or the OUTPUT_NAME property).merge-requests/413/head
6 changed files with 145 additions and 21 deletions
@ -0,0 +1,27 @@
|
||||
#include "cmake.hpp" |
||||
#include "config.hpp" |
||||
#include "process.hpp" |
||||
#include "project_build.hpp" |
||||
#include <boost/filesystem.hpp> |
||||
#include <glib.h> |
||||
#include <gtksourceviewmm.h> |
||||
|
||||
int main() { |
||||
auto app = Gtk::Application::create(); |
||||
Gsv::init(); |
||||
Config::get().project.default_build_path = "./build"; |
||||
Config::get().project.cmake.command = "cmake"; |
||||
|
||||
auto tests_path = boost::filesystem::canonical(JUCI_TESTS_PATH); |
||||
auto cmake_test_files_path = boost::filesystem::canonical(tests_path / "cmake_file_api_test_files"); |
||||
|
||||
CMake cmake(cmake_test_files_path); |
||||
g_assert(cmake.project_path == cmake_test_files_path); |
||||
|
||||
auto build = Project::Build::create(cmake_test_files_path); |
||||
g_assert(dynamic_cast<Project::CMakeBuild *>(build.get())); |
||||
|
||||
g_assert(build->update_default(true)); |
||||
|
||||
g_assert(build->get_executable(cmake_test_files_path / "main.cpp") == cmake_test_files_path / "build" / "custom_build_folder" / "custom_executable"); |
||||
} |
||||
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1) |
||||
|
||||
project(test) |
||||
add_compile_options(-O0 -g) |
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/custom_build_folder) |
||||
add_executable(cmake_file_api_test_executable main.cpp) |
||||
set_target_properties(cmake_file_api_test_executable PROPERTIES OUTPUT_NAME "custom_executable") |
||||
Loading…
Reference in new issue