In this paper, we propose two generalized precoder designs to enhance the bit error rates for the general category of spatial modulation (SM) in multiple-input multiple-output (MIMO) systems with channel state information at the transmitter (CSIT). We investigate typical SM-MIMO systems and propose two optimization formulations for designing precoders. Our design rationale for the first formulation is to maximize the minimum Euclidean distance among codewords; for the second formulation, it is to minimize the total signal power for the lower-bounded Euclidean distances among codewords. Since both formulations are non-convex and their optimal solutions are generally intractable, we propose an algorithm that acquires effective solutions by iteratively solving the alternative convex problem linearized and approximated from the original non-convex problem. Discussions on complexity analysis, performance comparisons, design challenges, and robustness in imperfect CSIT are then provided. By generalizing the design formulations, the proposed precoder designs can be extended to generalized SM, which completes the investigation for virtually all SM-type systems. Simulation results show that the proposed designs improve the performance of SM-/GSM-MIMO systems and outperform existing precoding methods with a potentially higher complexity cost.