# Help build lib optimize

**URL:** <https://ziggit.dev/t/help-build-lib-optimize/3497>\
**Category:** Help\
**Tags:** language\
**Created:** [March 7, 2024, 11:24am UTC](https://ziggit.dev/t/help-build-lib-optimize/3497 "2024-03-07T11:24:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPL](https://ziggit.dev/letter_avatar_proxy/v4/letter/j/a9adbd/32.png) [@JPL](https://ziggit.dev/u/JPL)\
**Post date:** [March 7, 2024, 11:24am UTC](https://ziggit.dev/t/help-build-lib-optimize/3497/1 "2024-03-07T11:24:07Z")

</div>

hello, how to optimize the library

in my main build I have:

```zig
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

```

but not in my build lib

maybe this is implied???

I need an explanation please

I did a test and put this in the main build  
Is this right

```zig
	///-----------------------
	/// build Pmaitre
	/// zig 0.12.0 dev
	///-----------------------

const std = @import("std");

pub fn build(b: *std.Build) void {
	// Standard release options allow the person running `zig build` to select
	// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
	const target = b.standardTargetOptions(.{});
	const optimize = b.standardOptimizeOption(.{});

	// library libary motor
	// zig-src source projet
	// src_c source c/c++
	// zig-src/lib source .h 

	// Building the executable
	
	const Prog = b.addExecutable(.{
	.name = "Pmaitre",
	.root_source_file = .{ .path = "./Pmaitre.zig" },
	.target = target,
	.optimize = optimize,
	});

	// for match use regex 
	//Prog.linkLibC();

	// Resolve the 'library' dependency.
	const library_dep = b.dependency("library", .{
		.target = target,
		.optimize = optimize,
	});

	// Import the smaller 'cursed' and 'utils' modules exported by the library. etc...
	Prog.root_module.addImport("cursed", library_dep.module("cursed"));
	Prog.root_module.addImport("utils", library_dep.module("utils"));
	Prog.root_module.addImport("match", library_dep.module("match"));
	Prog.root_module.addImport("forms", library_dep.module("forms"));
	Prog.root_module.addImport("grid", library_dep.module("grid"));
	Prog.root_module.addImport("menu", library_dep.module("menu"));
	Prog.root_module.addImport("callpgm", library_dep.module("callpgm"));
	Prog.root_module.addImport("crypto", library_dep.module("crypto"));

	Prog.root_module.addImport("zmmap", library_dep.module("zmmap"));

	
	Prog.root_module.addImport("decimal", library_dep.module("decimal"));

	b.installArtifact(Prog);

}

```

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [March 7, 2024, 1:41pm UTC](https://ziggit.dev/t/help-build-lib-optimize/3497/2 "2024-03-07T13:41:28Z")

</div>

The `addModule` [options documentation](https://ziglang.org/documentation/master/std/#A;std:Build.Module.CreateOptions) says:

> Unspecified options here will be inherited from parent `Module` when inserted into an import table.
